training icon indicating copy to clipboard operation
training copied to clipboard

[Feedback] Conan Essentials - Runtime Linking

Open Minimonium opened this issue 5 years ago • 3 comments

I believe the course has not quite correct information about the runtime linking. In the slide it shows the line that imports so file to the bin directory and the narrator mentions that by default linker will look into the directory, but it's, in fact, only the default behaviour on Windows, not Linux! For Linux you'd need to point the LD_LIBRARY_PATH to the bin directory.

The runtime linking is a hard problem and I believe creating a section on it would be useful to help users on the border between Linux system programming and "user-space" C++ programming with Conan.

Minimonium avatar Sep 27 '20 17:09 Minimonium

You are absolutely right. I did a ton of work at my last company to workaround the issue that linux runtime linker does not look in the current directory. I didn't create this slide, and when I read it, I thought that perhaps I somehow I had missed something at my previous job and I never took the time to test it. We should fix this ASAP.

solvingj avatar Sep 28 '20 11:09 solvingj

Yeah, so, i just double checked and the reason this mistake probably made it through sanity tests is that the test_package works because of the RUNPATH being set by default with CMake. The import is completely un-used, and very misleading at that.

readelf -d example | grep RUNPATH
0x000000000000001d (RUNPATH)            Library runpath: [/home/jerryw/.conan/data/hello/0.1/user/testing/package/27cb7fbffba1a5268eda91c4da54b0254d48c3b1/lib]

solvingj avatar Sep 28 '20 15:09 solvingj

That's why I think it could be great to extend the section about runtime linking to help new users with these gotchas. :slightly_smiling_face:

Minimonium avatar Sep 28 '20 15:09 Minimonium