fail to compile latest llvm?

Hi,

I got the latest LLVM code from git repo, and tried to compile that on my OSX 10.9.4 machine. But I got the error at “make” step:

“Makefile:151: /Makefile.rules: No such file or directory”

Below is the output of “configure” & “make”. Any idea what is wrong?

Thanks.

$ ./configure --enable-targets=mips

checking for clang… clang

checking for C compiler default output file name… a.out

checking whether the C compiler works… yes

checking whether we are cross compiling… no

checking for suffix of executables…

checking for suffix of object files… o

checking whether we are using the GNU C compiler… yes

checking whether clang accepts -g… yes

checking for clang option to accept ISO C89… none needed

checking for clang++… clang++

checking whether we are using the GNU C++ compiler… yes

checking whether clang++ accepts -g… yes

checking how to run the C preprocessor… clang -E

checking whether clang works… yes

checking whether GCC or Clang is our host compiler… clang

checking build system type… x86_64-apple-darwin13.3.0

checking host system type… x86_64-apple-darwin13.3.0

checking target system type… x86_64-apple-darwin13.3.0

checking type of operating system we’re going to host on… Darwin

checking type of operating system we’re going to target… Darwin

checking target architecture… x86_64

checking whether Clang is new enough… yes

checking whether Clang will select a modern C++ standard library… yes

checking optimization flags… -O3

checking for GNU make… make

checking whether ln -s works… yes

checking for nm… /opt/local/bin/nm

checking for cmp… /usr/bin/cmp

checking for cp… /bin/cp

checking for date… /bin/date

checking for find… /usr/bin/find

checking for grep… /usr/bin/grep

checking for mkdir… /bin/mkdir

checking for mv… /bin/mv

checking for ranlib… ranlib

checking for ar… ar

checking for rm… /bin/rm

checking for sed… /usr/bin/sed

checking for tar… /usr/bin/tar

checking for pwd… /bin/pwd

checking for dot… echo dot

checking for a BSD-compatible install… /usr/bin/install -c

checking for bzip2… /usr/bin/bzip2

checking for cat… /bin/cat

checking for doxygen… no

checking for groff… /usr/bin/groff

checking for gzip… /usr/bin/gzip

checking for pdfroff… /usr/bin/pdfroff

checking for zip… /usr/bin/zip

checking for ocamlc… no

checking for ocamlopt… no

checking for ocamldep… no

checking for ocamldoc… no

checking for gas… no

checking for as… /opt/local/bin/as

checking for linker version… 136

checking for compiler -Wl,-R option… no

checking for compiler -rdynamic option… yes

checking for compiler -Wl,–version-script option… no

checking for grep that handles long lines and -e… (cached) /usr/bin/grep

checking for egrep… /usr/bin/grep -E

checking for ANSI C header files… yes

checking for sys/types.h… yes

checking for sys/stat.h… yes

checking for stdlib.h… yes

checking for string.h… yes

checking for memory.h… yes

checking for strings.h… yes

checking for inttypes.h… yes

checking for stdint.h… yes

checking for unistd.h… yes

checking errno.h usability… yes

checking errno.h presence… yes

checking for errno.h… yes

checking tool compatibility… ok

checking optional compiler flags… -Wno-variadic-macros -Wno-missing-field-initializers -Wcovered-switch-default -Wno-uninitialized

checking for python… /usr/bin/python

checking for python >= 2.5… /usr/bin/python (2.7.5)

checking for sin in -lm… yes

checking for library containing dlopen… none required

checking for library containing clock_gettime… no

checking for library containing setupterm… -lcurses

checking for library containing el_init… -ledit

checking for library containing mallinfo… no

checking for pthread_mutex_init in -lpthread… yes

checking for library containing pthread_mutex_lock… none required

checking for library containing pthread_rwlock_init… none required

checking for library containing pthread_getspecific… none required

checking for compress2 in -lz… yes

checking for xml2-config… xml2-config

checking for libxml2 includes… -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2

checking for xmlReadFile in -lxml2… yes

checking for dirent.h that defines DIR… yes

checking for library containing opendir… none required

checking for MAP_ANONYMOUS vs. MAP_ANON… no

