OSX: How do I convert a static library to a dynamic one? -
suppose have third party library called somelib.a on mac running mountain lion xcode 4.4 installed. want dynamic library out of called somelib.dylib. appropriate linux command be:
g++ -fpic -shared -wl,-whole-archive somelib.a -wl,-no-whole-archive -o somelib.so
where -whole-archive , -no-whole-archive passed linker. when equivalent mac:
g++ -fpic -shared -wl,-whole-archive somelib.a -wl,-no-whole-archive -o somelib.dylib
ld fails error:
ld: unknown option: -whole-archive
it seems ld on osx different gnu ld. how have modify above command desired result?
thank in advance!
i found out solution problem:
g++ -fpic -shared -wl,-all_load somelib.a -wl,-noall_load -o somelib.dylib
the required arguments -all_load , -noall_load.
Comments
Post a Comment