user3006610
user3006610

Reputation: 1

How to compile gcc 32bit app on 64bit osx

i try to compile a 32 bit app on my mac osx 64bit

I have a 32bit lib included.

I try to create a personal lib

gcc -m32 -c fileA.c -Iinclude -o fileA.o
gcc -m32 -c fileB.c -Iinclude -o fileB.o

All Ok

now I create .a File

ar ruv ./lib/myLib.a fileA.o fileB.o

When I try to launch

gcc -m32 -o imageMod imageMod.c -Iinclude -Llib

I receive the following error

Undefined symbols for architecture i386: "_addozzo", referenced from: _main in imageMod-nfyyGP.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

anyone can help me?

Upvotes: 0

Views: 4758

Answers (1)

Michael Burr
Michael Burr

Reputation: 340436

You need to tell gcc to link in the library:

gcc -m32 -o imageMod imageMod.c -Iinclude -Llib -l:myLib.a

Upvotes: 1

Related Questions