www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Building ldc without root access, cannot find llvm

reply "Andrew Brown" <aabrown24 hotmail.com> writes:
Hi,

I'm trying to build ldc on a cluster, so I have no root access to 
install llvm or the required libraries in the usual places. I've 
installed both in my home directory, and I think llvm-config is 
working OK, the following commands give the following output:

/home/abrown/software/ldc/llvm/bin/llvm-config --version
3.5.0

/home/abrown/software/ldc/llvm/bin/llvm-config --components
  all all-targets analysis asmparser asmprinter bitreader 
bitwriter codegen core debuginfo engine executionengine 
instcombine instrumentation interpreter ipa ipo irreader jit 
lineeditor linker lto mc mcanalysis mcdisassembler mcjit mcparser 
native nativecodegen objcarcopts object option profiledata 
runtimedyld scalaropts selectiondag support tablegen target 
transformutils vectorize x86 x86asmparser x86asmprinter 
x86codegen x86desc x86disassembler x86info x86utils

But when it comes to running cmake, I don't think it's finding 
llvm:

cmake -L -DLLVM_ROOT_DIR="/home/abrown/software/ldc/llvm/" 
-DLLVM_CONFIG="/home/abrown/software/ldc/llvm/bin" 
-DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/lib" 
-DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/lib" ..

CMake Error at cmake/Modules/FindLLVM.cmake:141 (string):
   string sub-command REGEX, mode MATCHALL needs at least 5 
arguments total to
   command.
Call Stack (most recent call first):
   cmake/Modules/FindLLVM.cmake:175 (llvm_set_libs)
   CMakeLists.txt:18 (find_package)


CMake Error at 
/software/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 
(message):
   Could NOT find LLVM (missing: LLVM_ROOT_DIR LLVM_HOST_TARGET) 
(Required is
   at least version "3.1")
Call Stack (most recent call first):
   
/software/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 
(_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindLLVM.cmake:197 
(find_package_handle_standard_args)
   CMakeLists.txt:18 (find_package)


-- Configuring incomplete, errors occurred!
See also 
"/home/abrown/software/ldc/ldc/build/CMakeFiles/CMakeOutput.log".
-- Cache values
CMAKE_BUILD_TYPE:STRING=
CMAKE_INSTALL_PREFIX:PATH=/usr/local
LLVM_CONFIG:FILEPATH=/home/abrown/software/ldc/llvm/bin

I've also tried setting LLVM_ROOT_DIR and LLVM_CONFIG as 
environment variables, but that doesn't work.

Could anyone help me out with where I'm going wrong?

Thanks very much

Andrew Brown
May 26 2015
parent reply "David Nadlinger" <code klickverbot.at> writes:
Hi Andrew,

On Tuesday, 26 May 2015 at 12:50:15 UTC, Andrew Brown wrote:
 But when it comes to running cmake, I don't think it's finding 
 llvm:

 cmake -L -DLLVM_ROOT_DIR="/home/abrown/software/ldc/llvm/" 
 -DLLVM_CONFIG="/home/abrown/software/ldc/llvm/bin" 
 -DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/lib" 
 -DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/lib" ..
LLVM_CONFIG expects the actual path of the binary itself, i.e. in this case …/bin/llvm-config. This is because some distributions rename (e.g. postfix) their LLVM tool names. You should only need to specify one of the two variables, though. If you just set LLVM_CONFIG to the full path, it should automatically find the rest. — David
May 26 2015
parent reply "Andrew Brown" <aabrown24 hotmail.com> writes:
Thank you very much, that worked perfectly. I still had trouble 
with the libraries though, before I set the following flags the 
make command stopped at about 14%:

-DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/libs/lib/libconfig.a" 
-DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/libs/include"

When I compile my software however, I get warnings such as:

/home/abrown/software/ldc/ldc/build/runtime/../lib/libphobos2-ldc.a(curl.o): 
In function `_D3std3net4curl4HTTP18_sharedStaticCtor1FZv':
/home/abrown/software/ldc/ldc/runtime/phobos/std/net/curl.d:(.text._D3std3net4curl4HTTP18_sharedS
aticCtor1FZv+0x10): 
undefined reference to `curl_version_info'

Is tihs because it doesn't like the version of libcurl installed 
on my system? Could you point me towards a repository where I can 
download and install this and how I should adjust the flags to 
cmake (I'm on RHEL 6 if that's important)?

Thank you very much for helping me, would it be handy for me to 
update the wiki to reflect what I've learnt?

Andrew

On Tuesday, 26 May 2015 at 12:52:59 UTC, David Nadlinger wrote:
 Hi Andrew,

 On Tuesday, 26 May 2015 at 12:50:15 UTC, Andrew Brown wrote:
 But when it comes to running cmake, I don't think it's finding 
 llvm:

 cmake -L -DLLVM_ROOT_DIR="/home/abrown/software/ldc/llvm/" 
 -DLLVM_CONFIG="/home/abrown/software/ldc/llvm/bin" 
 -DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/lib" 
 -DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/lib" ..
LLVM_CONFIG expects the actual path of the binary itself, i.e. in this case …/bin/llvm-config. This is because some distributions rename (e.g. postfix) their LLVM tool names. You should only need to specify one of the two variables, though. If you just set LLVM_CONFIG to the full path, it should automatically find the rest. — David
May 26 2015
parent reply "Andrew Brown" <aabrown24 hotmail.com> writes:
I managed to get things working, I just need to add a -L-lcurl 
flag when I compile. Thanks for helping, I was very stuck. If 
those cmake flags seem sensible, I'm happy to update the wiki (I 
found the description of LLVM_CONFIG a bit ambiguous as it was).

