moon-buggy icon indicating copy to clipboard operation
moon-buggy copied to clipboard

Fix cross-compilation

Open jsarenik opened this issue 8 years ago • 2 comments

This way I can make it compile for ARM and static ncurses library.

$ cd ncurses
$ git rev-parse HEAD
4b386ffba9ebe520ddc51fe46ba88e008056a67e
$ export CC=$HOME/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
$ export CFLAGS="--sysroot=$HOME/sysroot-linaro-glibc-gcc5.3-2016.02-arm-linux-gnueabihf/"
$ ./configure --host=arm-linux-gnueabihf --without-cxx-binding --with-fallbacks=screen,xterm,rxvt,linux,rxvt-unicode-256color --disable-database --enable-widec --disable-shared --enable-static
$ make libs
$ make prefix=$HOME/sysroot-linaro-glibc-gcc5.3-2016.02-arm-linux-gnueabihf/usr/ install.libs
$ cd ..
$ cd moon-buggy
$ export LDFLAGS="-static"
$ ./configure --host=arm-linux-gnueabihf
$ make

And it still can be compiled on native host just with ./configure; make; ./moon-buggy

jsarenik avatar Apr 28 '16 08:04 jsarenik

Hello, thank you for your contribution, and apologies for my incredibly slow answer. I have looked at your patch, and I have a few questions:

  1. Is the command AC_CHECK_FUNCS([getcwd gettimeofday fnmatch chdir rmdir unlink lstat system getenv], ...) related to solving your issue? Is this needed at all? I would have thought that missing functions would give an error at compile time just fine. Also, why check for fnmatch?

  2. You seem to explicitly check for the wide-character version of ncurses, ncursesw, but moonbuggy does not use wide characters. Why do you add these checks?

  3. Can't you just use the existing configure options --with-curses-libs, --with-curses-includedir and --with-curses-header to select the correct library for cross-compilation?

All the best, Jochen

seehuhn avatar Jan 08 '17 12:01 seehuhn

Hi Jochen!

Thanks for you reply! These are very good questions. I did the patch because it helped to solve my issue and most of it was copy&paste so I do not have any explanation about the particular functions.

The same goes for ncursesw which obviously is not needed. Now I remember - the only ncurses variant I was compiling for my cross-compilation root was ncursesw.

As for the options you mention, I think I tried to use them but they did not work. Maybe there is some path hard-wired into the autoconf check, or something like this. I actually do not remember now. But in case I get back to it again, I will be happy to answer these questions.

And it was certainly related to compiling moon-buggy statically. So package scripts like https://github.com/dimkr/rlsd2/blob/master/rules/moon-buggy/build do not experience the same problems I did even though I was compiling against musl...

Thank you!

jsarenik avatar Jan 08 '17 13:01 jsarenik