> Well this is interesting. I tried to build llvm with:
>
> CC=gcc \
> CXX=g++ \
> cmake -DCMAKE_INSTALL_PREFIX=/usr \
> -DLLVM_ENABLE_FFI=ON \
> -DCMAKE_BUILD_TYPE=Release \
> -DLLVM_BUILD_LLVM_DYLIB=ON \
> -DLLVM_LINK_LLVM_DYLIB=ON \
> -DBUILD_SHARED_LIBS=ON \
> -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" \
> -Wno-dev ..
>
>
> -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG
> -- Performing Test CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG - Failed
> CMake Error at tools/llvm-shlib/CMakeLists.txt:39 (list):
> list sub-command REMOVE_DUPLICATES requires list to be present.
>
>
Here are my notes about the above problem, which I wrote for 4.0.0
(2017-04-29), but I guess still apply.
The essence is: do NOT switch *BOTH* LLVM_BUILD_LLVM_DYLIB and
BUILD_SHARED_LIBS ON (BTW, this caused a nasty problem with mesa build,
as mentioned below)
----8<----
* We now build with
-DBUILD_SHARED_LIBS=ON
* At first, got:
CMake Error at tools/llvm-shlib/CMakeLists.txt:39 (list):
list sub-command REMOVE_DUPLICATES requires list to be present.
The fix seems to be commenting the offending line in
tools/llvm-shlib/CMakeLists.txt
* Then I found that building mesa vs the just built llvm wasn't
working: the reason was that I was building with BOTH
LLVM_BUILD_LLVM_DYLIB and BUILD_SHARED_LIBS enabled. This has a
nasty consequence:
How to build mesa with llvm shared libs
=======================================
llvm's libraries can be built in two ways:
1.
-DLLVM_BUILD_LLVM_DYLIB=ON
-DBUILD_SHARED_LIBS=OFF (the default, so might be omitted)
2.
-DLLVM_BUILD_LLVM_DYLIB=OFF (or omitted)
-DBUILD_SHARED_LIBS=ON
When building with 1., all individual libs are built as static libs
(.a) and a jumbo libLLVM-x.y.z.so shared lib containing all the
functions defined in the static libs is also built.
When building with 2., all individual libs are built as shared
libs (.so) and no jumbo libLLVM-x.y.z.so shared lib is built.
Do not (not noT nOT NOT!!!) enable BOTH LLVM_BUILD_LLVM_DYLIB and
BUILD_SHARED_LIBS!!! This is explicitly stated in docs/Cmake.rst:
**LLVM_BUILD_LLVM_DYLIB**:BOOL
If enabled, the target for building the libLLVM shared library is added.
This library contains all of LLVM's components in a single shared library.
Defaults to OFF. This cannot be used in conjunction with BUILD_SHARED_LIBS.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tools will only be linked to the libLLVM shared library if
LLVM_LINK_LLVM_DYLIB
is also ON.
The components in the library can be customised by setting
LLVM_DYLIB_COMPONENTS to a list of the desired components.
If both LLVM_BUILD_LLVM_DYLIB and BUILD_SHARED_LIBS are ON, this is
the NASTY thing that happens: all individual libs are built as shared
libs (.so); HOWEVER, a dummy libLLVM-x.y.z.so shared lib is also
built: in this case, the libLLVM-x.y.z.so contains (almost)
nothing. Now: if you then build mesa vs this botched llvm, you will
get a build _crash for the following reason; the configure code of
mesa that deals with the llvm shared libs is the following:
[...]
if test "x$enable_llvm_shared_libs" = xyes; then
LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version`
if test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.$IMP_LIB_EXT"; then :
llvm_have_one_so=yes
fi
[...]
ie, IF it finds libLLVM-x.y.z.so, it will use that. BUT, when llvm was
built with both LLVM_BUILD_LLVM_DYLIB and BUILD_SHARED_LIBS enabled,
libLLVM-x.y.z.so contains garbage and this will make the build of mesa
miserably fail with a bunch of undefined llvm function calls (also:
difficult to debug)
So be supersure that only one of LLVM_BUILD_LLVM_DYLIB and
BUILD_SHARED_LIBS is enabled!!!
---->8----
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page