checking whether stat file-mode macros are broken… no

checking for sys/wait.h that is POSIX.1 compatible… yes

checking whether time.h and sys/time.h may both be included… yes

checking how to run the C++ preprocessor… clang++ -E

checking cxxabi.h usability… yes

checking cxxabi.h presence… yes

checking for cxxabi.h… yes

checking dlfcn.h usability… yes

checking dlfcn.h presence… yes

checking for dlfcn.h… yes

checking execinfo.h usability… yes

checking execinfo.h presence… yes

checking for execinfo.h… yes

checking fcntl.h usability… yes

checking fcntl.h presence… yes

checking for fcntl.h… yes

checking for inttypes.h… (cached) yes

checking link.h usability… no

checking link.h presence… no

checking for link.h… no

checking malloc.h usability… no

checking malloc.h presence… no

checking for malloc.h… no

checking setjmp.h usability… yes

checking setjmp.h presence… yes

checking for setjmp.h… yes

checking signal.h usability… yes

checking signal.h presence… yes

checking for signal.h… yes

checking for stdint.h… (cached) yes

checking termios.h usability… yes

checking termios.h presence… yes

checking for termios.h… yes

checking for unistd.h… (cached) yes

checking utime.h usability… yes

checking utime.h presence… yes

checking for utime.h… yes

checking sys/mman.h usability… yes

checking sys/mman.h presence… yes

checking for sys/mman.h… yes

checking sys/param.h usability… yes

checking sys/param.h presence… yes

checking for sys/param.h… yes

checking sys/resource.h usability… yes

checking sys/resource.h presence… yes

checking for sys/resource.h… yes

checking sys/time.h usability… yes

checking sys/time.h presence… yes

checking for sys/time.h… yes

checking sys/uio.h usability… yes

checking sys/uio.h presence… yes

checking for sys/uio.h… yes

checking sys/ioctl.h usability… yes

checking sys/ioctl.h presence… yes

checking for sys/ioctl.h… yes

checking malloc/malloc.h usability… yes

checking malloc/malloc.h presence… yes

checking for malloc/malloc.h… yes

checking mach/mach.h usability… yes

checking mach/mach.h presence… yes

checking for mach/mach.h… yes

checking valgrind/valgrind.h usability… no

checking valgrind/valgrind.h presence… no

checking for valgrind/valgrind.h… no

checking fenv.h usability… yes

checking fenv.h presence… yes

checking for fenv.h… yes

checking whether FE_ALL_EXCEPT is declared… yes

checking whether FE_INEXACT is declared… yes

checking pthread.h usability… yes

checking pthread.h presence… yes

checking for pthread.h… yes

checking zlib.h usability… yes

checking zlib.h presence… yes

checking for zlib.h… yes

checking CrashReporterClient.h usability… no

checking CrashReporterClient.h presence… no

checking for CrashReporterClient.h… no

checking crashreporter_info… yes

checking for HUGE_VAL sanity… yes

checking for pid_t… yes

checking for size_t… yes

checking whether struct tm is in sys/time.h or time.h… time.h

checking for int64_t… yes

checking for uint64_t… yes

checking for backtrace… yes

checking for ceilf… yes

checking for floorf… yes

checking for roundf… yes

checking for rintf… yes

checking for nearbyintf… yes

checking for getcwd… yes

checking for powf… yes

checking for fmodf… yes

checking for strtof… yes

checking for round… yes

checking for log… yes

checking for log2… yes

checking for log10… yes

checking for exp… yes

checking for exp2… yes

checking for getpagesize… yes

checking for getrusage… yes

checking for getrlimit… yes

checking for setrlimit… yes

checking for gettimeofday… yes

checking for isatty… yes

checking for mkdtemp… yes

checking for mkstemp… yes

checking for mktemp… yes

checking for posix_spawn… yes

checking for pread… yes

checking for realpath… yes

checking for sbrk… yes

checking for setrlimit… (cached) yes

checking for strerror… yes

checking for strerror_r… yes

checking for setenv… yes

checking for strtoll… yes

checking for strtoq… yes

checking for sysconf… yes

checking for malloc_zone_statistics… yes

