What's new

Entware - native compilation: pros and cons

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Native compilation in Entware?


  • Total voters
    14

zyxmon

Regular Contributor
I have built gcc (4.8.5) package for arm and intel feeds. It has some limitations and problems. I have successfully used it to build missing perl and python modules, that require compilation. We decided that mipsel platform is not powerfull enough for gcc.

The main problem is - there are no dev packages in openwrt and entware. I have uploaded all headers to keep gcc usage simple: https://github.com/Entware-ng/Entware-ng/wiki/Using-gcc-(native-compilation)

Probably there are upcoming some changes in openwrt policy - now python and zlib have dev versions! Some developers tools were recently added to repo: autoconf, automake, m4, pkg-config (patch, diffutils, make were already there).
One should prefer to crosscompile binaries, because routers are not usually powerfull.
Still I want to know users opinion - do we need developers tools for arm routers. Please vote and share your considerations.
 
Last edited:
Would native compiling create more optimized binaries than cross-compiling?

I guess it also opens up (much) more software that could be ran on the device?
 
@zyxmon, please, don't say "we" about MIPS feed. I've allowed native GCC for ARM and x86 but you clearly know my opinion about native GCC on MIPS.

Please, don't make such votes behind my back. I'm prefer to make my decision about that without your pressure.

MIPS is just not powerful enough?

(I think I saw that all entware-ng is mipselsf. Thanks!)
 
development requires too many additional packages, would be a burden for just a handful of users. I suggest doing what we did with WDLXTV instead, and have users run a chrooted debian environment if they want native compile capability.
 
development requires too many additional packages, would be a burden for just a handful of users. I suggest doing what we did with WDLXTV instead, and have users run a chrooted debian environment if they want native compile capability.
I do not think we should have full development environment on a router. gcc and a couple of tools will help to install perl and python packages that require compilation. It is much easier to write an instruction - "how to install perl package, that requres gcc" then to build dozens or hundreds of perl (or python) packages. Optware-ng has 124 perl package btw.
 
I'd like to have native compilation as i am currently trying to get cups-filters compiled but am stuck with the following:
"configure: error: Package requirements (glib-2.0 >= 2.30.2) were not met: No package 'glib-2.0' found."
It is installed ("opkg install glib2" result: "Package glib2 (2.44.1-1) installed in root is up to date.").
my guess is i am overlooking something simple.

I'm also trying for cross-compilation using buildroot/Entware-ng repo but this also fails for me (during make i get the error: ... Entware-ng/staging_dir/toolchain-arm_cortex-a9_gcc-4.8.5_glibc-2.22_eabi/lib/libgcc_s.so.*': No such file or directory).
This also seems to be a simple thing i am overlooking on my part .
 
I prefer to create static binaries for portability (share-ability) reasons. Glibc is used in all architectures of entware-ng except mipsel, and isn't static compilation friendly. Perl + Python modules will always need to be dynamic, so it seems like a good solution in those cases though.

I've done native compilation on RT-N16 for years. Sure it takes a while, but it is quite capable. I tried another router with the same cpu, but 64Mb ram. It sucks a lot worse. One thing I compiled (aria2) took like an hour just to link cause it went into swap hell. Having lots of memory is important. I've recently started using distcc to offload compiling from the router to a x86_64 cpu, which speeds things up significantly, and isn't overly complicated like the nightmare cross-compiling can be at times.
 
I think I need it. Then my RT-AC68U can run more Python stuff without choking. However, that's why I buy the Raspberry Pi 2 model B. :)

My Raspberry Pi auto-magically compiles a Flexget dependency to native code, here:
Code:
sudo pip install --upgrade flexget

...

  Found existing installation: SQLAlchemy 1.0.9
    Uninstalling SQLAlchemy:
      Successfully uninstalled SQLAlchemy
  Running setup.py install for SQLAlchemy
    building 'sqlalchemy.cprocessors' extension
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/processors.c -o build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/processors.o
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/processors.o -o build/lib.linux-armv7l-2.7/sqlalchemy/cprocessors.so
    building 'sqlalchemy.cresultproxy' extension
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/resultproxy.c -o build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/resultproxy.o
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/resultproxy.o -o build/lib.linux-armv7l-2.7/sqlalchemy/cresultproxy.so
    building 'sqlalchemy.cutils' extension
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lib/sqlalchemy/cextension/utils.c -o build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/utils.o
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-armv7l-2.7/lib/sqlalchemy/cextension/utils.o -o build/lib.linux-armv7l-2.7/sqlalchemy/cutils.so

...



However, I'm not seeing the following message on Entware-ng (RT-AC68U). Flexget installed OK and is apparently running just fine on the RT-AC68U. The native code compiling would be nice for the speedups.
Code:
  ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Failure information, if any, is above.
    Retrying the build without the C extension now.
    ==========================================================================
    WARNING: The C extension could not be compiled, speedups are not enabled.
    Plain-Python installation succeeded.
    ==========================================================================
 
I think I need it. Then my RT-AC68U can run more Python stuff without choking. However, that's why I buy the Raspberry Pi 2 model B. :)

My Raspberry Pi auto-magically compiles a Flexget dependency to native code, here:
.....
Your AC68 can compile it also. Here is a pip install log (sorry - without compilation, but the compilations without error are not shown). http://pastebin.com/XgdZVR7s

The purpose of this topic is to know user opinions - the voting result is not very important. May be I should remove gcc from packages (it is not needed) or I should add a couple of packages to the repo for python and perl modules installation (with native compilation) for arm and intel feeds.
 
For using routers, nas, TV, set-top boxes as compute farm while a powerful desktop as a dumb terminal? For me is no..

Whenever possible I would avoid native compilation on these devices. A desktop is much faster to get the work done. Also, I would avoid build and deployment on the same machine. Having VMs these days is so cool. People can mess around with a development environment. Restart with a pristine image if things go terribly wrong.

Personally I also think armv5 & armv7 shall better align with mipsel e.g. in using uClibc. I compared the performance of OpenVPN and dnsmasq from Entware and asuswrt-merlin on my RT-AC56U. Merlin consistently uses less RAM and runs faster.
 
... or I should add a couple of packages to the repo for python and perl modules installation (with native compilation) for arm and intel feeds.
Yes. This is the only way to enable speedups for Python and Perl? I enable speedups this way, so the RT-AC68U automatically compiles the Python C extensions:
pip install --upgrade flexget
 
ASAT perl-dev is needed and may be some other packages. I need to refresh my experience tests from scratch. I'll write instructions and add missing packages to the repo if I feel native compilation for perl and python modules is on demand.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top