[ 12 posts ] 
Author Message
 Post subject: Building static libs
PostPosted: Sun Jul 04, 2010 5:20 pm 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
Do you have any general settings recommendations for building static libs for the device?
Since the shared library whitelist is limited, and to maximize compatibility, I'd like to build my dependent libraries as static libs (currently, zlib, openssl, curl, and oauth). I can see that you have so versions of zlib, openssl, and curl in /usr/lib. Thus, you must have working configure settings for all of them. If you don't want to explicitly support those libraries in the whitelist, could you give out the configure settings so I can try to build them within the PDK on my mac?

Thanks.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Wed Jul 14, 2010 2:18 am 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
Now that you've taken away our ability to using shared libs, do you think you could give us some help building static versions of zlib, openssl, or curl?

From the submission checklist:
Quote:
6. Did you use only whitelisted libraries? At this time, we’re only allowing applications in the catalog that use the set of libraries we provide with the PDK. This list includes the standard C and C++ libraries, SDL (including SDL_image, SDL_net, SDL_mixer, and SDL_ttf), and OpenGL ES (1.1 or 2.0). If you need other libraries, you should build them yourself and statically link them with your application.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Wed Jul 14, 2010 4:47 am 
User avatar

Joined: Thu Jul 16, 2009 2:37 pm
Posts: 5177
Location: HP (Palm), Austin, TX (@unwiredben on Twitter)
I'm actually working on getting all three of those libraries added to the PDK whitelist in the near future.

For building static versions, run configure --help in the tarballs for these libraries and look for an option like --enable-static. That should cause the makefile (when properly setup for crosscompilation) to make .a files you can link with.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Wed Jul 14, 2010 4:56 am 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
Thanks for the advice. zlib was easy to do, but I saw that you guys had patches in your opensource distro, so I thought some weird stuff might be going on. I had trouble figuring out which os/compiler combination to use for openssl, but zsoc in the #webosinternals freenode channel helped me out with that, and it is compiled statically as well. I'll try curl tomorrow. Hopefully, I can get liboauth and libagar going with equal success.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Wed Jul 14, 2010 4:48 pm 

Joined: Sat Feb 20, 2010 6:12 am
Posts: 22
hborders wrote:
Thanks for the advice. zlib was easy to do, but I saw that you guys had patches in your opensource distro, so I thought some weird stuff might be going on. I had trouble figuring out which os/compiler combination to use for openssl, but zsoc in the #webosinternals freenode channel helped me out with that, and it is compiled statically as well. I'll try curl tomorrow. Hopefully, I can get liboauth and libagar going with equal success.


Hey hb, thanks for the shoutout ^_^

HPalm has actually left a lot more open and available than they could have. I think they are taking a sane and reasonable path with all this.

As far as not being able to dynamically link our /own/ shared libs.. I think this may be a future option. I believe it was Ben that said they are just currently unsure of the implications of allowing this and are just trying to make the most compatible and best 'just works' environment for everyone :)

As far as static libs go, I've spent the better part of the last 2 nights statically compiling various pieces of interesting things into various applications with some interesting results :> let me know if you need help with Agar (although honestly, evas/elm is a better option imo)

Oh, and ben, thanks for working on the whitelist libs. The more the merrier!


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Thu Jul 15, 2010 5:00 am 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
I'm having a beast of a time getting curl to compile.

I've spent the past two hours trying to figure out what's wrong, basically losing a night of development.

