LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 15493 - No option to build shared libLLVM-version.so in CMake
Summary: No option to build shared libLLVM-version.so in CMake
Status: RESOLVED FIXED
Alias: None
Product: Build scripts
Classification: Unclassified
Component: cmake (show other bugs)
Version: trunk
Hardware: PC Linux
: P enhancement
Assignee: NAKAMURA Takumi
URL:
Keywords:
Depends on:
Blocks: 15732
  Show dependency tree
 
Reported: 2013-03-11 21:57 PDT by rnddim
Modified: 2015-03-02 11:50 PST (History)
13 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rnddim 2013-03-11 21:57:30 PDT
The ./configure system has the option --enable-shared, which creates a libLLVM-version.so file, e.g. libLLVM-3.3.so.

There is a similarly named option available from CMake. This option builds .so files instead of .a files, but doesn't create the libLLVM-version.so file, which is required for certain programs, e.g. the OpenShadingLanguage project. I request that either this existing CMake option or a new option would allow the creation of libLLVM-version.so with CMake.
Comment 1 Michał Górny 2013-12-26 12:55:42 PST
To be honest, I'd rather work on getting rid of this file completely. There's no sane way of getting the name of this file, and llvm-config only focuses on the split libraries.
Comment 2 David Fang 2013-12-30 21:43:24 PST
I'm no cmake expert, but the cmake+shared build produces a libclang-3.x.{so,dylib} that links all of the constituent libclang* libs.  Couldn't that be done with the libLLVM* set?
Comment 3 Stephen Kelly 2014-02-02 11:43:49 PST
Is this out of scope or not, as suggested by Michał Górny?

If not, it can be done.
Comment 4 Scott West 2014-02-14 10:11:32 PST
Speaking from working with the Haskell bindings (and echoing Michał's point) and in other situations: it sucks having libLLVM-$version.so and then the split static libraries, and there's no way to figure any of it out from llvm-config (and I wouldn't suggest llvm-config to deal with it).

Also, it makes it much easier if one wants to support either the dynamic or static compilation in a client of the LLVM libraries. If they have the same names, then the -static flag should work as one would expect (I believe).

In short: libLLVM-$version.so seems to invite hacks in consumers of the library.
Comment 5 Stephen Kelly 2014-02-15 02:42:56 PST
Scott,

At least from a point of view of cmake consuming the library, the file name on disk is not relevant. Whether shared or static, a symbolic name will be used in cmake code, so not explicit handling of static/shared for the file name will be needed.

Your comment might be deserving of a separate bug report to reach the right people.
Comment 6 Scott West 2014-02-15 03:00:45 PST
> At least from a point of view of cmake consuming the library, the file name
> on disk is not relevant. Whether shared or static, a symbolic name will be
> used in cmake code, so not explicit handling of static/shared for the file
> name will be needed.

Perhaps I misunderstood the suggestion: would you want to provide an option to generate libLLVM-$version.so to replace the more granular *.so's, or to generate both?
Comment 7 Stephen Kelly 2014-02-15 03:14:57 PST
Ah, sorry, I think I misunderstood.

Actually I can't imagine why OpenShadingLanguage thinks they need the -$version.so file. That might just be a misunderstanding too?

> Perhaps I misunderstood the suggestion: would you want to provide an 
> option to generate libLLVM-$version.so to replace the more 
> granular *.so's, or to generate both?

I'll leave that up to the llvm developers to decide.
Comment 8 NAKAMURA Takumi 2014-03-04 17:58:49 PST
I am working for this.
http://llvm-reviews.chandlerc.com/D2942
Comment 9 Scott West 2014-03-05 02:40:19 PST
(In reply to comment #8)
> I am working for this.
> http://llvm-reviews.chandlerc.com/D2942

Is the proposal to completely replace the granular lib*.so's with libLLVM-version.so and remove the ability to generate the granular lib*.so's ? Because that would re-break llvm-config, it's already broken for the autotools build (unless this has recently changed).

See Bug #6823.
Comment 10 NAKAMURA Takumi 2014-03-05 02:57:01 PST
I don't have a plan to deprecate BUILD_SHARED_LIBS.
Comment 11 Chris Bieneman 2014-11-06 17:27:57 PST
I've submitted patches for review:
http://reviews.llvm.org/D6157
Comment 12 Chris Bieneman 2015-02-24 11:52:07 PST
Fixed by:
r229720: Enable standard so versioning for libLLVM.
Comment 13 Evangelos Foutras 2015-02-28 00:39:47 PST
(In reply to comment #12)
> Fixed by:
> r229720: Enable standard so versioning for libLLVM.

Looking at the diff, shouldn't SOVERSION be set to "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}" instead of just "${LLVM_VERSION_MAJOR}" since ABI changes with each minor LLVM release (e.g. 3.5 -> 3.6)?
Comment 14 Chris Bieneman 2015-03-02 11:26:00 PST
Yes, that's a really good catch. I'll fix that today.
Comment 15 Chris Bieneman 2015-03-02 11:50:36 PST
Fixed r230981.