Hi to all, I am a newbie using OpenWrt and cross compiler, so I try to ask here for my issue: in few words I get "segmentation fault" when I try to run my executable on OpenWrt.
I would like to know if something wrong in compilation or somewhere else...
Main hardware: Ubuntu 22 LTS on norebook (sorry, my linux crashed so I have no access on it...)
Target hardware: OpenWrt on MIPS 74Kc V4.12 (Atheros AR9344 rev 3)
cat /etc/openwrt_release
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='21.02.0'
DISTRIB_REVISION='r16279-5cc0535800'
DISTRIB_TARGET='ath79/generic'
DISTRIB_ARCH='mips_24kc'
DISTRIB_DESCRIPTION='OpenWrt 21.02.0 r16279-5cc0535800'
DISTRIB_TAINTS='no-all busybox override'
I need to compile some executables from rtklib (str2str and rtk2rcv).
First attempt: installing packages using opkg.
Packages correctly installed but rtk2rcv give me "segmentation fault".
I've read it was due to old package version, so the only way to get working package is cross compilation from updated sources (I thought).
I download rtklib (working version tested on Ubuntu and Raspberry): https://github.com/rtklibexplorer/RTKLIB
Unpacked, I go into rtk2rcv folder, then
make -f makefile clean && make -f makefile
got perfectly working executable.
Ok, now let's go with cross compiler!
Downloaded OpenWrt SDK and unpacked to my Ubuntu
https://openwrt.org/docs/guide-developer/using_the_sdk
Sorry, I have no available full path due I still have no access on my Ubuntu...
I get paht to gcc cross compiler, I get path to STAGING_DIR.
As first step I try to compile simple "hello world", I get it, I copy it on my target device and it correctly works.
So I edit makefile in rtk2rcv, I set GCC to cross compiler, I set STAGING_DIR, and again make clean and make.
I get correctly working str2str, I get working rtkrcv, I try to run rtkrcv but I get "segmentation fault" when I try to call routine.
...
printf("[my debug] it's all ok until here (39)\r\n");
prstatus(vt);
...
static void prstatus(vt_t *vt)
{
...variables declaration...
printf("[my debug] it's all ok until here (40)\r\n");
...
I get:
[my debug] it's all ok until here (39)
segmentation fault
So I am trying to understand: is there something wrong with cross compilation? Is there something I missed?
Thanks.