The problem: Ubuntu 10.10 doesn't supply LLVM CMake modules (/usr/share/llvm) or (/usr/local/share/llvm) when installing LLVM 2.8 from Ubuntu repositories.
So I'm now compiling LLVM 2.8 using CMake by myself and then installing it like this:
cmake ..
make
make install
This will install CMake modules I need to link LLVM into my library. The problem is that when I compile LLVM using CMake, only static libraries are compiled. I saw in LLVM documentation, that you can compile shared libraries using this parameter into CMake:
cmake -DBUILD_SHARED_LIBS=true ..
But now, the CMake returns this error:
-- Target triple: i686-pc-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Building with -fPIC
-- Targeting Alpha
-- Targeting ARM
-- Targeting Blackfin
-- Targeting CBackend
-- Targeting CellSPU
-- Targeting CppBackend
-- Targeting Mips
-- Targeting MBlaze
-- Targeting MSP430
-- Targeting PIC16
-- Targeting PowerPC
-- Targeting Sparc
-- Targeting SystemZ
-- Targeting X86
-- Targeting XCore
-- Configuring done
CMake Error: The inter-target dependency graph contains the following strongly connected component (cycle):
"LLVMARMCodeGen" of type SHARED_LIBRARY
depends on "LLVMARMAsmPrinter"
"LLVMARMAsmPrinter" of type SHARED_LIBRARY
depends on "LLVMARMCodeGen"
At least one of these targets is not a STATIC_LIBRARY. Cyclic dependencies are allowed only among static libraries.
-- Build files have been written to: /llvm-2.8/build
And I cannot compile it as shared library, does anyone knows how to solve that problem ?
I need the shared libraries because they're dependencies of many other tools.
Summary
1) LLVM 2.8 from Ubuntu repository installs LLVM shared libraries but doesn't install CMake modules I need.
2) On the other side, if I compile LLVM by myself, it installs the CMake modules I need, but I can only do that when compiling LLVM as static library.
After a lot of investigation (google, source and llvmdev mail-list), I discovered that this problem is in fact an issue with the 2.8 release, the compilation of shared libraries using CMake in that release is broken. I'm porting my library now to the version 2.9rc1 which is working fine and was already scheduled to be released soon, thanks for all answers.
LLVM 2.8 documentation does not mention building with CMake.
Try ./configure --enable-shared
Try reading this page and then ask on the llvmdev list if that doesn't help.
Related
I use conan as a dependency manager for a large C++ project. The project was built for Linux and I am porting it to Windows.
Due to this I am compiling with mingwin since that development environment is closer to mine.
However, conan knows it's running on windows and so it downloads windows binaries.
I am finding that although compilation works, linking fails because mingwin binaries and MSVC binaries are incompatible.
I am not sure if I need to try to instruct meson (my build system) to use cl as the compiler, or trick conan to download Linux libraries instead of windows.
I'm using a CUDA version which does not support the GCC version installed on my system (my GCC is too new). I'm trying to build a repository which uses CMake for build configuration.
I know how to override the C++ compiler, traditionally:
export CXX=/path/to/other/compiler-binary
and CMake picks this up. I can also use cmake -DCMAKE_CXX_COMPILER. However, neither of these options work when compiling CUDA host-side code: CMake still has CUDA try to use my default GCC version on my system.
How can I tell it to use the alternative C++ compiler for CUDA?
Additional info:
CMake 3.22.1
On Devuan GNU/Linux Chimaera
CMake will not (for now) default to using your CMAKE_CXX_COMPILER as the C++ compiler for CUDA host-side code; there's a different setting for that. Run your build configuration like so:
cmake -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-9
(replace the path with to your chosen C++ compiler of course)
I want to generate vxworks 6.x makefiles and workspace via CMake, and there is no support for VxWroks in CMake. How do I create a relevant generator for my platform anf the correct toolchain?
I'm new to CMake. I managed to create some test project that generate for windows VS 2015 and Ubuntu.
I tried to create one for VxWorks 6.x with GNU and DIAB compiler, but there is no support for it in CMake.
I read about something called toolchain, cross-compiling and platform files (.cmake) but I don't understand how to write it and where to put it.
I saw many examples in the internet but didn't understand if I need to rebuild the CMake with the new platform files or just reference to them form the toolchain or from CMakeLists.
I'm using the gui version of CMake 3.14.
I setting the generator as: Eclipse CDT4 - Unix Makefiles.
When I choosing the option of cross-compiling and provide name VxWorks, version, c++ compiler (gnu/4.1.2-vxworks-6.6/x86-win32/bin/c++ppc.exe), it write that the compiler is unknown and that I need to create Platform/VxWroks. It cannot build a simple test program.
I saw some post of someone who succeeded to create all required files :
Do (Cross-compile) platform files require an include guard?
But I couldn't download some examples to test it and a tutorial of how to do it.
I would like to be able to cgreate a generator with CMake for VxWorks 6.x to cimpile libraries and exacutable (.vxe) but don't know what to do.
CMake is not well supported in VxWorks 6, but CMake is supported from the Workbench/Eclipse GUI environment in VxWorks 7. Neither version supports command line cmake, e.g. "cmake ."
I have been building LLVM and clang 3.8 using svn for some time now. I started using git (this is not the cause of the problem) today and an error interrupted the build process that I have seen before. When make is trying to build the i386 sanitizer library it fails. I was able to disable building the sanitizers in ccmake by setting COMPILER_RT_BUILD_SANITIZERS to OFF. I would prefer to disable building the i386 target altogether. Does anyone know how to do this?
compiler-rt needs to be built out of tree. This is done so that it can be compiled with the newly built clang.
This process will only build the supported architecture, x86_64 in my case.
The following example uses the default install prefix (/usr/local)
to specify the location of llvm-config.
Once LLVM is built, change the directory to where you want compiler-rt
then:
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mkdir build
cd build
cmake ../compiler-rt -DLLVM_CONFIG_PATH=/usr/local/bin/llvm-config
make
make install
The current issue I am experiencing is setting up CMAKE for cross-compiling for the AARCH64 environment. The C++ project does reference some other third party libraries such as boost for its compiling.
I have read the documentation, but it is not really clear on the step-by-step procedure on what needs to be done in order to cross-compile using CMAKE for aarch64 on a x86_64 environment.
I have read that I need the rootfs of the aarch64 system, others it states I dont need it and only need the c++ compiler and cross headers/libraries.
At the current moment I am trying to compile the project on a Mustang board. But it runs in to issues with referencing the installed libraries for the x86_64 system.
If there is a person or site that could detail setup by step what would need to be done to this environment in order to get the entire project to cross-compile for aarch64 on a x86_64 system. I would greatly appreciate it.