Here is my ./configure line:
Code:
PATH=/opt/PalmPDK/arm-gcc/bin:"$PATH" CPPFLAGS=-I/opt/PalmPDK/include/\ -I`cd ../palm-arm/include/; pwd`\ -I`cd ../palm-arm/include/openssl/; pwd` LDFLAGS=-L/opt/PalmPDK/device/lib/\ -L`cd ../palm-arm/lib/; pwd`\ -Wl LIBS=-lz\ -lcrypto\ -lssl ./configure --prefix=`cd ../palm-arm/; pwd` --host=arm-none-linux-gnueabi --disable-shared --enable-static --enable-http --enable-ftp --enable-file --disable-ldap --disable-ldaps --enable-rtsp --enable-proxy --enable-dict --enable-telnet --enable-tftp --enable-pop3 --enable-imap --enable-smtp --disable-manual --enable-ipv6 --enable-nonblocking --enable-threaded-resolver --enable-verbose --enable-crypto-auth --enable-cookies --with-ssl=`cd ../palm-arm/; pwd` --without-nss --with-ca-bundle=cacert.pem --build=x86_64-apple-darwin10.4.0


I have a sibling directory structure, palm-arm with libz, libcrypto, libssl:
palm-arm/include
palm-arm/include/openssl
palm-arm/lib

When I run configure, I get the following error:
Code:
checking if argv can be written to... no
configure: WARNING: the previous check could not be made default was used
checking if Kerberos4 support is requested... no
checking if SPNEGO support is requested... no
checking if GSSAPI support is requested... no
configure: PKG_CONFIG_LIBDIR will be set to "/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-arm/lib/pkgconfig"
checking for arm-none-linux-gnueabi-pkg-config... no
checking for pkg-config... (cached) no
checking for CRYPTO_lock in -lcrypto... yes
checking for SSL_connect in -lssl... no
checking for ssl with RSAglue/rsaref libs in use... checking for SSL_connect in -lssl... (cached) no
no
configure: error: OpenSSL libs and/or directories were not found where specified!


I'd love any help I can get. The ./configure script is really dense bash and difficult to discern. I'll probably try manually running their test C code and verifying that I can link against it. openssl configured and compiled just fine, so I'm guessing I'm just compiling curl wrong.

I'd _really_ appreciate some tips for setting up a ./configure for curl within the pdk.

Thanks!


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Fri Jul 16, 2010 3:57 am 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
Ok, it looks like I'm not actually building openssl correctly.
I run the following ./configure line:

Code:
PATH=/opt/PalmPDK/arm-gcc/bin/:"$PATH" ./Configure -L`cd ../palm-arm/lib/; pwd` -L/opt/PalmPDK/arm-gcc/sysroot/lib/ -L/opt/PalmPDK/arm-gcc/sysroot/usr/lib/ threads no-shared zlib --prefix=`cd ../palm-arm/; pwd` --cross-compile-prefix=arm-none-linux-gnueabi- -I/opt/PalmPDK/include/ -I`cd ../palm-arm/include/; pwd` -I/opt/PalmPDK/arm-gcc/sysroot/usr/include/ linux-generic32


And everything succeeds, but when I try to compile an example app:

Code:
arm-none-linux-gnueabi-gcc -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp -I/opt/PalmPDK/include -I/opt/PalmPDK/include/SDL -I/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-arm/include --sysroot=/opt/PalmPDK/arm-gcc/sysroot -L/opt/PalmPDK/device/lib -L/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-arm/lib -Wl,--allow-shlib-undefined,-rpath-link,/Users/hborders/xcode-workspaces/personal/pdk-samples/simple/mac/palm-arm/lib -lssl -lcrypto -o Build_Device/hello cli.cpp


I get linker errors:

