0

After I execute cmake CMakeLists.txt, which seems to give no errors, I run make which gives me the following error:

:/usr/local/src/llvm-3.1.src/tools/ccons$ sudo make
[  7%] Building CXX object CMakeFiles/ccons.dir/ccons.cpp.o
/usr/local/src/llvm-3.1.src/tools/ccons/ccons.cpp:1:0: error: bad value (x86_64) for -march= swi
tch
make[2]: *** [CMakeFiles/ccons.dir/ccons.cpp.o] Error 1
make[1]: *** [CMakeFiles/ccons.dir/all] Error 2
make: *** [all] Error 2

Is there any way to figure out how to solve this?

Jack Kelly
  • 18,264
  • 2
  • 56
  • 81
mko
  • 21,334
  • 49
  • 130
  • 191

1 Answers1

0

Firstly, why are you building the software using sudo? That's asking for trouble. You should only need sudo when you're installing (i.e., sudo make install).

For whatever reason, your compiler appears to be passed the flag -march=x86_64, which it thinks is invalid. To see what flags CMake is trying to compile with, do the following:

  1. Run make edit_cache.
  2. Press t to switch on advanced mode. This lets you see additional cache variables.
  3. Look for the variables that start with CMAKE_CXX_FLAGS. There are different ones for different build types, but one of them will probably have this -march=x64_64 flag in it.

Good luck.

Jack Kelly
  • 18,264
  • 2
  • 56
  • 81
  • I follow your setup,but stuck at step 1, it gives me `make: *** No rule to make target `edit_cache'. Stop.` – mko Jul 14 '12 at 06:08
  • FYI the reason that I'm using `sudo` is that I don't have the privilege to write to /usr/local/src folder as my current user – mko Jul 14 '12 at 06:09
  • I normally build sources in some directory that I can write to as myself, because that means some malicious `Makefile` won't trash your system. As to your first problem, can you confirm that you ran `cmake` without error? Do you have a `Makefile` in your build directory? – Jack Kelly Jul 14 '12 at 07:30
  • Sorry for this tardy reply. I just get used to follow to tutorial online that alway curl the source code into `/usr/local/src`, Are you suggesting put into `~/usr/local/src` – mko Jul 20 '12 at 05:38
  • I think in the step 2, you mean press 'y' – mko Jul 20 '12 at 05:44
  • I found this issue in the official website http://code.google.com/p/ccons/issues/detail?id=9 I don't know how to use a patch file – mko Jul 20 '12 at 05:53
  • I got the information Please provide any additional information below. The "special steps" taken in the PKGBUILD are these: 1. Copy ccons to the llvm/tools folder 2. Removing -march from CMakeLists.txt: sed -i 's/ -march=${LLVM_HOST_ARCH}//' CMakeLists.txt 3. Specifying clang as the compiler: CXX=clang++ CC=clang make Even with -march or without CC=clang, ccons does not compile here. – mko Jul 20 '12 at 06:09
  • This is the new error I got /usr/local/src/llvm-3.1.src/tools/ccons/ccons.cpp:17:33: fatal error: llvm/System/Signals.h: No such file or directory compilation terminated. – mko Jul 20 '12 at 06:18
  • 1. Yes, it's better to build sources out of your home directory. 2. I definitely mean 't': in ccmake (the ncurses interface to cmake), it switches to advanced mode. 3. I googled "patch file" and instructions for using them is in the first result. 4. I don't know the ccons build system specifically. 5. Looks like it's not setting the include path for some reason. Why? I don't know. – Jack Kelly Jul 20 '12 at 07:54