checking for setjmp… yes

checking for longjmp… yes

checking for sigsetjmp… yes

checking for siglongjmp… yes

checking for writev… yes

checking for futimes… yes

checking for futimens… no

checking if printf has the %a format character… yes

checking for srand48/lrand48/drand48 in <stdlib.h>… yes

checking whether arc4random is declared… yes

checking whether strerror_s is declared… no

checking for isnan in <math.h>… yes

checking for isnan in … yes

checking for std::isnan in … yes

checking for isinf in <math.h>… yes

checking for isinf in … yes

checking for std::isinf in … yes

checking for finite in <ieeefp.h>… no

checking for stdlib.h… (cached) yes

checking for unistd.h… (cached) yes

checking for getpagesize… (cached) yes

checking for working mmap… yes

checking for mmap of files… yes

checking if /dev/zero is needed for mmap… no

checking for GCC atomic builtins… yes

checking for __dso_handle… yes

checking for compiler -fvisibility-inlines-hidden option… yes

configure: creating ./config.status

config.status: creating include/llvm/Config/Targets.def

config.status: creating include/llvm/Config/AsmPrinters.def

config.status: creating include/llvm/Config/AsmParsers.def

config.status: creating include/llvm/Config/Disassemblers.def

config.status: creating Makefile.config

config.status: creating llvm.spec

config.status: creating docs/doxygen.cfg

config.status: creating bindings/ocaml/llvm/META.llvm

config.status: creating include/llvm/Config/config.h

config.status: creating include/llvm/Config/llvm-config.h

config.status: creating include/llvm/Support/DataTypes.h

config.status: include/llvm/Support/DataTypes.h is unchanged

config.status: executing setup commands

config.status: executing Makefile commands

config.status: executing Makefile.common commands

config.status: executing examples/Makefile commands

config.status: executing lib/Makefile commands

config.status: executing test/Makefile commands

config.status: executing test/Makefile.tests commands

config.status: executing unittests/Makefile commands

config.status: executing tools/Makefile commands

config.status: executing utils/Makefile commands

config.status: executing projects/Makefile commands

config.status: executing bindings/Makefile commands

config.status: executing bindings/ocaml/Makefile.ocaml commands

$ make ENABLE_OPTIMIZED=1

Makefile:151: /Makefile.rules: No such file or directory

make: *** No rule to make target `/Makefile.rules’. Stop.

$

Hi,

Probably you get the error because you try to build LLVM in the source
code directory. Create a separate folder, cd to this folder and run
the configure script.

$ mkdir llvm-bld
$ cd llvm-bld
$ ../<llvm src>/configure --enable-targets=mips
$ make

Hope this help.

Hi,

Probably you get the error because you try to build LLVM in the source
code directory. Create a separate folder, cd to this folder and run
the configure script.

$ mkdir llvm-bld
$ cd llvm-bld
$ ../<llvm src>/configure --enable-targets=mips
$ make

no, this should not solve the problem, as nothing is wrong with compiling
in the source directory.
actually i did this many times before, but now i moved to a new OSX
machine, and have this problem.

(and i already tried your solution, and confirm it doesnt help).

thanks.

This doesn't solve the root of the problem but does using the CMake
build system instead work for you?

$ mkdir build
$ cd build/
$ cmake -DLLVM_TARGETS_TO_BUILD=Mips -G Ninja <llvm-src>/
$ ninja

If you don't have ``ninja`` just remove the ``-G Ninja`` from the
CMake invocation and you can build with ``make`` instead.

    Hi,

    Probably you get the error because you try to build LLVM in the source
    code directory. Create a separate folder, cd to this folder and run
    the configure script.

    $ mkdir llvm-bld
    $ cd llvm-bld
    $ ../<llvm src>/configure --enable-targets=mips
    $ make

no, this should not solve the problem, as nothing is wrong with compiling in the
source directory.

... other than it being a bad practice, and being generally discouraged.

Cheers,

Jon

i think i found the reason: i put the llvm directory in a path that having a space inside, so it fails to compile.

by moving llvm directory to elsewhere without a space in the path, everything works again.

thanks all for the help!
Jun