Cross Compiled binary fails to run

Your build environment seems a little screwy

Try ln -s /lib/libc-2.27.so /lib/libc.so

You can also try adding +libc to the DEPENDS line in the Makefile

After linking libc-2.27.so to libc.so

obuspa: Relink `/usr/lib/libcares.so.2' with `/lib/librt.so.1' for IFUNC symbol `clock_gettime'
obuspa: symbol lookup error: /usr/lib/libsqlite3.so.0: undefined symbol: stat

Yes, you need to install all the packages listed on the DEPENDS line. You don't have libsqlite3 installed by the looks of it. Normally if you're installing from a repository it would install all the dependencies too. You might have to do it manually.

EDIT: reading that error message, I'm not sure that it's not installed - it looks like it is.

I'd suggest one of two things: re-download and install the SDK and start from scratch.

Or, clone the full source and build with that.

All the packages are available and are up to date.

root@OpenWrt:~# opkg install zlib
Package zlib (1.2.11-3) installed in root is up to date.
root@OpenWrt:~# opkg install libcares
Package libcares (1.15.0-4) installed in root is up to date.
root@OpenWrt:~# opkg install libcurl
Package libcurl4 (7.66.0-1) installed in root is up to date.
root@OpenWrt:~# opkg install libopenssl
Package libopenssl1.1 (1.1.1e-2) installed in root is up to date.
root@OpenWrt:~# opkg install libsqlite3
Package libsqlite3-0 (3310100-1) installed in root is up to date.
root@OpenWrt:~# opkg install libc
Package libc (2.27-2) installed in root is up to date.

Sure. I will redo everything from scratch.

And try and do it without exporting all those environment variables you noted in your post #2. They might be messing with your build

1 Like

Thanks a lot :slight_smile:

The issue is resolved. I am able to run the Obuspa inside OpenWRT.

Started all the steps from scratch.

  1. Setup a new build environment
  2. Included the obuspa as package (based on the response from @dl12345)
  3. Included obuspa through make menuconfig
    (Note: I went ahead with musl library itself)
  4. Faced some issues. Had to comment out few lines of code in some obuspa files. (usp_log.c, usp_mem.c and nu_ipaddr.h). The errors were clearly visible when i run make package.
    (Note: Looks like commenting those lines were necessary when musl is chosen as the C library. I did not face that issue when glibc was chosen. I am not an expert in C programming. To be frank, this is my first interaction with C code.)
  5. Built the package. Installed and tested it.

Once again. Thanks a ton.

Good to hear it's fixed. Although just commenting out code sounds a little risky - it's very likely to break the application. My build uses glibc, so that's why it compiled cleanly for me.

1 Like

I agree to the point -- things might break. I thought i will start using the application and then fix it when i reach those breaking points. Right now i am stuck and there is no progress.

During weekend i will try a new build from scratch with glibc.

I will return and post my findings.

If you're using an x86_64 platform, there's no reason you shouldn't use glibc as the hardware definitely has the power and you likely have a lot more storage than a typical consumer router, so the extra size doesn't really matter.

I use glibc as I have a number of things that require it, but then my router has 4 cores, 16GB of RAM and a couple of hundred GB of SSD in it.

1 Like

I haven't received the specifications of the real hardware on which this will be tested. For the time being, i am doing all this work by using VirtualBox and a OpenWRT VM in it.

Thats the reason, i am trying to have both musl and glibc based POC solutions working.

It has been a good experience trying out things with OpenWRT.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.