Re: Make build with static library on 10.4
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com On May 9, 2010, at 2:17 PM, Rustam Muginov wrote: Please nevermind, i overlooked the "-L../../lib" On May 9, 2010, at 11:16 PM, Rustam Muginov wrote: On May 9, 2010, at 11:00 PM, Andy Wiese wrote: Any suggestions will be greatly appreciated! Andy _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/rmuginov%40gmail.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I'm sure there is a very small audience for workarounds to makefiles for 10.4, but for the sake of the archives, here is the solution I found, and it was absolutely painful. I got it to work in Xcode, then did a reverse engineer of the Xcode build commands grabbed from the build results window. What I found is that linking would break if I included the object files in a particular order. This does not happen on 10.5, 10.6 or FreeBSD, so I assume this must be a bug that was fixed along the way. # this works! /Developer/usr/bin/g++-4.0 -o jsonv jsonv.o -L../../lib -ljost -arch i386 -Wl,-Y,1455 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk # THIS DOESN'T. Link errors. only difference is where json.o is in the param order #/Developer/usr/bin/g++-4.0 -o jsonv -L../../lib -ljost -arch i386 - Wl,-Y,1455 -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk jsonv.o Looks like you did not specified the library search path to the libjost.a library. Try to add -L to your link flags I have a small c++ project that builds & uses a static library, which I would like to build with make in 10.4, 10.5, and 10.6. In 10.5 and 10.6, it builds just fine, but in 10.4 the linking stage doesn't seem to find any of the symbols in the shared library. The same code builds in Xcode, and I've tried to study Xcode's build output to see what it is doing differently. I believe I am passing the same options to g++ and libtool as Xcode. Following is the failed make output from this small project. A library file libjost.a is created, and nm and otool seem to show the symbols that ld complains about. My next step if I can't figure this out will be to create an even small test project, but I am hoping that someone will spot my error and I can avoid that chore. make -C src/jost /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Array.o Array.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Exceptions.o Exceptions.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o IntegralType.o IntegralType.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Object.o Object.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Parser.o Parser.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Util.o Util.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -x c++ -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I.. -c -o Value.o Value.cpp /Developer/usr/bin/libtool -static -arch_only i386 -syslibroot / Developer/SDKs/MacOSX10.4u.sdk Array.o Exceptions.o IntegralType.o Object.o Parser.o Util.o Value.o -o libjost.a install -m 0755 libjost.a ../../lib/libjost.a make -C demo/jsonv /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -x c++ -g -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I../../src/ - I../../../boost_trunk -c -o jsonv.o jsonv.cpp /Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/ MacOSX10.4u.sdk -mmacosx-version-min=10.4 -g -Wall - DBOOST_DATE_TIME_NO_LIB -I../../../boost_trunk -I../../src/ - L../../lib -ljost -I../../../boost_trunk jsonv.o -o jsonv /Developer/usr/bin/../libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols: jost::Parser::parse(std::basic_istream<char, std::char_traits<char> >&) jost::Parser::instance() typeinfo for jost::MalformedJSONStream collect2: ld returned 1 exit status make[1]: *** [all] Error 1 make: *** [all] Error 2 This email sent to rmuginov@gmail.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Andy Wiese