Usi Usi
Usi Usi

Reputation: 2997

Gcc error while compiling option -fPIC

I'm reading a book but I get one error while compiling with this code.

$ rm -f injection.dylib
$ export PLATFORM=/Developer/Platforms/iPhoneOS.platform
$ $PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC
$ $PLATFORM/Developer/usr/bin/ld \ -dylib -lsystem -lobjc \
-o injection.dylib injection.o \
-syslibroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk/

I've some trouble especially in this line:

$PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC

This is the error

 arm-apple-darwin10-llvm-gcc-4.2:  -fPIC: No such file or directory

how can I solve... what does it means?

Upvotes: 0

Views: 1827

Answers (1)

Christian Stieber
Christian Stieber

Reputation: 12496

It means you mistyped the command line:

stieber@gatekeeper:~$ gcc \ -fPIC
gcc: error:  -fPIC: No such file or directory
gcc: fatal error: no input files
compilation terminated.

Seems the \ in the middle of the line makes gcc (and probably the llvm-gcc as well) stop considering arguments as options and always treats them as filenames.

stieber@gatekeeper:~$ gcc -fPIC
gcc: fatal error: no input files
compilation terminated.

gives the expected result.

Upvotes: 2

Related Questions