www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - basic question about building ldc/calypso from source

reply "Laeeth Isharc" <nospamlaeeth nospam.laeeth.com> writes:
Hi.

I am struggling with using cmake to build LDC.  I have 
successfully built LLVM and clang following standard 
instructions, but I am not so familiar with cmake and do not know 
which directory LLVM_ROOT_DIR should point to.

Ultimately I would like to build calypso, but I have the same 
problem with stock LDC.

Running arch linux on a 64 bit machine.  I have tried various 
iterations of pointing to build directory as well as llvm parent.

[laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
-DCMAKE_BUILD_TYPE=Release

[laeeth console build]$ ls ../../llvm/
autoconf	 configure    LLVMBuild.txt	  README.txt
bin		 CREDITS.TXT  llvm.spec.in	  test
bindings	 docs	      Makefile		  tools
build		 examples     Makefile.common	  unittests
cmake		 include      Makefile.config.in  utils
CMakeLists.txt	 lib	      Makefile.rules
CODE_OWNERS.TXT  LICENSE.TXT  projects
[laeeth console build]$


This is the error I receive:

[laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
-DCMAKE_BUILD_TYPE=Release
CMake Error at cmake/Modules/FindLLVM.cmake:140 (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:174 (llvm_set_libs)
   CMakeLists.txt:18 (find_package)


CMake Error at 
/usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 
(message):
   Could NOT find LLVM: Found unsuitable version "", but required 
is at least
   "3.1" (found )
Call Stack (most recent call first):
   
/usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:372 
(_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindLLVM.cmake:196 
(find_package_handle_standard_args)
   CMakeLists.txt:18 (find_package)


-- Configuring incomplete, errors occurred!
See also 
"/btrfs0/dlang/calypso/calypso/build/CMakeFiles/CMakeOutput.log".
Feb 24 2015
next sibling parent Dan Olson <zans.is.for.cans yahoo.com> writes:
"Laeeth Isharc" <nospamlaeeth nospam.laeeth.com> writes:

 Hi.

 I am struggling with using cmake to build LDC.  I have successfully
 built LLVM and clang following standard instructions, but I am not so
 familiar with cmake and do not know which directory LLVM_ROOT_DIR
 should point to.
I think LLVM_ROOT_DIR has to be an absolute path. When I use a prebuild llvm, it get it to work like this: cmake -DLLVM_ROOT_DIR=/opt/local/libexec/llvm-3.4/ ... or when I use a llvm I built, say configured with --enable-optimized and --disable-assertions then I do something like (assume I built llvm in dir build-llvm): cmake -DLLVM_ROOT_DIR=/Users/dan/projects/build-llvm/Release/ ...
Feb 24 2015
prev sibling next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc wrote:
 Hi.

 I am struggling with using cmake to build LDC.  I have 
 successfully built LLVM and clang following standard 
 instructions, but I am not so familiar with cmake and do not 
 know which directory LLVM_ROOT_DIR should point to.

 Ultimately I would like to build calypso, but I have the same 
 problem with stock LDC.

 Running arch linux on a 64 bit machine.  I have tried various 
 iterations of pointing to build directory as well as llvm 
 parent.

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release

 [laeeth console build]$ ls ../../llvm/
 autoconf	 configure    LLVMBuild.txt	  README.txt
 bin		 CREDITS.TXT  llvm.spec.in	  test
 bindings	 docs	      Makefile		  tools
 build		 examples     Makefile.common	  unittests
 cmake		 include      Makefile.config.in  utils
 CMakeLists.txt	 lib	      Makefile.rules
 CODE_OWNERS.TXT  LICENSE.TXT  projects
 [laeeth console build]$


 This is the error I receive:

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
 CMake Error at cmake/Modules/FindLLVM.cmake:140 (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:174 (llvm_set_libs)
   CMakeLists.txt:18 (find_package)


 CMake Error at 
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 
 (message):
   Could NOT find LLVM: Found unsuitable version "", but 
 required is at least
   "3.1" (found )
 Call Stack (most recent call first):
   
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:372 
 (_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindLLVM.cmake:196 
 (find_package_handle_standard_args)
   CMakeLists.txt:18 (find_package)


 -- Configuring incomplete, errors occurred!
 See also 
 "/btrfs0/dlang/calypso/calypso/build/CMakeFiles/CMakeOutput.log".
you shouldn't have to specify LLVM_ROOT_DIR on a system like Arch, cmake should be perfectly capable of finding it on its own, assuming you have llvm installed somewhere sensible (i.e. where pacman puts it). All ldc's dependencies are available through pacman. What does `which llvm-config` give you? I just tested this with ldc on arch: git clone https://github.com/ldc-developers/ldc cd ldc git submodule update --init mkdir build cd build cmake ../ make -j8 everything worked fine.
Feb 24 2015
prev sibling next sibling parent "Joakim" <dlang joakim.fea.st> writes:
On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc wrote:
 Hi.

 I am struggling with using cmake to build LDC.  I have 
 successfully built LLVM and clang following standard 
 instructions, but I am not so familiar with cmake and do not 
 know which directory LLVM_ROOT_DIR should point to.

 Ultimately I would like to build calypso, but I have the same 
 problem with stock LDC.

 Running arch linux on a 64 bit machine.  I have tried various 
 iterations of pointing to build directory as well as llvm 
 parent.

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release

 [laeeth console build]$ ls ../../llvm/
 autoconf	 configure    LLVMBuild.txt	  README.txt
 bin		 CREDITS.TXT  llvm.spec.in	  test
 bindings	 docs	      Makefile		  tools
 build		 examples     Makefile.common	  unittests
 cmake		 include      Makefile.config.in  utils
 CMakeLists.txt	 lib	      Makefile.rules
 CODE_OWNERS.TXT  LICENSE.TXT  projects
 [laeeth console build]$


 This is the error I receive:

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
 CMake Error at cmake/Modules/FindLLVM.cmake:140 (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:174 (llvm_set_libs)
   CMakeLists.txt:18 (find_package)


 CMake Error at 
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 
 (message):
   Could NOT find LLVM: Found unsuitable version "", but 
 required is at least
   "3.1" (found )
 Call Stack (most recent call first):
   
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:372 
 (_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindLLVM.cmake:196 
 (find_package_handle_standard_args)
   CMakeLists.txt:18 (find_package)


 -- Configuring incomplete, errors occurred!
 See also 
 "/btrfs0/dlang/calypso/calypso/build/CMakeFiles/CMakeOutput.log".
Hmm, I tried pretty much the same command and it worked for me. I did notice that the command output listed the llvm directory as /usr, regardless of where my local llvm is, so maybe it also depends on the system llvm being installed? It shows the actual LLVM_ROOT_DIR in the generated CMakeCache.txt set to the right local directory, so maybe try installing the system llvm also and see if it makes a difference?
Feb 24 2015
prev sibling next sibling parent "Kai Nacke" <kai redstar.de> writes:
Hi Laeeth!

On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc wrote:
 Hi.

 I am struggling with using cmake to build LDC.  I have 
 successfully built LLVM and clang following standard 
 instructions, but I am not so familiar with cmake and do not 
 know which directory LLVM_ROOT_DIR should point to.

 Ultimately I would like to build calypso, but I have the same 
 problem with stock LDC.

 Running arch linux on a 64 bit machine.  I have tried various 
 iterations of pointing to build directory as well as llvm 
 parent.

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release

 [laeeth console build]$ ls ../../llvm/
 autoconf	 configure    LLVMBuild.txt	  README.txt
 bin		 CREDITS.TXT  llvm.spec.in	  test
 bindings	 docs	      Makefile		  tools
 build		 examples     Makefile.common	  unittests
 cmake		 include      Makefile.config.in  utils
 CMakeLists.txt	 lib	      Makefile.rules
 CODE_OWNERS.TXT  LICENSE.TXT  projects
 [laeeth console build]$
LLVM_ROOT_DIR is the directory where LLVM is installed. It is the output of llvm-config --prefix. If you have LLVM installed then there is no need to specify LLVM_ROOT_DIR. As an alternative you can add $(llvm-config --prefix)/bin to your PATH variable.
 This is the error I receive:

 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
 CMake Error at cmake/Modules/FindLLVM.cmake:140 (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:174 (llvm_set_libs)
   CMakeLists.txt:18 (find_package)


 CMake Error at 
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:138 
 (message):
   Could NOT find LLVM: Found unsuitable version "", but 
 required is at least
   "3.1" (found )
 Call Stack (most recent call first):
   
 /usr/share/cmake-3.1/Modules/FindPackageHandleStandardArgs.cmake:372 
 (_FPHSA_FAILURE_MESSAGE)
   cmake/Modules/FindLLVM.cmake:196 
 (find_package_handle_standard_args)
   CMakeLists.txt:18 (find_package)


 -- Configuring incomplete, errors occurred!
 See also 
 "/btrfs0/dlang/calypso/calypso/build/CMakeFiles/CMakeOutput.log".
Which version of LLVM and LDC do you use? The error message looks like your using a recent LLVM with an old LDC version.... Regards, Kai
Feb 24 2015
prev sibling parent reply "Elie Morisse" <syniurge gmail.com> writes:
On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc wrote:
 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
Hi Laeeth, Didn't you get LLVM_ROOT_DIR mixed up with LLVM_SOURCE_PATH added for Calypso and which has to point to a LLVM + Clang source tree?
Feb 24 2015
next sibling parent "Laeeth Isharc" <nospamlaeeth nospam.laeeth.com> writes:
Hi All.

Thank you for the generous help.  I am not able to use a computer 
properly at moment, but hope to resume shortly.


Laeeth

On Tuesday, 24 February 2015 at 23:38:13 UTC, Elie Morisse wrote:
 On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc 
 wrote:
 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
Hi Laeeth, Didn't you get LLVM_ROOT_DIR mixed up with LLVM_SOURCE_PATH added for Calypso and which has to point to a LLVM + Clang source tree?
Feb 26 2015
prev sibling parent reply "Laeeth Isharc" <nospamlaeeth nospam.laeeth.com> writes:
On Tuesday, 24 February 2015 at 23:38:13 UTC, Elie Morisse wrote:
 On Tuesday, 24 February 2015 at 16:33:31 UTC, Laeeth Isharc 
 wrote:
 [laeeth console build]$ cmake .. -DLLVM_ROOT_DIR='../../llvm' 
 -DCMAKE_BUILD_TYPE=Release
Hi Laeeth, Didn't you get LLVM_ROOT_DIR mixed up with LLVM_SOURCE_PATH added for Calypso and which has to point to a LLVM + Clang source tree?
Yes - you were spot on. Diminishing marginal returns to working without a break. Thanks for the help. Laeeth.
Mar 02 2015
parent "Suliman" <evermind live.ru> writes:
Please if somebody will build calypso for Windows share bin. I do 
not have enough knowledges to build it's himself
Mar 05 2015