Best

Andrew

On Tuesday, 26 May 2015 at 14:18:03 UTC, Andrew Brown wrote:
 Thank you very much, that worked perfectly. I still had trouble 
 with the libraries though, before I set the following flags the 
 make command stopped at about 14%:

 -DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/libs/lib/libconfig.a" 
 -DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/libs/include"

 When I compile my software however, I get warnings such as:

 /home/abrown/software/ldc/ldc/build/runtime/../lib/libphobos2-ldc.a(curl.o): 
 In function `_D3std3net4curl4HTTP18_sharedStaticCtor1FZv':
 /home/abrown/software/ldc/ldc/runtime/phobos/std/net/curl.d:(.text._D3std3net4curl4HTTP18_sharedS
aticCtor1FZv+0x10): 
 undefined reference to `curl_version_info'

 Is tihs because it doesn't like the version of libcurl 
 installed on my system? Could you point me towards a repository 
 where I can download and install this and how I should adjust 
 the flags to cmake (I'm on RHEL 6 if that's important)?

 Thank you very much for helping me, would it be handy for me to 
 update the wiki to reflect what I've learnt?

 Andrew

 On Tuesday, 26 May 2015 at 12:52:59 UTC, David Nadlinger wrote:
 Hi Andrew,

 On Tuesday, 26 May 2015 at 12:50:15 UTC, Andrew Brown wrote:
 But when it comes to running cmake, I don't think it's 
 finding llvm:

 cmake -L -DLLVM_ROOT_DIR="/home/abrown/software/ldc/llvm/" 
 -DLLVM_CONFIG="/home/abrown/software/ldc/llvm/bin" 
 -DLIBCONFIG_LIBRARY="/home/abrown/software/ldc/lib" 
 -DLIBCONFIG_INCLUDE_DIR="/home/abrown/software/ldc/lib" ..
LLVM_CONFIG expects the actual path of the binary itself, i.e. in this case …/bin/llvm-config. This is because some distributions rename (e.g. postfix) their LLVM tool names. You should only need to specify one of the two variables, though. If you just set LLVM_CONFIG to the full path, it should automatically find the rest. — David
May 26 2015
parent reply "Kai Nacke" <kai redstar.de> writes:
Hi Andrew!

On Tuesday, 26 May 2015 at 16:17:36 UTC, Andrew Brown wrote:
 I managed to get things working, I just need to add a -L-lcurl 
 flag when I compile. Thanks for helping, I was very stuck. If 
 those cmake flags seem sensible, I'm happy to update the wiki 
 (I found the description of LLVM_CONFIG a bit ambiguous as it 
 was).
Glad to hear that it works now. Every improvement to the wiki is welcome! If you have an idea how to describe it better than please add it. Thanks in advance! Regards, Kai
May 26 2015
parent "Andrew Brown" <aabrown24 hotmail.com> writes:
I had a go at editing it, hope it's ok

Thanks again

Andrew
On Tuesday, 26 May 2015 at 16:41:11 UTC, Kai Nacke wrote:
 Hi Andrew!

 On Tuesday, 26 May 2015 at 16:17:36 UTC, Andrew Brown wrote:
 I managed to get things working, I just need to add a -L-lcurl 
 flag when I compile. Thanks for helping, I was very stuck. If 
 those cmake flags seem sensible, I'm happy to update the wiki 
 (I found the description of LLVM_CONFIG a bit ambiguous as it 
 was).
Glad to hear that it works now. Every improvement to the wiki is welcome! If you have an idea how to describe it better than please add it. Thanks in advance! Regards, Kai
May 26 2015