Skipping linker flag for versioned dylib on Darwin#2989
Skipping linker flag for versioned dylib on Darwin#2989linzhp merged 13 commits intobazel-contrib:masterfrom
Conversation
|
Wouldn't it make more sense to strip the version from the versioned one from the linking command line? instead of manually adding it in the clinkopts and removing duplicates ? |
|
On Linux, @jayconrod commented:
On Darwin, stripping the version and passing something like |
kmicklas
left a comment
There was a problem hiding this comment.
Can you test if it works when the file name is in the standard darwin versioned dylib format (libname.$VERSION.dylib)? (Maybe there should be a test for this too?)
Also, I think the PR description should be more clear that this is to support the non-standard naming scheme which we found in the Oracle client.
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
The linker cannot find the versioned dylib on macOS with
-l :libclntsh.dylib.12.1like we did for Linux. According to Mac OS X For Unix Geeks, 4th Edition, Chapter 11, a versioned libMagick library should be named in the form oflibMagick.10.0.7.dylib, and linked with-lMagick.10.0.7. The logic for passing such linker flag is the same as an unversioned shared library.However, when distributing Instant Client for macOS, Oracle decided to put the version number at the end of the file name using the same convention as shared libraries on Linux. Fortunately, recent versions of Instant Client also come with an unversioned symbolic link pointing to the versioned dylib. We can use the symlink as an unversioned shared library.
In both cases, we don't need any specific logic to pass linker flags for versioned dylib for Darwin.
Which issues(s) does this PR fix?
Fixes #2944
Other notes for review
Alternatively, we can try to figure out how to pass linker options so it can find the versioned dylib files on macOS without the symlink