[maemo-developers] The code using Libcurl can not be linked properly

From: Eero Tamminen eero.tamminen at nokia.com
Date: Mon Oct 20 14:05:36 EEST 2008
Hi,

ext Yao Wang wrote:
>     Everyone. I am developping an appliacation on CHINOOK.
>     Because my code used some functions provided by Libcurl, I revised the
> Makefile  to the following
> 
>> CC = gcc
>>
>> CFLAGS = `pkg-config --cflags gtk+-2.0 hildon-1`  -ansi -Wall -ggdb
>>
>> CFLAGS_CURL = -I/scratchbox/devkits/maemo3-tools/include
>>
>> LIBS = `pkg-config --libs gtk+-2.0 hildon-1`
>>
>> LIB_CURL = -L/scratchbox/devkits/maemo3-tools/lib -lcurl -Wl,-rpath
>> -Wl,/scratchbox/host_shared/lib/ -Wl,-rpath -Wl,/scratchbox/tools/lib/
>> -Wl,-rpath -Wl,/scratchbox/devkits/maemo3-tools/lib/
>> -L/scratchbox/devkits/maemo3-tools/lib -lidn -lssl -lcrypto -ldl -lssl
>> -lcrypto -ldl -lz

You should never mix stuff for the target and stuff from the Scratchbox
itself like this.


>> TARGET =        GalleryBrowser
>>
>> SOURCES = src/main.c src/xxxx.c
>>
>> $(TARGET): $(SOURCES)
>>         $(CC) -o $(TARGET) $(SOURCES) $(CFLAGS) $(CFLAGS_CURL) $(LIBS)
>> $(LIB_CURL)
>>
> 
> The CFLAGS_CURL and LIB_CURL  are generated by curl-config.
> 
> After compiling and linking, I got a error messege same as following link:
> 
> https://bugs.maemo.org/show_bug.cgi?id=2261#add_comment
> 
> Unfortuantely, no solution is provided in this page.

Just remove the curl-config from Scratchbox installation (as host tools
override target tools for performance reasons) and install curl -dev
package to your Scratchbox target.


> Someone in this page mentioned to remove -lidn. When I removed the -lidn,
> the linking process is OK. However, if I run the program, I will get a error
> messge:
> 
> " relocation error: /scratchbox/host_shared/lib/libc.so.6: symbol
> _dl_starting_up, version GLIBC_PRIVATE not defined in file ld-linux.so.2
> with link time reference"

You're mixing libraries that bring in different C-libraries,
the x86 Scratchbox target one, and the Scratchbox x86 host tools one.


	- Eero


> Thus, is there anyone who can help me?
> 
> Thanks in advance.


More information about the maemo-developers mailing list