Skip to main content

cvm linking error

7 replies [Last post]
tlac
Offline
Joined: 2008-02-25
Points: 0

Hello!

svn co https://phoneme.dev.java.net/svn/phoneme/components/cdc/trunk cdc
svn co https://phoneme.dev.java.net/svn/phoneme/components/tools/trunk tools

cd cdc/build/linux-arm-generic/

make CVM_TARGET_TOOLS_PREFIX=/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/bin/arm-linux- USE_AAPCS=true J2ME_CLASSLIB=foundation

...
Linking /home/x/pmea/cdc/build/linux-arm-generic/./bin/cvm
/lib/libpthread.so.0: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [/home/x/pmea/cdc/build/linux-arm-generic/./bin/cvm] Error 1

What's the problem?

Laci

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cjplummer
Offline
Joined: 2006-10-16
Points: 0

You are doing a cross compilation, but for some reason the linker is picking up /lib/libpthread.so.0, which is meant for host/native compilations, not linux/ARM cross compilations. Can you post the config information that is dumped at the start of the build?

Chris

tlac
Offline
Joined: 2008-02-25
Points: 0
cjplummer
Offline
Joined: 2006-10-16
Points: 0

I don't see anything wrong in your log. Can you also try building a simple C program and pass -lpthread when you do. I'm guessing it will produce the same error, in which case your cross tools are broken. Look for libpthread.so that is located somewhere in your toolchain. Open it up (it is a text file). It probably contains:

GROUP ( /lib/libpthread.so.0 /lib/libpthread_nonshared.a )

It should contain:

GROUP ( libpthread.so.0 libpthread_nonshared.a )

Chris

tlac
Offline
Joined: 2008-02-25
Points: 0

Sorry, how can I cross compile a simple C program?

cat /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/usr/lib/libpthread.so

/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )

I tried with /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/usr/lib/libpthread.so :

OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libpthread.so.0 libpthread_nonshared.a )

but same error.

cjplummer
Offline
Joined: 2006-10-16
Points: 0

> Sorry, how can I cross compile a simple C program?
>

/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/bin/arm-linux-gcc test.c -lpthread

> cat
> /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/usr/lib/
> libpthread.so
>
> /* GNU ld script
> Use the shared library, but some functions are
> only in
> the static library, so try that secondarily. */
> TPUT_FORMAT(elf32-littlearm)
> GROUP ( /lib/libpthread.so.0
> /usr/lib/libpthread_nonshared.a )
>
This is definitely a problem.

> I tried with
> /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/usr/lib/
> libpthread.so :
>
> OUTPUT_FORMAT(elf32-littlearm)
> GROUP ( libpthread.so.0 libpthread_nonshared.a )
>
> but same error.

This should have fixed the problem. Try this:

/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/bin/arm-linux-gcc -print-search-dirs

Make sure you've searched all the listed libraries directories for libpthread.so, and also make sure /lib is *not* listed.

Chris

tlac
Offline
Joined: 2008-02-25
Points: 0

it's not good

I modified the
/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi/lib/libpthread.so.0

and make:

Linking /home/x/nokia_java/pmea/cdc/build/linux-arm-generic/./bin/cvm
/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/bin/../lib/gcc/arm-none-linux-gnueabi/3.4.4/../../../../arm-none-linux-gnueabi/lib/libdl.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [/home/x/nokia_java/pmea/cdc/build/linux-arm-generic/./bin/cvm] Error 1

I modified the libdl.so symlink and make:

Linking /home/x/nokia_java/pmea/cdc/build/linux-arm-generic/./bin/cvm
/lib/libc.so.6: file not recognized: File format not recognized
collect2: ld returned 1 exit status
make: *** [/home/x/nokia_java/pmea/cdc/build/linux-arm-generic/./bin/cvm] Error 1

cjplummer
Offline
Joined: 2006-10-16
Points: 0

I seem to recall mention of scratchbox being different in terms of how it is used to cross compile. I think you'll need to consult with some scratchbox experts on this one. I would recommend creating a simple test case first like the test.c example I gave you.

good luck,

Chris