I have the following code inside a spec file:
mkdir -p %{buildroot}%{_qt6_bindir}
pushd %{buildroot}%{_qt6_bindir}
for i in * ; do
case "${i}" in
qdbuscpp2xml|qdbusxml2cpp|qtpaths)
ln -v ${i} %{buildroot}%{_bindir}/${i}-qt6
;;
*)
ln -v ${i} %{buildroot}%{_bindir}/${i}
;;
esac
done
popd
when i run build i got following error:
ln: target '/home/abuild/rpmbuild/BUILDROOT/qt6-qtbase-6.4.3-1.x86_64/usr/bin/qtpaths6': Not a directory
where qtpath6 is an excutable file. how to fix this error?
What's going on is that a component of the target path is not a directory. I can reproduce the problem like this:
That's because
/etc/hostsis a file. I picked that well-known file to make it obvious.(The wording of the diagnostic is not exactly the same in my version of
lnas you can see.)What's probably happening is that
lncalls thelinksystem call, which fails with a -1 and anerrnoofENOTDIR. The program just translates that error toNot a directoryviastrerror, and attributes the error to the target path as such.We know that
lncannot possibly be complaining that the target isn't a directory, because that is specifically disallowed: you cannot make a hard link to a directory!