Yes, I'm compiling natively. Optware-ng provides gcc for
native compilation. /opt/bin/gcc is a wrapper around
/opt/bin/gcc.real -- the actual compiler:
I believe this is an issue with binutils rather than with uclibc-ng
itself. To fix this, binutils needs to be compiled with
"--sysroot=/opt" (not there) . Using --prefix is not enough in this
case, binutils needs to know the location of the shared files it
should be linking against. /opt is a non-standard location after
all for a system root. Without sysroot, it attempts to reference
the libraries provided by your device's firmware in /lib, which it
definitely should not be doing. uclibc provided by the router
probably doesn't have atexit, and thus the error. Some things may
still compile, and they *will* use the libraries in /opt, since the
wrapper script (feels dirty to me) provides the dynamic linker and
rpath arguments, but you'll be limited to symbols that the router's
libraries have. I came upon similar issues in my project
Tomatoware.
And now to shamelessly promote you my project Tomatoware. (despite
it's name, it also runs on dd-wrt and rmerlin as well as tomato)
Entware-ng/Optware-ng are firstly and primarily package repos, with
gcc and a handful of dev tools thrown in as an afterthought.
Tomatoware on the other hand is designed with the sole purpose of
providing a development environment on mipsel/arm routers. It also
allows static linking which I find absolutely essential for binary
re-share-ability. Entware-ng/Optware-ng only allow dynamic linking,
so your binary is tethered to Entware-ng/Optware-ng being
installed. Tomatoware deploys to /mmc, so you can still use
Entware-ng/Optware-ng for installing packages.