Page 1 of 2 12 LastLast
Results 1 to 20 of 27
  1.    #1  
    Has anybody an idea how to compile/build libcurl (with SSL support?) for webOS so that it can be used in a PDK app?

    Thank you!
  2. #2  
    I had to use libcurl for one of my apps. If you implement dynamic linking you might find that your app just works on your Pre/Pixi, but libcurl is not officially supported, so you can't be sure it will always work. What you have to do is compile libcurl and any dependencies for SSL for static linking, and when you compile your app set libcurl for static linking in the compiler options. I'll probably be able to help you more later if you still have questions.
  3.    #3  
    At first I want to try to compile libcurl without SSL.
    I downloaded libcurl source (v7.21.3) and unpackaged it.
    Since I don't have much expierience in C/C++ (I mainly develop in Java), I don't know how I should compile libcurl. I use WinXP 32 bit (Ubuntu is also installed).
    My file structure:
    ---many .c/.h files
    ----some .h files
    --some other files and directories
    Where do I have to place the lib folder in the compiler options? In an include parameter (-I) or in the source files? Or do I have to use the configure-script and the make file?

    My current build script:
    @echo off
    @rem Set the device you want to build for to 1
    set PRE=1
    set PIXI=0
    set DEBUG=0
    @rem List your source files here
    ::what to place here?
    set SRC=
    @rem List the libraries needed
    set LIBS=
    ::-lSDL -lGLESv2 -lpdl -lm
    @rem Name your output executable
    set OUTFILE=libcurl
    if %PRE% equ 0 if %PIXI% equ 0 goto :END
    if %DEBUG% equ 1 (
       set DEVICEOPTS=-g
    ) else (
       set DEVICEOPTS=
    if %PRE% equ 1 (
       set DEVICEOPTS=%DEVICEOPTS% -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
    if %PIXI% equ 1 (
       set DEVICEOPTS=%DEVICEOPTS% -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
    ::echo %DEVICEOPTS%
    ::old command:
    ::arm-none-linux-gnueabi-gcc %DEVICEOPTS% -o %OUTFILE% %SRC% "-I%PALMPDK%\include" "-I%PALMPDK%\include\SDL" "-Iplugin\inc" "-Icurl\lib" "-L%PALMPDK%\device\lib" -Wl,--allow-shlib-undefined %LIBS%
    :: -static parameter?
    :: include curl\include and curl\lib?
    arm-none-linux-gnueabi-gcc -static %DEVICEOPTS% -o %OUTFILE% %SRC% "-I%PALMPDK%\include" "-Icurl\include" "-Icurl\lib" "-L%PALMPDK%\device\lib" -Wl,--allow-shlib-undefined %LIBS%
    goto :EOF
    echo Please select the target device by editing the PRE/PIXI variable in this file.
    exit /b 1
    Any ideas?
    Thanks in advance!

    If I ever get libcurl working on webOS I'll (maybe) write a how-to in the webOS-Internals wiki.
  4. #4  
    I won't be able to help you set it up on Windows. I set it up on Ubuntu using the WIDK. Basically, to set it up using the WIDK, you need to compile libcurl from source in Scratchbox 2, as you would compile any apps using the WIDK. Use the standard ./configure, make, make install, and it will install the required libs under /srv/preware/cross-compile.

    Sorry I can't help you more right now. I have it set up on my work computer, and I can't remember all the details off the top of my head. I can write a how-to in the Wiki later.
  5.    #5  
    Thank you, I'll try that! (I use Ubuntu as my primary OS so this is no problem.)
    Will I be able to submit apps to the app catalog built with the WIDK?

    Edit: Does the WIDK work with hybrid apps?
    Last edited by pcworld; 12/31/2010 at 08:56 AM.
  6. #6  
    You can use the WIDK for hybrid apps. That's what I'm doing. The WIDK just compiles your executable anyway, and for hybrid apps you would include that executable as a plugin. Also, Palm has said since they won't officially support the PDK for Linux for the near future, apps built using the WIDK will be allowed. They even encourage it for us Linux developers.
  7.    #7  
    I set up the WIDK on Ubuntu.
    I see that in the WIDK there is already a makefile for libcurl, but I don't know how to compile it for static linking.
    That's the makefile from /srv/preware/cross-compile/packages/common/libcurl, edited lines highlighted: pastebin
    Last edited by pcworld; 01/25/2011 at 09:02 AM.
  8. #8  
    It should already compile for static linking by default. You can double-check by doing ./configure --help in the libcurl directory and checking the compile options. What you have to do later is tell the compiler (gcc or g++) that you want to link statically to libcurl. I really can't remember that compiler option right now, but I think it's somewhere along the lines of -Wl,static -lcurl or something like that. I'll post the exact commands I use when I get back to my work computer tomorrow.
  9.    #9  
    Thanks for your help!

    When I try to compile my example app with the following commands:
    #go into scratchbox:
    sb2 -M /srv/preware/cross-compile/staging/mapping-armv7
    #in scratchbox:
    g++ -static -L/srv/preware/cross-compile/staging/armv7/usr/lib -lcurl -lssl -lcrypto -lz main.cpp
    I get the error "-lcurl not found".
    Without "-static" it works fine.
  10. #10  
    Now that I'm back from the holidays I'll be able to post my compilation instructions.

    First, this is how I compile libcurl from static linking. Note that you must be in Scratchbox 2 to compile it:

    ./configure CFLAGS='-Os' --without-ssl --without-zlib --enable-static --disable-shared --disable-ldap --disable-ldaps --disable-cookies --disable-crypto-auth --disable-manual --with-gnu-ld --disable-proxy --disable-ipv6 --disable-verbose --enable-hidden-symbols --disable-ares --without-libidn --disable-ftp --disable-file --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smtp --disable-gopher
    make install
    Since I was going to be static linking, removing all the parts I didn't need means that I link to a smaller library, making my final executable smaller in size. I didn't need ssl, so you're gonna need to modify those installation commands to enable ssl and all dependencies.

    Also note that make install will install libcurl in a directory under /srv/preware/cross-compile, NOT where libraries would normally be installed in Ubuntu's filesystem. They will be installed in either /srv/preware/cross-compile/staging/armv6/usr/lib or /srv/preware/cross-compile/rootfs/armv7/usr/lib, and you want the files libcurl.a and

    Then, when I want to compile my app, here are the commands I use for compiling:
    g++ -c -o test.o test.cpp -I/srv/preware/cross-compile/staging/armv6/usr/include 
    g++ -DCURL_STATICLIB -Wl,--allow-shlib-undefined -o test test.o -L/srv/preware/cross-compile/rootfs/armv7/usr/lib -Wl,-Bstatic -lcurl `curl-config --static-libs` -Wl,-Bdynamic -lpdl -lSDL
    Here, /srv/preware/cross-compile/staging/armv6/usr/include should contain all normal header files required for any PDK app. You will also need to put the include/curl directory (the one that is normally in the main directory of a libcurl download) in the same directory used in the first command.

    Next, /srv/preware/cross-compile/rootfs/armv7/usr/lib is where the libraries are located. If libcurl.a and are not already there, put them there. Then, -lcurl `curl-config --static-libs` will link to libcurl and all necessary libraries statically. Here, -lpdl and -lSDL are required for PDK apps.

    Here's an example of all necessary includes I use in my source:

    #define CURL_STATICLIB
    #include <stdio.h>
    #include <math.h>
    #include <curl/curl.h>
    #include <curl/types.h>
    #include <curl/easy.h>
    #include <string>
    #include <syslog.h>
    #include <GLES2/gl2.h>
    #include "SDL.h"
    #include "PDL.h"
    #include <sys/types.h>
    #include <sys/select.h>
    #include <sys/socket.h>
    using namespace std;
    I hope that can get you all set.
  11.    #11  
    Thank you for your help! libcurl compiled successful.
    But when I try to compile a simple example program with your second command with "-lcurl", it says "cannot find -lcurl", but without it it compiles fine. Does that matter?

    I have problems to compile it with -lpdl, because "make stage" in the WIDK fails.

    Another question: My plugin will be invisible (it will only provide some functions to Mojo), do I have to use SDL anyway?
  12. #12  
    I believe you have to do SDL_init, not sure about that. But, you will need -lcurl or curl will not work. How else is curl supposed to be linked with your app? You probably don't have the proper lib files(libcurl.a and in the proper directory.

    -- Sent from my Palm Pre using Forums
  13.    #13  
    I use this commands:
    g++ -c -o test.o test.cpp -I/srv/preware/cross-compile/staging/armv7/usr/include
    g++ -DCURL_STATICLIB -Wl,--allow-shlib-undefined -o test test.o -L/srv/preware/cross-compile/rootfs/armv7/usr/lib -Wl,-Bstatic `/srv/preware/cross-compile/staging/armv7/usr/bin/curl-config --static-libs` -Wl,-Bdynamic
    #output of /srv/preware/cross-compile/staging/armv7/usr/bin/curl-config --static-libs: "/usr/local/lib/libcurl.a -lrt"
    The example app works fine on the device.
  14. #14  
    Ah, so you got your app working with libcurl without needing SDL/PDL? Glad you got it working!

    -- Sent from my Palm Pre using Forums
  15.    #15  
    I simply put it in /media/internal and executed it via novaterm.
    I hope I can get the WIDK working with the PDK.
    Did you installed the WIDK on Ubuntu 10.10?
  16. #16  
    The WIDK is your replacement for the PDK. If you want users to use the app, you'll probably need SDL/PDL.

    -- Sent from my Palm Pre using Forums
  17.    #17  
    I know, but I have trouble with building the WIDK on Ubuntu 10.10.
  18.    #18  
    I got the WIDK built today.
    When I link the object code with libcurl, I get the following warnings (in scratchbox):
    $ g++ -DCURL_STATICLIB -Wl,--allow-shlib-undefined -o test test.o -L/srv/preware/cross-compile/rootfs/armv7/usr/lib -Wl,-Bstatic `/srv/preware/cross-compile/staging/armv7/usr/bin/curl-config --static-libs`  -Wl,-Bdynamic -lpdl -lSDL
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    /srv/preware/cross-compile/toolchain/arm-2007q3/bin/arm-none-linux-gnueabi-ld: warning:, needed by /srv/preware/cross-compile/rootfs/armv7/usr/lib/, not found (try using -rpath or -rpath-link)
    Is this normal or a problem? I can't execute my app in scratchbox:
    ./test: error while loading shared libraries: cannot open shared object file: No such file or directory
    But on my Pre it works fine.
  19. #19  
    I don't know if those compiled apps are supposed to run in scratchbox, but as long as they run on-device, you should be good. Also, those errors are normal. See here:

    It shows you the warning messages you should ignore.

    -- Sent from my Palm Pre using Forums
  20.    #20  
    Thank you.
    On the page you posted is also a whitelist of libraries allowed for dynamic linking.
    When I run "/srv/preware/cross-compile/staging/armv7/usr/bin/curl-config", the output is: "/usr/local/lib/libcurl.a -lrt"
    So there is needed a library called "librt". Will I have to compile this library for static linking to get my app into the app catalog? I searched for it but I didn't found a project page or source code for that one (I guess it's needed for clock_gettime()).
Page 1 of 2 12 LastLast

Posting Permissions