Skip to content

[#2049] prevent empty location appended to rpath

Andrei Pavel requested to merge 2049-ax-find-library-rpath into master

Closes #2049 (closed)

For any normal Unix, this is the output of a pkg-config:

$ pkg-config --libs /usr/local/lib/pkgconfig/libyang.pc
-L/usr/local/lib -lyang

For Fedora 34, with the same .pc file:

$ pkg-config --libs /usr/lib64/pkgconfig/libyang.pc

-L is missing.

For any normal Unix, the final flags end up being:

-L/usr/local/lib -lyang -Wl,-R/usr/local/lib -lyang -L/usr/local/lib -lyang-cpp -Wl,-R/usr/local/lib -lyang-cpp

Notice the rpath flags -Wl,-R.

But because -L is missing, which is used to take the location from to be passed to -Wl,-R, on Fedora, these are:

-lsysrepo -Wl,-R -lyang -Wl,-R -lyang-cpp -Wl,-R -lsysrepo-cpp -Wl,-R

The empty -Wl,-R is causing undefined reference to std::ios_base::Init::Init(). I don't know why exactly, but I tested this on a separate file, and removing the empty flag gets rid of the linking error.

ut-extended job where this happens

I also made sure YANG repo in created in hammer in a separate commit.

Test run with these changes (watch for Fedora 34 especially):

Edited by Andrei Pavel

Merge request reports