Hi Heath, Let's take this off-mailing-list; we're facing some compiler/linker issues which is beyond OAuth discussion. Let's report back there when we're done, shall we?
Let me recap: You've successfully compiled liboauth (ls src/.libs/*.a) and encounter an error when linking the test/example code. On 06/02/2010 07:59 AM, Heath Borders wrote: > I'm having problems specifying proper curl libs to make oauth now. > > I've configured using the following command (please let me know if I > did any overkill): > > ./configure CFLAGS="-arch i386" LDFLAGS=-L`cd ../palm-i386/lib/; pwd` > CPPFLAGS=-I`cd ../palm-i386/include/; pwd` --prefix=`cd ../palm-i386/; > pwd` --build=i386 --host=i386 --disable-shared --disable-nss > CURL_CFLAGS="-arch i386 -I"`cdmcheath:liboauth-0.8.6 hborders$ > ./configure CFLAGS="-arch i386" LDFLAGS=-L`cd ../palm-i386/lib/; pwd` > CPPFLAGS=-I`cd ../palm-i386/include/; pwd` --prefix=`cd ../palm-i386/; > pwd` --build=i386 --host=i386 --disable-shared --disable-nss > CURL_CFLAGS="-arch i386 -I"`cd ../palm-i386/include/; pwd` > CURL_LIBS=-L`cd ../palm-i386/lib/; pwd` --disable-curl > --enable-libcurl The proper configure line would be: CFLAGS="-arch i386" \ CURL_CFLAGS="-I`cd ../palm-i386/include/; pwd`" \ CURL_LIBS="-lcurl -L`cd ../palm-i386/lib/; pwd`" \ ./configure --disable-curl --enable-libcurl Note the '-lcurl'; it should work with static linking but you can also just forget about -L and -l and simply use CURL_LIBS="/path/to/libcurl.a" or maybe even CURL_LIBS="-static /path/to/libcurl.a" Note that libcurl.a itself [probably] depends on other libraries that you need to add as well; these vary depending on curl configure options. see the line 'Libs.private:' in the file curl-source-dir/libcurl.pc > then just ran make and got the following error: > > gcc -DHAVE_CONFIG_H -I. -I../src -I./../src > -I/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/include > -Wall -Wall -arch i386 -MT oauthexample-oauthexample.o -MD -MP -MF > .deps/oauthexample-oauthexample.Tpo -c -o oauthexample-oauthexample.o > `test -f 'oauthexample.c' || echo './'`oauthexample.c > mv -f .deps/oauthexample-oauthexample.Tpo .deps/oauthexample-oauthexample.Po > /bin/sh ../libtool --tag=CC --mode=link gcc -Wall -Wall -arch i386 > -L/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/lib > -o oauthexample oauthexample-oauthexample.o ../src/liboauth.la -lssl > libtool: link: gcc -Wall -Wall -arch i386 -o oauthexample > oauthexample-oauthexample.o > -L/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/lib > ../src/.libs/liboauth.a -lm -lcrypto -lssl > Undefined symbols: [..snip..] > ld: symbol(s) not found > collect2: ld returned 1 exit status > make[1]: *** [oauthexample] Error 1 > make: *** [all-recursive] Error 1 > > I have libcurl.a in > /Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/lib. > I can see that that directory is listed in the first -L entry, so I > don't know why it wouldn't be found. 'man gcc' reads: -L Add directory dir to the list of directories to be searched for -l You need to add '-lcurl' > My only guess is that the > dynamic libs are being searched first in all search path and are > getting found in /opt/local/lib. Ideally, I wouldn't even have > /opt/local/lib/ on the search path. I'd prefer to both take > /opt/local/lib off the search path and tell the linker to prefer > static libs over dylibs. I don't think this is the case. '-L' paths are searched first. I suggest to try to compile the example by hand: cd liboauth-source-dir/tests/ gcc -arch i386 \ -I../src/ \ -I/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/include/ \ /Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/lib/libssl.a \ /Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-i386/lib/libcurl.a \ ../src/.libs/liboauth.a \ -o oauthexample oauthexample.c You'll need to add a couple off other .a files (dependencies of libssl and libcurl) and then work backwards to find out the correct ./configure flags. Anyway you'll need to do that again when you statically link your application; so this exercise will be useful later on. On OSX you can use 'otool -l <executable>' to find out the libraries an executable or .dylib depends on; other unix-systems use 'ldd' for that. and somewhat off-topic: I dunno if it will be an option for the final target-platform 'cortex-a8', but a much easier way than static linking would be to use .dylibs and simply ship those with your application (OSX does that per default): use 'install_name_tool' to modify your executable to tell it where the .dylibs are found. You also need to modify the shipped .dylibs with said tool to "tell them" where dependand .dylibs are found. ..using a wrapper-script to start your app with LD_PRELOAD or LD_LIBRARY_PATH environment variables may also be an option. > If this is too noobish, please understand that I've spent about 3 > hours trying to sort this out, and I greatly appreciate your help. I think you've passed the n00b level already. Compiling and static linking is a task not to be underestimated! ..besides it's easy to overlook some missing options; happened to anyone before; especially after a few hours of staring at them :) Anyway, I've found another bug in liboauth's build-system along the way. the tests/Makefile.am still hard-codes '-lssl' and does not use CURL_CFLAGS - fixed in liboauth-0.8.7 Cheers! robin > Thanks. > > -Heath Borders > [email protected] > Twitter: heathborders > http://heath-tech.blogspot.com > > > > On Tue, Jun 1, 2010 at 10:41 AM, Heath Borders <[email protected]> wrote: >> I got libz and libssl compiled for i386 last night. This is the >> closest thing to an x-compile I've done so far. Unfortunately, >> libcurl is a private library on the pre, so I can't rely on it. I'm >> going to try building libcurl for i386 tonight, and then hopefully I >> can compile liboauth and get my twitter example working. >> >> I will certainly keep you posted. Hopefully, I can be a success story >> someday. :) >> >> -Heath Borders >> [email protected] >> Twitter: heathborders >> http://heath-tech.blogspot.com >> -- You received this message because you are subscribed to the Google Groups "OAuth" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/oauth?hl=en.
