cilkplus / clang

Other
27 stars 6 forks source link

Build problem #13

Open mdole opened 10 years ago

mdole commented 10 years ago

I'm trying to build llvm/clang using the instructions provided (and I've tried using make instead of cmake), and I'm getting nothing but errors. I think the problem is in the compiler-rt section, as the errors are always in its subdirectories. The exact errors vary depending on which method I use to build--sometimes it can't find certain files, sometimes it doesn't recognize a flag, etc. Can anyone help me out? I'm happy to provide more detailed information if that would be useful.

Thanks!

azhang7 commented 10 years ago

What OS are you building on? Can you post the full output of cmake followed by make (maybe as a Gist)?

mdole commented 10 years ago

I'm working on Linux. Sure! Give me a few minutes.

mdole commented 10 years ago

Ok, here's the exact steps I took plus the Gist (beginning in $HOME):

  1. git clone -b cilkplus https://github.com/cilkplus/llvm
  2. git clone -b cilkplus https://github.com/cilkplus/clang llvm/tools/clang
  3. git clone -b cilkplus https://github.com/cilkplus/compiler-rt llvm/projects/compiler-rt
  4. cd llvm
  5. mkdir build && cd build
  6. cmake -DCMAKE_INSTALL_PREFIX=$HOME/llvm-cilkplus -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 .. Gist w/ cmake output: https://gist.github.com/mdole/8d36893d45cb6ad4b4fe I can't make at this stage (at least, not from the build directory) because no makefile is present. So I tried the following:
  7. ../configure --enable-optimization
  8. make -j8 > make_output.txt 2>&1 Gist w/ make output: https://gist.github.com/mdole/d92d188910f05c3dd7f9

Thoughts?

azhang7 commented 10 years ago

Did you build CMake yourself? I've never tried version 3 of CMake before but it looks like there's some changes that make it incompatible with how our CMake files are written. Try version 2.8 if possible.

Alternatively, if you want to use configure+make, remove the references to '-Werror' (just -Werror, not the entire line they appear on) in the .mk files in projects/compiler-rt/make/ and projects/compiler-rt/make/platform and it should build.

mdole commented 10 years ago

I did build cmake. I'll try v2.8 and see if that works first, and if it doesn't, I'll check out the -Werror idea. Thanks again, and I'll let you know what happens.

mdole commented 10 years ago

