I've built LLVM/Clang from svn under Cygwin on Windows 7. I'd like to build on the LLVMHello pass example, however, when I try: $ cd $LLVM/lib/Transforms/Hello $ make I receive a large number of errors which start with: llvm[0]: Linking Debug+Asserts Loadable Module LLVMHello.dll /cygdrive/c/Users/Graham/home/projects/llvm_cygwin/lib/Transforms/Hello/Debug+Asserts/Hello.o: In function `runOnFunction': /cygdrive/c/Users/Graham/home/projects/llvm_cygwin/lib/Transforms/Hello/Hello.cpp:32: undefined reference to `llvm::errs()' ... I've built and ran the same example under Linux with no problems. Does anyone have an idea what the problem might be? -- Graham
Graham, good morning. To build LLVMHello on cygming, you should configure llvm with --enable-shared . Even with enable-shared, you might build lib/Transforms/Hello manually. (yeah, on cygming, LLVMHello should depend on tools/llvm-shlib) And, you'd be better to build with --enable-optimized. With enable-shared, llvm-shlib tends to fail with too many debug symbols. HTH, ...Takumi
Thankyou Takumi, Without --enable-optimized I get a"File too big" error from the linker: ... llvm[1]: Linking all LLVMLibs together for LLVM-3.0svn /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /cygdrive/c/Users/Graham/home/projects/llvm_cygwin3/tools/llvm-shlib/Debug+Asserts/LLVM-3.0svn.a.o: too many sections (59747) /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: final link failed: File too big collect2: ld returned 1 exit status make[1]: *** [/cygdrive/c/Users/Graham/home/projects/llvm_cygwin3/tools/llvm-shlib /Debug+Asserts/LLVM-3.0svn.a.o] Error 1 make[1]: Leaving directory `/cygdrive/c/Users/Graham/home/projects/llvm_cygwin3/tools/llvm-shlib' make: *** [all] Error 1 (By the way, I have 4Gb Ram under 64-bit Windows 7, and use Cygwin's GCC 4.5.3) If I instead use --enable-optimized, everything builds, however any invocation of clang.exe now halts with a segmentation fault, as shown: clang hello.c fails: 0 [main] clang 3608 exception::handle: Exception: STATUS_ACCESS_VIOLATION 10619 [main] clang 3608 open_stackdumpfile: Dumping stack trace to clang.exe.stackdump clang: error: unable to execute command: Segmentation fault (core dumped) clang: error: clang frontend command failed due to signal 2 (use -v to see invocation) clang: note: diagnostic msg: Please submit a bug report to http://llvm.org/bugs/ and include command line arguments and all diagnostic information. clang: error: unable to execute command: Segmentation fault (core dumped) clang: note: diagnostic msg: Error generating preprocessed source(s). Can you offer a suggestion here? (I am happy to submit a bug report if appropriate.) Regards, Graham