cilkplus / clang

Other
27 stars 6 forks source link

"'os-fence.h' file not found" during build of pedigrees.c #16

Open phalpern opened 10 years ago

phalpern commented 10 years ago

My build procedure was:

$ git clone -b cilkplus https://github.com/cilkplus/llvm $ git clone -b cilkplus https://github.com/cilkplus/clang llvm/tools/clang $ git clone -b cilkplus https://github.com/cilkplus/compiler-rt llvm/projects/compiler-rt $ cd llvm $ mkdir build && cd build $ cmake -DCMAKE_INSTALL_PREFIX=/opt/clang-cilkplus -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD=X86 .. $ make

The make process gets 92% complete, then I get this error: [ 92%] Built target clang [ 92%] Generating pedigrees.c.o In file included from /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40: In file included from /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48: /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10: fatal error: 'os-fence.h' file not found

include "os-fence.h"

     ^

1 error generated. make[2]: * [projects/compiler-rt/lib/cilk/pedigrees.c.o] Error 1 make[1]: * [projects/compiler-rt/lib/cilk/CMakeFiles/cilkrts.dir/all] Error 2 make: *\ [all] Error 2

avt77 commented 10 years ago

It seems you're using Mac, right? In fact I'm using build-mac.sh keeping in 'llvm' folder. I did not try cmake yet. Look in my script - I hope it'll help you.

Andrew

2014-10-01 23:58 GMT+04:00 Pablo Halpern notifications@github.com:

My build procedure was:

$ git clone -b cilkplus https://github.com/cilkplus/llvm $ git clone -b cilkplus https://github.com/cilkplus/clang llvm/tools/clang $ git clone -b cilkplus https://github.com/cilkplus/compiler-rt llvm/projects/compiler-rt $ cd llvm $ mkdir build && cd build $ cmake -DCMAKE_INSTALL_PREFIX=/opt/clang-cilkplus -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD=X86 .. $ make

The make process gets 92% complete, then I get this error: [ 92%] Built target clang [ 92%] Generating pedigrees.c.o In file included from /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40: In file included from /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48: /home/pghalper/repo/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10: fatal error: 'os-fence.h' file not found

include "os-fence.h"

^ 1 error generated. make[2]: * [projects/compiler-rt/lib/cilk/pedigrees.c.o] Error 1 make[1]: * [projects/compiler-rt/lib/cilk/CMakeFiles/cilkrts.dir/all] Error 2 make: *\ [all] Error 2

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

phalpern commented 10 years ago

Nope. Linux. Ubuntu 14.04 to be precise. I was following the procedure on the github page.

neboat commented 10 years ago

I'm encountering exactly the same problem. I'm also using Linux, specifically Ubuntu 14.04.1 LTS (which is trusty, not precise ;)).

The build-linux.sh script also fails out of the box, though the problem seems fixable. Here's the error I see from running build-linux.sh: ... checking for gcc... clang checking whether the C compiler works... no configure: error: in /home/neboat/compilers/llvm-cilk-script/projects/compiler-rt/lib/cilk': configure: error: C compiler cannot create executables Seeconfig.log' for more details make: * No targets specified and no makefile found. Stop. make: * No rule to make target `install'. Stop.

Here's what's in the config.log file concerning the error: ... configure:3475: checking whether the C compiler works configure:3497: clang conftest.c >&5 /usr/bin/ld: cannot find crtbegin.o: No such file or directory /usr/bin/ld: cannot find -lgcc /usr/bin/ld: cannot find -lgcc_s clang: error: linker command failed with exit code 1 (use -v to see invocation) configure:3501: $? = 1 configure:3539: result: no configure: failed program was: /* confdefs.h _/ #define PACKAGE_NAME "Cilk Runtime" #define PACKAGE_TARNAME "cilk-runtime" #define PACKAGE_VERSION "2.0" #define PACKAGE_STRING "Cilk Runtime 2.0" #define PACKAGE_BUGREPORT "cilk@intel.com" #define PACKAGE_URL "" /_ end confdefs.h. */
int
main ()
{
;
return 0;
}

configure:3544: error: in `/home/neboat/compilers/llvm-cilk-script/projects/compiler-rt/lib/cilk': configure:3546: error: C compiler cannot create executables

On my system, it looks like libgcc is in a subdirectory of /usr, not a subdirectory of /usr/local. The following patch to build-linux.sh thus seems to fix the issue on my system: @@ -28,7 +28,7 @@

If you need to tune your environment - do it

export PATH=/usr/local/bin:/usr/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH

-../configure --with-gcc-toolchain=/usr/local +../configure

By default you should simply lanch

../configure

GrayGhost93 commented 10 years ago

Hi, I've got the same problem. Sorry, but I don't really understand your reply. I've made "export PATH=/usr/local/bin:/usr/bin:$PATH" in terminal and also "export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH" in Terminal.

The thing I don't really understand are the next two lines: -../configure --with-gcc-toolchain=/usr/local +../configure

How should I aply this? Can you help me please?

neboat commented 10 years ago

That part of my comment was referring to the build-linux.sh script in the cilkplus llvm repo (https://github.com/cilkplus/llvm). What I was trying to say was this: Rather than follow the cmake-based build procedure described on the github page (http://cilkplus.github.io/), I ran a modified version of this script, and I thereby had success building llvm and clang. The change I made to the build-linux.sh script was to remove the "--with-gcc-toolchain=/usr/local" part of line 31.

Sorry for the confusion. I hope that this comment clarifies things.

GrayGhost93 commented 10 years ago

Okay, thanks for the fast answer. This helped me to understand it. I also made the same change, but still have the same error at 88% while Gernerating pedigrees.c.o. It is written

In file included from /home//llvm/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40: In file included from /home//llvm/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48: /home//llvm/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10:fatal error: 'os-fence.h' file not found

include "os-fence.h"

Can you help me with this as well? I allready tried many times to install cilk, but it just don't want to work :(

neboat commented 10 years ago

I'm not sure if I can help, but I can try.

Can you see the compile command that generates that error? Can you rerun that command and add flags to show the compiler's include path?

GrayGhost93 commented 10 years ago

Sorry, but I don't really know how to make that. This is the output of the terminal:

[ 88%] Generating pedigrees.c.o In file included from /home/johannes/llvm/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40: In file included from /home/johannes/llvm/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48: /home/johannes/llvm/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10: fatal error: 'os-fence.h' file not found

include "os-fence.h"

     ^

1 error generated. make[2]: * [projects/compiler-rt/lib/cilk/pedigrees.c.o] Fehler 1 make[1]: * [projects/compiler-rt/lib/cilk/CMakeFiles/cilkrts.dir/all] Fehler 2 make: *\ [all] Fehler 2

Can you tell me how I can find out the required information?

benjamintanweihao commented 10 years ago

Getting the same thing too:

 89%] Generating pedigrees.c.o
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40:
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48:
/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10: fatal error:
      'os-fence.h' file not found
#include "os-fence.h"
         ^
1 error generated.
make[2]: *** [projects/compiler-rt/lib/cilk/pedigrees.c.o] Error 1
make[1]: *** [projects/compiler-rt/lib/cilk/CMakeFiles/cilkrts.dir/all] Error 2
make: *** [all] Error 2
benjamintanweihao commented 10 years ago

Also, make VERBOSE=1 gives the following output:

 89%] Generating pedigrees.c.o
cd /Users/benjamintan/llvm/build/projects/compiler-rt/lib/cilk && ../../../../bin/clang -O3 -DNDEBUG -std=c99 -fPIC -fcilkplus -Wall -Wno-typedef-redefinition -Wno-c11-extensions -I/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/include -I/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime -DIN_CILK_RUNTIME=1 -D__CILKRTS_ABI_VERSION=1 -DBUILD_USER= -DBUILD_HOST= -D_DARWIN_C_SOURCE -DNDEBUG -c -o pedigrees.c.o /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.c:40:
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/pedigrees.h:48:
/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/os.h:152:10: fatal error:
      'os-fence.h' file not found
#include "os-fence.h"
         ^
1 error generated.
make[2]: *** [projects/compiler-rt/lib/cilk/pedigrees.c.o] Error 1
make[1]: *** [projects/compiler-rt/lib/cilk/CMakeFiles/cilkrts.dir/all] Error 2
make: *** [all] Error 2
benjamintanweihao commented 10 years ago

Also, this happens:

 89%] Generating bug.cpp.o
cd /Users/benjamintan/llvm/build/projects/compiler-rt/lib/cilk && ../../../../bin/clang -O3 -DNDEBUG -fPIC -fcilkplus -Wall -Wno-typedef-redefinition -Wno-c11-extensions -I/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/include -I/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime -DIN_CILK_RUNTIME=1 -D__CILKRTS_ABI_VERSION=1 -DBUILD_USER= -DBUILD_HOST= -D_DARWIN_C_SOURCE -DNDEBUG -c -o bug.cpp.o /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/bug.cpp
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/bug.cpp:36:
In file included from /Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/runtime/bug.h:46:
/Users/benjamintan/llvm/projects/compiler-rt/lib/cilk/include/cilk/common.h:66:13: fatal error: 'cassert' file not found
#   include <cassert>
            ^
neboat commented 9 years ago

What commands are you running to clone and build the LLVM Cilkplus branch?

lsmatott commented 9 years ago

The following bash script worked for me:

!/bin/bash

module load gcc/4.9.2 module load cmake/2.8.12.1

PREFIX=/util/llvm/cilkplus OS_FENCE_SRC_DIR=$PREFIX/llvm/projects/compiler-rt/lib/cilk/runtime/config/x86 OS_FENCE_DST_DIR=$PREFIX/llvm/projects/compiler-rt/lib/cilk/runtime

Getting the source code

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

Building

The recommended way to build Cilk Plus/LLVM is using CMake.

Detailed instructions on how to build Clang/LLVM/Compiler-rt

with CMake can be found in the following page:

http://llvm.org/docs/CMake.html.

In the following command, make sure to replace /install/prefix

with the location where you would like to install the binaries.

cd $PREFIX/llvm mkdir build cd build CC=which gcc CXX=which g++ cmake \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_TARGETS_TO_BUILD=X86 .. cp $OS_FENCE_SRC_DIR/os-fence.h $OS_FENCE_DST_DIR make make install cd ..