P2041RDB : powerpc-fsl_networking-linux-ld.bfd: cannot find -lgcc

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

P2041RDB : powerpc-fsl_networking-linux-ld.bfd: cannot find -lgcc

2,816 Views
somasgowda
Contributor II

Hi,

I have installed SDK v1.4 for P2041 successfully and could build the images. sdk toolchain is installed in /opt/QorIQ-SDK-V1.4-20130625-yocto/ folder.

I am trying to do stand alone compilation of uboot and kernel sources taken from deploy directory.

I could do it successfully for kernel but facing the problem with uboot.

It stops compiling by showing foloowing error message -

powerpc-fsl_networking-linux-ld.bfd: cannot find -lgcc

make: *** [u-boot] Error 1

I had followed the sdk documentation to install tool chain and ran the script and set the environment. (Also redid this).

But this error does not go away.

I feel the following line in main Makefile is causing this -

PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc

but I do not know how to fix this.

Please help to fix this error.

Thanks

Labels (1)
3 Replies

623 Views
addiyi
NXP Employee
NXP Employee

Hi,

If you want to use Yocto toolchain to do manual build, please run "bitbake fsl-toolchain" to generate the toolchain install package, and then install it. The cross-compiler in Yocto build env(tmp/sysroot) can't be used directly.

Also, you should set ARCH and CROSS_COMPILE variables. An exemple of u-boot compilation is below:

$ export ARCH=powerpc

$ export CROSS_COMPILE=/i686-linux/bin/powerpc-unknown-linux-gnuspe-

$ make P2041RDB

Adrian

0 Kudos

623 Views
somasgowda
Contributor II

Hi Adrian,

Thanks for the reply.
Good news is compilation was successful.
However, following above instructions resulted in same error - The steps ->

$ export ARCH=powerpc
$ export CROSS_COMPILE=/opt/QorIQ-SDK-V1.4-20130625-yocto/sysroots/i686-fsl_networking_sdk-linux/usr/bin/ppce500mc-fsl_networking-linux/powerpc-fsl_networking-linux-
$ make P2041RDB_NAND_config

As you have have mentioned, I had installed the sdk toolchain in /opt/QorIQ-SDK-V1.4-20130625-yocto/ instead of the default directory.

Change details for successful compilation-

Uboot Compilation
--------------------------
I found that the problem is linked to the below line in main Makefile of uboot
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc

It is trying to find the libgcc.a library but is returning "." . Below is compilation output -

--end-group -L . -lgcc -Map u-boot.map -o u-boot
powerpc-fsl_networking-linux-ld.bfd: cannot find -lgcc
make: *** [/media/home/soma/Projects/NVR/work/bootloader/sdk14uboot/images/u-boot] Error 1

Then, I hard coded the link to this library as below
PLATFORM_LIBGCC := -L /opt/QorIQ-SDK-V1.4-20130625-yocto/sysroots/ppce500mc-fsl_networking-linux/usr/lib/powerpc-fsl_networking-linux/4.7.2/ -lgcc

(***The similar change was also effected in examples/standalone folder Makefile as below -
gcclibdir := /opt/QorIQ-SDK-V1.4-20130625-yocto/sysroots/ppce500mc-fsl_networking-linux/usr/lib/powerpc-fsl_networking-linux/4.7.2/)

With these changes compilation was successful.

Q 1) I do not understand why $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) failed.
(my dev platform is ubuntu10.04)

Q 2) I have sdk 1.2 tool chain installed on the system (not by me) and did not face any problem in linking to its library during compilation with
CROSS_COMPILE=power-fsl-linux-

I am wondering what step did I miss for it to not to find the library path.


Kernel Compilation
---------------------------
Similarly to compile the kernel I had to change the path to library in arch/powerpc/Makefile as below
LIBGCC  := /opt/QorIQ-SDK-V1.4-20130625-yocto/sysroots/ppce500mc-fsl_networking-linux/usr/lib/powerpc-fsl_networking-linux/4.7.2/libgcc.a

Before beginning with kernel compilation I had executed these steps -
1) Source the toolchain
$ source /opt/QorIQ-SDK-V1.4-20130625-yocto/environment-setup-ppce500mc-fsl_networking-linux

2) Enter to the Source (kernel)
$ cd /work/kernel/

3) Export ARCH and CROSS COMPILE and Unset the LDFLAGS
$ export ARCH=powerpc
$ export CROSS_COMPILE=powerpc-fsl_networking-linux-
$ unset LDFLAGS


I hope some info may help.

Thanks,
S

623 Views
somasgowda
Contributor II

Hi,

I would like to add to the above query -

sdk v1.2 tool chain is also installed on the system (powerpc-fsl-linux-gcc). With this the uboot compilation completes successfully.

Thanks

0 Kudos