building C application for gcc-arm-none-eabi-4_7-2012q4

Asked by Lingaraj Bal

Hi,

I am new to this gcc tools for embedded platforms. I have a sample project which I need to build againest gcc-arm-none-eabi-4_7-2012q4 . it is giving error in creating the shared library. Pasting below the build logs..

/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o serial_transport_dummy.o serial_transport_dummy.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o tmr_strerror.o tmr_strerror.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o tmr_param.o tmr_param.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o hex_bytes.o hex_bytes.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o tm_reader.o tm_reader.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o tm_reader_async.o tm_reader_async.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o serial_reader.o serial_reader.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o serial_reader_l3.o serial_reader_l3.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o tmr_utils.o tmr_utils.c
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -c -o osdep_dummy.o osdep_dummy.c
ar -rc libmercuryapi.a serial_transport_dummy.o tmr_strerror.o tmr_param.o hex_bytes.o tm_reader.o tm_reader_async.o serial_reader.o serial_reader_l3.o tmr_utils.o osdep_dummy.o
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/arm-none-eabi-gcc -O2 -I /arch/ARM/ixp42x/include -mthumb -mcpu=cortex-m3 -mtune=xscale --specs=rdimon.specs -lc -lc -lrdimon -mlittle-endian -I. -g -Werror -Wall -fPIC -shared -Wl,-rpath,/tm/lib,-soname,libmercuryapi.so.1 -o libmercuryapi.so.1 serial_transport_dummy.o tmr_strerror.o tmr_param.o hex_bytes.o tm_reader.o tm_reader_async.o serial_reader.o serial_reader_l3.o tmr_utils.o osdep_dummy.o
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/bin/ld: /usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/armv7-m/libc.a(lib_a-__call_atexit.o): relocation R_ARM_THM_MOVW_ABS_NC against `free' can not be used when making a shared object; recompile with -fPIC
/usr/local/gcc-arm-none-eabi-4_7-2012q4/bin/../lib/gcc/arm-none-eabi/4.7.3/../../../../arm-none-eabi/lib/armv7-m/libc.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libmercuryapi.so.1] Error 1

Internet suggests that in gcc-arm-none-eabi-4_7-2012q4 , we need to build the code with -fPIC option for the shared library.
My Make file is already doing that. You can see that in build logs above . Not sure why still it is showing the error.....

Any suggestions ?

Thanks
Lingaraj Bal

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
chengbin (can-finner) said :
#1

Hi Lingaraj Bal,
Simple answer is this is a bare-metal tool-chain, which should NOT be used to build general linux(or some other platforms) so library. And you should choose the toolchain for your specific platform.

Revision history for this message
Lingaraj Bal (lingaraj-bal) said :
#2

Hi chengbin ,

Yes, I understand that. But I guess I have downloaded the toolchain for linux only. I have downloaded that from the below link

https://launchpad.net/gcc-arm-embedded

If this is not the right place to download the toolchain. Can you please refer me some links where I can find the linux specific toolchain. Thanks for your post.

Lingaraj

Revision history for this message
Joey Ye (jinyun-ye) said :
#3

Linux target toolchain can be found here:
http://www.linaro.org/downloads/

Can you help with this problem?

Provide an answer of your own, or ask Lingaraj Bal for more information if necessary.

To post a message you must log in.