Code:
/var/folders/Az/Az+0r2ubHtm3wMGMatRuQE+++TI/-Tmp-//ccRwLjY3.o: In function `main':
cli.cpp:(.text+0x14): undefined reference to `SSL_library_init'
cli.cpp:(.text+0x18): undefined reference to `SSLv2_client_method'
cli.cpp:(.text+0x24): undefined reference to `SSL_load_error_strings'
cli.cpp:(.text+0x2c): undefined reference to `SSL_CTX_new'
cli.cpp:(.text+0x64): undefined reference to `ERR_print_errors_fp'
cli.cpp:(.text+0x11c): undefined reference to `SSL_new'
cli.cpp:(.text+0x144): undefined reference to `SSL_set_fd'
cli.cpp:(.text+0x14c): undefined reference to `SSL_connect'
cli.cpp:(.text+0x170): undefined reference to `ERR_print_errors_fp'
cli.cpp:(.text+0x180): undefined reference to `SSL_get_current_cipher'
cli.cpp:(.text+0x18c): undefined reference to `SSL_CIPHER_get_name'
cli.cpp:(.text+0x1a4): undefined reference to `SSL_get_peer_certificate'
cli.cpp:(.text+0x1d0): undefined reference to `X509_get_subject_name'
cli.cpp:(.text+0x1e4): undefined reference to `X509_NAME_oneline'
cli.cpp:(.text+0x214): undefined reference to `CRYPTO_free'
cli.cpp:(.text+0x21c): undefined reference to `X509_get_issuer_name'
cli.cpp:(.text+0x230): undefined reference to `X509_NAME_oneline'
cli.cpp:(.text+0x260): undefined reference to `CRYPTO_free'
cli.cpp:(.text+0x268): undefined reference to `X509_free'
cli.cpp:(.text+0x278): undefined reference to `SSL_write'
cli.cpp:(.text+0x29c): undefined reference to `ERR_print_errors_fp'
cli.cpp:(.text+0x2c0): undefined reference to `SSL_read'
cli.cpp:(.text+0x2e4): undefined reference to `ERR_print_errors_fp'
cli.cpp:(.text+0x32c): undefined reference to `SSL_shutdown'
cli.cpp:(.text+0x33c): undefined reference to `SSL_free'
cli.cpp:(.text+0x344): undefined reference to `SSL_CTX_free'
collect2: ld returned 1 exit status


Any ideas would be greatly appreciated. I'm going to try a test of zlib tomorrow night and see if my that static lib is any good.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Fri Jul 16, 2010 4:52 am 
User avatar

Joined: Thu Jul 16, 2009 2:37 pm
Posts: 5177
Location: HP (Palm), Austin, TX (@unwiredben on Twitter)
I'm sorry I can't post good build scripts. We build all of the open-source parts of our device ROM using OpenEmbedded (http://wiki.openembedded.net/index.php/Main_Page) -- alas, that doesn't lend itself very well to building a single component, especially outside of our whole software configuration environment.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Fri Jul 16, 2010 3:08 pm 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
Oh well, thanks anyway. Maybe I can look at openembedded myself.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Mon Jul 19, 2010 3:05 am 

Joined: Sun May 30, 2010 5:44 pm
Posts: 12
I was not passing required libs in the proper order. "man ld" via ##c on freenode helped me figure it out.


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Thu Dec 30, 2010 2:59 pm 

Joined: Mon Jul 05, 2010 9:35 pm
Posts: 447
Location: Germany
@hborders:
Can you tell me how you got libcurl compiled? I'm a noob in C/C++ and don't know how I could compile libcurl as a static library.
Thanks in advance!

(Note: I use Windows XP 32-bit)

_________________
Apps: File Explorer - Image
QuickChat for Facebook - Image
Archive Manager - a great app for extracting and creating archives (zip, rar, 7z etc.)
FTPit! - full-featured FTP client for webOS
Twitter: @pcworldSoftware


Top
 Profile  
 
 Post subject: Re: Building static libs
PostPosted: Mon Jan 10, 2011 4:58 pm 

Joined: Mon Jul 05, 2010 9:35 pm
Posts: 447
Location: Germany
Solution: http://forums.precentral.net/web-os-dev ... ost2814141

_________________
Apps: File Explorer - Image
QuickChat for Facebook - Image
Archive Manager - a great app for extracting and creating archives (zip, rar, 7z etc.)
FTPit! - full-featured FTP client for webOS
Twitter: @pcworldSoftware


Top
 Profile  
 
Display posts from previous:  Sort by  
   [ 12 posts ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron