LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-14-2014, 02:39 PM   #1
lachlanp
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
U-boot build fails - cannot find lgcc / gcclib.a


I am using Ubuntu 12.04 LTS 64 bit and trying to create a Linux Image for the SAMA5D36-EK. In doing so I need the mkimage command. According to website
www.at91.com/linux4sam/bin/view/LinuxSAM/U-Boot
the mkimage source comes with the U-boot source and is built during U-boot compilation. But I am having problems.

Step 1. I have installed the following:
git 1.7.5, tar 1.2.4, python 2.7.3
I have also done:
$ sudo apt-get install gawk wget git-core diffstat unzip textinfo gcc-multilib build-essential
$ sudo apt-get install chrpath libsdl1.2-dev xterm autoconf automake libtool libglib2.0-dev
$ sudo apt-get install linux-image-generic linux-headers-generic
$ sudo dpkg –add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libxss1:i386 libxft2:i386

Step 2. I have installed the cross toolchain according to Yocto ADT Manual sections 3.1/ 3.2 as follows:
$ tar -xjf adt_installer.tar.bz2
$ cd adt_installer
$ gedit adt_installer.conf and set
YOCTOADT_TARGETS=”arm”
YOCTOADT_ROOTFS_arm=”minimal sato-sdk”
YOCTOADT_SYSROOT_IMAGE_arm=”sato-sdk”
(and other arm based settings then save)
$ cd adt-installer
$ ./adt_installer (using the default cross-toolchain location)
$ sudo chmod +x /opt/poky/1.6/envrionment-setup-arm5te-poky-linux-gnueabi
$ sudo /opt/poky/1.6/envrionment-setup-arm5te-poky-linux-gnueabi
The cross development toolchain is now located in
/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/

Step 3. Create U-boot from source
$ git clone git://github.com/linux4sam/u-boot-at91.git
$ cd u-boot-at91
$ make distclean
$ make sama5d3xek_nandflash_config
$ make CROSS_COMPILE=/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/
After working for some time it comes with the error: ld: cannot find -lgcc

Step 4.
If I run
$ sudo find /usr/ -name libgcc*
I get the follwing:
/usr/lib/x86_64-linux-gnu/libgccpp.so.1
/usr/lib/x86_64-linux-gnu/libgccpp.so.1.0.3
/usr/lib/ure/lib/libgcc3_uno.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s_32.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so.1
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s_x32.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc.a
/usr/lib32/libgcc_s.so.1
/usr/share/lintian/overrides/libgcc1
/usr/share/doc/libgcc1
/usr/share/doc/libgcc-4.8-dev
/usr/libx32/libgcc_s.so.1

If I run
$ sudo /sbin/ldconfig -p | grep libgcc*
I get:
libgcrypt.so.11 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcrypt.so.11
libgcr-ui-3.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgcr-ui-3.so.1
libgcr-base-3.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgcr-base-3.so.1
libgconf-2.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgconf-2.so.4
libgck-1.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgck-1.so.0
libgccpp.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgccpp.so.1
libgcc_s.so.1 (libc6,x32) => /usr/libx32/libgcc_s.so.1
libgcc_s.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /lib/i386-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /usr/lib32/libgcc_s.so.1
libgcc_s.so (libc6,x32) => /usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_s.so
libgcc_s.so (libc6,x86-64) => /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so
libgcc_s.so (libc6) => /usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_s.so
libgc.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgc.so.1

There seems no reference to the two versions of the libgcc.a file that appear in subdirectories /32/ and /x32/

I then locate the follwing two files”
/etc/ld.so.conf.d/x86_64-linux-gnu.conf
/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/etc/ld.so.conf
and add the following lines in both files:
/usr/lib/gcc/x86_64-linux-gnu/4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/32
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32

I now repeat the three 'make' commands from step 3 . It makes about 200 or so files (tools, arch, common, drivers, fs, lib, net, test) but then comes to the same error as follws:
LD examples/standalone/hello_world
/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/ld: cannot find -lgcc
make[2]: *** [examples/standalone/hello_world] Error 1
make[1]: *** [examples/standalone] Error 2
make: *** [examples] Error 2

Step 5.
In the Makefile there is the following entries
# Add GCC lib
ifdef CONFIG_USE_PRIVATE_LIBGCC
ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
else
PLATFORM_LIBGCC = -L $(CONFIG_USE_PRIVATE_LIBGCC) -lgcc
endif
else
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
endif

Back in the terminal mode I do the following:
$ CONFIG_USE_PRIVATE_LIBGCC=yes
$ export CONFIG_USE_PRIVATE_LIBGCC
Then rerun the three make commands from Step 3 but get the same error

I then try
$ unset CONFIG_USE_PRIVATE_LIBGCC
and rerun the three commands but still the error occurs

Then I try
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gcc/x86_64-linux-gnu/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32
$ echo $LD_LIBRARY_PATH
/usr/lib/gcc/x86_64-linux/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32
and run the three make commands, but still an error

Then I try changing the entry in the Makefile from:
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
To:
PLATFORM_LIBGCC := -L /usr/lib/gcc/x86_64-linux-gnu/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32 -lgcc
I save the file.
Back in the terminal mode I do the following:
$ CONFIG_USE_PRIVATE_LIBGCC=yes
$ export CONFIG_USE_PRIVATE_LIBGCC
Then rerun the three make commands from Step 3 but get the same error

I then try
$ unset CONFIG_USE_PRIVATE_LIBGCC
and rerun the three commands but still the error occurs

I then change the Makefile entry to:
PLATFORM_LIBGCC :=/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc.a
which finally gets past the -lgcc error associated with the hello_world example, but then fails a littl further on with hundreds of failuers starting with:
LD u-boot
arch/arm/cpu/armv7/at91/built-in.o: In function `at91_pll_rate':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/clock.c:45: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `at91_clock_init':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/clock.c:100: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `usec_to_tick':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/timer.c:50: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `tick_to_time':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/timer.c:42: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `common_diskboot':
/home/lachlan/u-boot-at91/common/cmd_disk.c:100: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `do_mem_md':
/home/lachlan/u-boot-at91/common/cmd_mem.c:137: undefined reference to `__aeabi_idiv'
common/built-in.o: In function `bytes_per_second':
/home/lachlan/u-boot-at91/common/cmd_sf.c:86: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `spi_flash_update':
/home/lachlan/u-boot-at91/common/cmd_sf.c:207: undefined reference to `__aeabi_idiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:216: undefined reference to `__aeabi_uidiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:237: undefined reference to `__aeabi_uidiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:237: undefined reference to `__aeabi_uidivmod'
etc

I then change the Makefile entry to:
PLATFORM_LIBGCC :=/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc.a
and the same result occurs as immediatly described above

Can anyone suggest how to fix this problem?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Glibc 2.7 Build Error "ld: cannot find -lgcc" binzyw Linux From Scratch 8 06-25-2012 02:51 AM
Error...-lgcc not found manoj7410 Linux - Embedded & Single-board computer 1 06-18-2012 08:13 AM
-lgcc not found. manoj7410 Linux - Embedded & Single-board computer 1 06-12-2012 08:54 AM
self build rpm fails with missing dependencies on build host zhjim Linux - Software 1 09-24-2009 08:47 AM
New kernel fails to boot: It can't find modules.dep though it's there lixy Linux - General 2 04-16-2005 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration