Closed lgeek closed 8 years ago
According to LuaJIT document, it's necessary to add "-m32" flag in HOST_CC
when cross compiling for 32 bit architecture to make pointer size match.
Current Makefile
is largely used for cross compiling except building the emulator that use SDL to handle input/output. I'm not sure if native compile is even supported without large portion of modification. But is there a particular reason to choose native compiling instead of cross compiling? I would never try to compile anything on a 800 MHz CPU plus 256 MB RAM of my Kindle device.
I can confirm this is the only change required to build koreader-base (and koreader) natively on ARM (at least for Kobo devices).
As to why, it's because I'm building koreader as part of a larger collection of software, some of which is easier to just build natively. I'm using a more powerful machine, not my ereader, and the build time is entirely reasonable.
For my own use I can work around this with a local patch. However, since it seems to be the only issue blocking compilation on non-x86 hosts, I think it might be worth fixing upstream.
Then it seems easy to fix. Probably we can differentiate toolchains with $(CC) -dumpmachine
(the MACHINE variable defined in Makefile.def) with findstring
function like this
HOST_CC="$(HOSTCC) $(if $(findstring,x86_64,$(MACHINE)),-m32,)"
++ on what chrox's approach. @lgeek , feel free to send a PR
On this line: https://github.com/koreader/koreader-base/blob/master/Makefile#L199
It's x86 specific and has to be removed to do native builds on ARM. Could it be removed and if not what would be the proper way to only enable it on x86_64 hosts?
Thanks