Repository navigation
cmake: soname for output .so file - #5935
jainvishal wants to merge 2 commits into
Conversation
Originally the output .so file lacked the soname number under CMake. It was available in makefile. The change collects the libcurl version from libcurl.soname and then uses it for generated .so file.
|
Does this also make Further, does it setup the symlinks for .so and .so.4 ? When I build curl with configure (and if I check my Linux distro installation) the libs look like this: |
|
Yeah, I've tried to do that once already. You haven't taken into account other platforms. This seems to be correct for linux but will diverge from what autotools produce on other supported platforms. See my failed try here: https://github.com/jzakrzewski/curl/commits/soname |
|
@jzakrzewski do you think it would work as a first step if @jainvishal restricted this particular new logic to just Linux? I'm thinking it could be worth taking it step by step and fixing this one platform at a time. |
|
@bagder yes, absolutely. It has to be restricted to platforms where it's actually true. Would probably also be nice to be able to turn it off completely. Even if it's not a complete solution, it's progress. |
|
Another change is needed in src/CMakefile.txt for RPATH for curl binary to find the right libcurl.so after installation otherwise LD_LIBRARY_PATH has to be used to run properly. I have locally fixed this by adding the RPATH within the binary. @bagder, @jzakrzewski, do you guys think it will impose any issues for the other users. See below dump from my local binary. If you guys like to see the code, I can push it. So ldd shows And two more questions:
|
|
First, rpath would be a separate change and a separate discussion. In my personal opinion, curl itself should not set it unless asked for, but I would not object to an option that explicitly enables the use of it. There are many ways for users to make sure the right lib is found at run-time, rpath is just one. |
|
Hello @bagder, I compared output of make with cmake and found that make is also setting up RUNPATH and it is fully qualified. Please see below comparison. My cmake method can add the fully qualified RPATH or set the relative one using $ORIGIN. Latter ($ORIGIN) allows users to relocate compiled curl binary as long as libcurl remains in the relative path. This allows ldd to find libcurl as below: |
|
|
Point taken. So the change that I had submitted in PR, does it make sense? Or you want to limit that to LINUX only. I have tested the change on Linux and Solaris which I have access to.
|
|
If my old PR is any good, the "linux scheme" can be used for "AIX", "Linux", "GNU/kFreeBSD", "FreeBSD" (version 3.x and above), "Haiku", and "SunOS" (version 5 and 6). |
|
Now this flaw is mentioned specifically in the known bugs document: https://curl.haxx.se/docs/knownbugs.html#cmake_use_correct_SONAME_for_sh Any progress? |
|
I posted a commit to limit the soname changes to Linux for now. Since curl supports cmake 3.2 and above, I noticed incompatibility with the list handling I had implemented earlier. So I have made the changes for list handling to be compatible with older versions of cmake. During testing with cmake 3.2 I noticed another issue in tests/CMakeLists.txt:34 but that we can address separately. |
Limited soname changes to linux for now to avoid breaking any other OS. Also changed cmake list handling to make it compatible with the range of older cmake versions that curl supports.
|
@jzakrzewski, do you think this is an improvement enough limited to just Linux like this? It introduces yet another platform difference, which is bad, but it could also be seen as a first step towards actually making this work properly in more places... and I'm not sure we can expect that we can fix "all platforms" in one go anyway. |
Adopting this change made in CMake, with description: "kFreeBSD is no longer maintained or supported and was never an officially-supported release architecture for Debian." Credits-to: Roger Leigh Ref: https://gitlab.kitware.com/cmake/cmake/-/commit/99c8abed55c354f5674e52b25bb65391d4afca52 Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26742 Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26722 Follow-up to 5de6848 curl#10023 curl#5935
Adopting change made in CMake, with description: "kFreeBSD is no longer maintained or supported and was never an officially-supported release architecture for Debian." This system name was also dropped by CMake 4.1+: https://cmake.org/cmake/help/v4.2/variable/CMAKE_SYSTEM_NAME.html Credits-to: Roger Leigh Ref: https://gitlab.kitware.com/cmake/cmake/-/commit/99c8abed55c354f5674e52b25bb65391d4afca52 Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26742 Ref: https://gitlab.kitware.com/cmake/cmake/-/work_items/26722 Follow-up to 5de6848 #10023 #5935 Closes #22176
Originally the output .so file lacked the soname number under CMake.
It was available in makefile. The change collects the libcurl version
from libcurl.soname and then uses it for generated .so file.