When execute gcc hello.c with the sdcard ubuntu distribution I have the error "cannot find -lgcc"
I have tested mini-A, plus and pro boards
Does anyone know the solution to the problem?
cannot find -lgcc
Hello, the Luckfox-pico uses the RV110x chip, which has limited resources. Unlike the Raspberry Pi or RK3XXX series chips, it cannot perform compilation tasks directly on the board. The on-board GCC lacks complete library links, making it unusable directly. The recommended approach is to use cross-compilation. This involves using a cross-compilation tool on a PC to compile the source code into an executable file, which can then be uploaded to the board for testing.
Note: The SD card Ubuntu system requires the arm-linux-gnueabihf-gcc cross-compilation tool based on glibc. The SDK only provides the arm-rockchip830-linux-uclibcgnueabihf-gcc tool based on uclibc. The command to use arm-linux-gnueabihf-gcc is as follows:
Code: Select all
# Run on PC Ubuntu with pre-configured environment variables
arm-linux-gnueabihf-gcc hello.c -o hello
Code: Select all
# Run on PC Ubuntu with pre-configured environment variables
arm-rockchip830-linux-uclibcgnueabihf-gcc hello.c -o hello -static
Thanks for your reply
cross compilation from PC ubuntu run fine
From pico board gcc and arm-linux-gnueabihf-gcc commands with option -c compile to file main.o
Without option -c show the error
"/usr/bin/ld cannot find -lgcc: No such file or directory"
I think is a configuration problem
Compiler files and libraries are installed in the directories /bin and usr/bin
cross compilation from PC ubuntu run fine
From pico board gcc and arm-linux-gnueabihf-gcc commands with option -c compile to file main.o
Without option -c show the error
"/usr/bin/ld cannot find -lgcc: No such file or directory"
I think is a configuration problem
Compiler files and libraries are installed in the directories /bin and usr/bin
Hello, thank you very much for pointing out the possible causes of the issue. We will conduct troubleshooting, and if the problem is resolved, we will update the relevant image as soon as possible.fsimon wrote: ↑2024-05-17 6:00 Thanks for your reply
cross compilation from PC ubuntu run fine
From pico board gcc and arm-linux-gnueabihf-gcc commands with option -c compile to file main.o
Without option -c show the error
"/usr/bin/ld cannot find -lgcc: No such file or directory"
I think is a configuration problem
Compiler files and libraries are installed in the directories /bin and usr/bin
你好,请问现在这个问题解决了吗,我们在编译的时候也遇到了同样的问题
您好,我们确认过出现cannot find -lgcc是缺少gcc相关库导致的,rv1103/rv1106 作为单核soc加上有限的内存资源,搭建gcc环境可能会让系统一直处于内存溢出的状态使内核概率性奔溃,同时即使搭建完成在编译最简单的程序上的耗时也不理想。建议参照前面帖子中提到的交叉编译的方式来实现
I've just started with LuckFox ProMax and install ubuntu.
I've met same promblem. gcc fails to link any c/c++ code.
So I make quick fix for this problem:
This bash script will download required libraries, unpack and install them. Also it compile and run simple code to test result.
I've met same promblem. gcc fails to link any c/c++ code.
So I make quick fix for this problem:
Code: Select all
#!/bin/sh
# run on device in user's home dir /home/pico
#
# bash luckfox-gcc-fix.sh
#
# view contents:
# https://packages.debian.org/sid/armhf/libc6-dev/filelist
# https://packages.debian.org/sid/armhf/libgcc-11-dev/filelist
# update links:
# https://packages.debian.org/sid/armhf/libc6-dev/download
# https://packages.debian.org/sid/armhf/libgcc-11-dev/download
wget -c http://http.us.debian.org/debian/pool/main/g/glibc/libc6-dev_2.40-4_armhf.deb
wget -c http://http.us.debian.org/debian/pool/main/g/gcc-11/libgcc-11-dev_11.5.0-1_armhf.deb
time dpkg -x libc6-dev_2.40-4_armhf.deb .
time dpkg -x libgcc-11-dev_11.5.0-1_armhf.deb .
cp ./usr/lib/arm-linux-gnueabihf/libc_nonshared.a .
cp ./usr/lib/arm-linux-gnueabihf/libdl.a .
cp ./usr/lib/gcc/arm-linux-gnueabihf/11/libgcc.a .
cp ./usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_eh.a .
# this part must be run on device
sudo cp libc_nonshared.a /usr/lib/arm-linux-gnueabihf/
sudo cp libdl.a /usr/lib/arm-linux-gnueabihf/
sudo cp libgcc.a /usr/lib/gcc/arm-linux-gnueabihf/11/
sudo cp libgcc_eh.a /usr/lib/gcc/arm-linux-gnueabihf/11/
cat>test.cpp<<'CPP'
#include <iostream>
int main(int argc,char** argv) {
std::cout<<"It works. I can't belive it!"<<std::endl;
return 0;
}
CPP
time g++ test.cpp -o test && ./test
Last edited by kov_serg on 2024-12-30 9:24, edited 1 time in total.
This solution works well for me. Thanks a lotkov_serg wrote: ↑2024-12-30 9:23 I've just started with LuckFox ProMax and install ubuntu.
I've met same promblem. gcc fails to link any c/c++ code.
So I make quick fix for this problem:This bash script will download required libraries, unpack and install them. Also it compile and run simple code to test result.Code: Select all
#!/bin/sh # run on device in user's home dir /home/pico # # bash luckfox-gcc-fix.sh # # view contents: # https://packages.debian.org/sid/armhf/libc6-dev/filelist # https://packages.debian.org/sid/armhf/libgcc-11-dev/filelist # update links: # https://packages.debian.org/sid/armhf/libc6-dev/download # https://packages.debian.org/sid/armhf/libgcc-11-dev/download wget -c http://http.us.debian.org/debian/pool/main/g/glibc/libc6-dev_2.40-4_armhf.deb wget -c http://http.us.debian.org/debian/pool/main/g/gcc-11/libgcc-11-dev_11.5.0-1_armhf.deb time dpkg -x libc6-dev_2.40-4_armhf.deb . time dpkg -x libgcc-11-dev_11.5.0-1_armhf.deb . cp ./usr/lib/arm-linux-gnueabihf/libc_nonshared.a . cp ./usr/lib/arm-linux-gnueabihf/libdl.a . cp ./usr/lib/gcc/arm-linux-gnueabihf/11/libgcc.a . cp ./usr/lib/gcc/arm-linux-gnueabihf/11/libgcc_eh.a . # this part must be run on device sudo cp libc_nonshared.a /usr/lib/arm-linux-gnueabihf/ sudo cp libdl.a /usr/lib/arm-linux-gnueabihf/ sudo cp libgcc.a /usr/lib/gcc/arm-linux-gnueabihf/11/ sudo cp libgcc_eh.a /usr/lib/gcc/arm-linux-gnueabihf/11/ cat>test.cpp<<'CPP' #include <iostream> int main(int argc,char** argv) { std::cout<<"It works. I can't belive it!"<<std::endl; return 0; } CPP time g++ test.cpp -o test && ./test