Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot build on ubuntu12.04 using clang3.4 #14

Open
kad-ecoli opened this issue May 23, 2014 · 6 comments
Open

cannot build on ubuntu12.04 using clang3.4 #14

kad-ecoli opened this issue May 23, 2014 · 6 comments

Comments

@kad-ecoli
Copy link

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

@tpoechtrager
Copy link

You need to install libc++.

@kad-ecoli
Copy link
Author

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

@kad-ecoli
Copy link
Author

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

@tpoechtrager
Copy link

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++...?

@kad-ecoli
Copy link
Author

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

@punghunger
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants