maloader icon indicating copy to clipboard operation
maloader copied to clipboard

cannot build on ubuntu12.04 using clang3.4

Open kad-ecoli opened this issue 10 years ago • 6 comments

I am trying to compile maloader using clang-3.4 on Ubuntu 12.04 (precise) amd64. Previously, when I compile maloader using gcc-4.6, all went well. The clang-3.4 were installed by apt as instructed http://llvm.org/apt/. Here is my building process.

$ git clone https://github.com/shinh/maloader.git

$ cd maloader

$ export USE_LIBCXX=1

$ make clang -g -Iinclude -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -fPIC -c -o libmac/mac.o libmac/mac.c clang: warning: argument unused during compilation: '-stdlib=libc++' clang -shared libmac/mac.o libmac/strmode.c -g -Iinclude -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -fPIC -o libmac.so -m64 clang: warning: argument unused during compilation: '-stdlib=libc++' clang++ -g -Iinclude -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -W -Werror -c -o extract.o extract.cc extract.cc:38:10: fatal error: 'map' file not found

include

     ^

1 error generated. make: *** [extract.o] Error 1

I have installed gcc-4.8, which has the correspondent header at /usr/include/c++/4.8/profile/map.h

But when I modified the CFLAGS from GCCFLAGS+=-g -Iinclude -Wall -MMD -fno-omit-frame-pointer -O $(GCC_EXTRA_FLAGS) to GCCFLAGS+=-g -Iinclude -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -Wall -MMD -fno-omit-frame-pointer -O $(GCC_EXTRA_FLAGS)

It cannot be linked:

$ make clean rm -f .o *.d */.o /.d libmac.so extract macho2elf ld-mac

$ make clang -g -Iinclude -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -fPIC -c -o libmac/mac.o libmac/mac.c clang: warning: argument unused during compilation: '-stdlib=libc++' clang -shared libmac/mac.o libmac/strmode.c -g -Iinclude -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -fPIC -o libmac.so -m64 clang: warning: argument unused during compilation: '-stdlib=libc++' clang++ -g -Iinclude -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -W -Werror -c -o extract.o extract.cc clang++ -g -Iinclude -I/usr/include/c++/4.8 -I/usr/include/x86_64-linux-gnu/c++/4.8 -Wall -MMD -fno-omit-frame-pointer -O -m64 -stdlib=libc++ -DUSE_LIBCXX -W -Werror -c -o fat.o fat.cc clang++ extract.o fat.o -o extract -g -I. -W -Wall -m64 -lc++ -lsupc++ /usr/bin/ld: cannot find -lc++ clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [extract] Error 1

So I wander what had happened and how should I specify LDFLAGS

kad-ecoli avatar May 23 '14 14:05 kad-ecoli

You need to install libc++.

tpoechtrager avatar May 23 '14 15:05 tpoechtrager

I do have libc++ (which is called libstdc++ in ubuntu)

kad-ecoli avatar May 24 '14 03:05 kad-ecoli

If there is no libc++, then gcc cannot compile maloader. The fact is, i can compile with gcc/g++, but not clang.

kad-ecoli avatar May 24 '14 03:05 kad-ecoli

You should do a little research, libc++ is not libstdc++, libc++ is a completely different C++ standard library implementation.

Take a look at: http://libcxx.llvm.org/

However, why do you even export USE_LIBCXX to 1 if you don't want to use libc++...?

tpoechtrager avatar May 24 '14 04:05 tpoechtrager

I have installed libc++ and it compiles well, thanks.

kad-ecoli avatar May 24 '14 08:05 kad-ecoli

how to installed libc++ ...help me !!!

punghunger avatar Jul 19 '23 03:07 punghunger