One other question: after running cmake with an older version (I'm trying 2.8.12.2), should the makefile be created in build? Or will I still have to configure?

azhang7 commented 10 years ago

CMake will generate Makefiles. configure is the other build system (autoconf). So don't run configure after running cmake.

mdole commented 10 years ago

Ok, that's what I thought. Even with the older cmake, the makefiles still aren't being made, and it's throwing the same error as before about not being able to find BasicBlockPlacement.cpp. I also tried removing the -Werrors, and using configure and make, and was met with this error: make/platform/clang_linux.mk:16: *\ "unable to infer compiler target triple for /export/shakespeare/home/dolem/llvm/build/Release+Asserts/bin/clang". Stop. Anything else I can try?

azhang7 commented 10 years ago

What does: $(CC) -v

produce? I'm guessing your compiler is gcc. I assume you cleaned out the build directory after editing the .mk files and switching between cmake and autoconf.

mdole commented 10 years ago

Yeah, I removed and remade build. I didn't undo the edits to the .mk files though; should I have? $CC is currently undefined, but I either use gcc or g++. I just set it (and CXX) with export CC=/export/shakespeare/home/dolem/gcc-cilk/bin/gcc:$CC export CXX=/export/shakespeare/home/dolem/gcc-cilk/bin/g++:$CXX Now when I cmake I get the following: Could not find compiler set in environment variable CXX:

/export/shakespeare/home/dolem/gcc-cilk/bin/g++:.

Call Stack (most recent call first): CMakeLists.txt:3 (project)

CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER_ENV_VAR CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly. Missing variable is: CMAKE_CXX_COMPILER CMake Error: Could not find cmake module file: /export/shakespeare/home/dolem/llvm/build/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! See also "/export/shakespeare/home/dolem/llvm/build/CMakeFiles/CMakeOutput.log".

Maybe I need to make sure I built cmake properly. I'll give that a shot.

azhang7 commented 10 years ago

$CC doesn't work like that. It's the command to use for invoking the C compiler, so you can't give it a list. Anyway, I meant run 'gcc -v' because that's what the autoconf file does before giving the error about not being able to infer the compiler triple. For gcc, I've only ever tried version 4.6 and 4.7 so I thought maybe there was something strange with the 4.4 output of -v.

Don't set CC and CXX before running cmake. It'll figure out your system defaults on its own. (You also don't have a binary called gcc in your llvm build dir/bin)

Leave the edits to the .mk files. It should stop the error about the unused variable in asan or whatever the other compiler-rt project was.

azhang7 commented 10 years ago

Also, what distro of Linux are you running?

avt77 commented 10 years ago

I'm using make and have no any problems except the one: I can't build cilkplus runtime library (there are some problems with tools' versions). Because of that I commented out the cilk folder in .../projects/compiler-rt/lib/Makefile.mk:

SubDirs += cilk

Without this folder everything works fine for me.

2014-07-09 20:57 GMT+04:00 Matt Dole notifications@github.com:

I'm trying to build llvm/clang using the instructions provided (and I've tried using make instead of cmake), and I'm getting nothing but errors. I think the problem is in the compiler-rt section, as the errors are always in its subdirectories. The exact errors vary depending on which method I use to build--sometimes it can't find certain files, sometimes it doesn't recognize a flag, etc. Can anyone help me out? I'm happy to provide more detailed information if that would be useful.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/cilkplus/clang/issues/13.

mdole commented 10 years ago

azhang--I'm on redhat. I'm using the version of gcc that comes with cilkplus; gcc -v produces version 4.9.0. Also, I configured it with --disable-multilib if that matters at all. I'll try switching my compiler to the stock gcc and see if that makes a difference (the default on my system is 4.8.2).

atv--Unfortunately, the cilkplus runtime library is the one I need. I'm building this to use with a cilk profiling tool. I tried doing a basic llvm build, and that worked fine, so I'm probably having a similar problem.

azhang7 commented 10 years ago

mdole -- Try going back to commit 635b68f8c82 in clang, 61a84fd533 in llvm. Those were the last versions I worked on and I'm almost 100% certain that should build like the instructions on the Github page say.

Unfortunately, CilkPlus/LLVM doesn't support cilk-specific profiling tools afaik. Perhaps someone on the current team can correct me if that's changed.

If you can build the compiler without the compiler-rt project, you may want to just grab the official Intel Cilk Plus runtime from https://www.cilkplus.org/download#runtime-sources. We use the exact same code, but changed the build system to conform to LLVM's.

azhang7 commented 10 years ago

avt77 - If you comment out "SubDirs += cilk" in the Makefile, the runtime won't be built and you won't be able to run Cilk Plus programs unless you manually build the runtime. You'll also get linker errors if you invoke the resulting clang binary with -fcilkplus as it will automatically add -lcilkrts.

mdole commented 10 years ago

After reverting to those commits, the cmake works fine and throws no warnings or errors. However, the make gets to a little over 50% and errors with this. As it turns out, I won't actually need llvm/clang for the project I'm working on--I just figured I'd add one more post to let you know how it turned out. Sorry to have wasted your time, and thanks for the help.

azhang7 commented 10 years ago

No worries, thanks for letting me know that recent commits have broken the build system. If you still want to try getting it to build, try commenting out lines 3-21 in compiler-rt/lib/CMakeLists.txt.

avt77 commented 10 years ago

That's what I meant when I suggested to comment out the line in makefile. In fact the build system requires the latest versions of build tools like gcc, autoconfig, python, etc. I could not build CilkPlus runtime because of that but all other things work. And runtime you can get from cilkplus.org.

BTW, just now I executed the following script:

!/bin/bash

if [ "$1" = "" ] then CLONE_NAME=cilkplus else CLONE_NAME=$1 fi

PATH_NAME=$CLONE_NAME-15-07-2015

echo Building $PATH_NAME...

git clone -b $CLONE_NAME https://github.com/cilkplus/llvm $PATH_NAME git clone -b $CLONE_NAME https://github.com/cilkplus/clang $PATH_NAME/tools/clang git clone -b $CLONE_NAME https://github.com/cilkplus/compiler-rt $PATH_NAME/projects/compiler-rt

As result I got the clone. Then I did:

cd $PATH_NAME mkdir build cd build export PATH=/usr/local/bin:/usr/bin:$PATH

I changed PATH because I have latest autotools, gcc and python in

/usr/local. Most possibly you don't need it

../configure --prefix=pwd

I used --prefix to have all created stuff in one place. You maybe don't

need it

Then I commented out 'cilk' folder and built the system

make -j8 export PATH=$PATH_NAME/build/Debug+Asserts/bin:$PATH

I extended PATH to be sure I'm using just created Clang

make check-all

All tests passed. But of course you have to have CilkPlus runtime

properly installed on your system.

I'll try to fix the runtime building soon but at the moment you can use this workaround.

2014-07-10 19:01 GMT+04:00 Andy Zhang notifications@github.com:

mdole -- Try going back to commit 635b68f https://github.com/cilkplus/clang/commit/635b68f8c82 in clang, 61a84fd533 in llvm. Those were the last versions I worked on and I'm almost 100% certain that should build like the instructions on the Github page say.

Unfortunately, CilkPlus/LLVM doesn't support cilk-specific profiling tools afaik. Perhaps someone on the current team can correct me if that's changed.

If you can build the compiler without the compiler-rt project, you may want to just grab the official Intel Cilk Plus runtime from https://www.cilkplus.org/download#runtime-sources. We use the exact same code, but changed the build system to conform to LLVM's.

— Reply to this email directly or view it on GitHub https://github.com/cilkplus/clang/issues/13#issuecomment-48616435.

ghost commented 10 years ago

If someone is interested, I've successfully compiled the binaries, you can download them from here: https://github.com/procedural/clang/releases

I tested cilk_for and reducer_list - they're working for sure :)

avt77 commented 10 years ago

procedural, tnx for your help: I've merged your fix with the branch.