failure cross compiling

Issue #16 duplicate
Roger Pack created an issue
cmake GUnix Makefiles . -DENABLE_STATIC_RUNTIME=1 -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_RANLIB=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-ranlib -DCMAKE_C_COMPILER=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-g++ -DCMAKE_RC_COMPILER=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-windres -DCMAKE_INSTALL_PREFIX=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/i686-w64-mingw32 -DBUILD_SHARED_LIBS=0 -DENABLE_UBSAN=0
-- The C compiler identification is GNU 7.1.0
-- The CXX compiler identification is GNU 7.1.0
-- Check for working C compiler: /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-g++
-- Check for working CXX compiler: /home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test __LIBGME_TEST_VISIBILITY
-- Performing Test __LIBGME_TEST_VISIBILITY - Success
-- Performing Test __LIBGME_SWITCH_FALLTHROUGH_WARNINGS
-- Performing Test __LIBGME_SWITCH_FALLTHROUGH_WARNINGS - Success
 ** ZLib library located, compressed file formats will be supported
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
SDL library not found, disabling player demo build
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    ENABLE_STATIC_RUNTIME


-- Build files have been written to: /home/rdp/ffmpeg-windows-build-helpers/sandbox/win32/game-music-emu_git

making /home/rdp/ffmpeg-windows-build-helpers/sandbox/win32/game-music-emu_git as $ PATH=/home/rdp/ffmpeg-windows-build-helpers/sandbox/cross_compilers/mingw-w64-i686/bin:$PATH make  -j 4

nice: cannot set niceness: Permission denied
nice: cannot set niceness: Permission denied
Scanning dependencies of target gme
[  2%] Building CXX object gme/CMakeFiles/gme.dir/Blip_Buffer.cpp.obj
[  6%] Building CXX object gme/CMakeFiles/gme.dir/Data_Reader.cpp.obj
[  6%] Building CXX object gme/CMakeFiles/gme.dir/Dual_Resampler.cpp.obj
[  8%] Building CXX object gme/CMakeFiles/gme.dir/Classic_Emu.cpp.obj
In file included from /usr/include/limits.h:25:0,
                 from /home/rdp/ffmpeg-windows-build-helpers/sandbox/win32/game-music-emu_git/gme/Blip_Buffer.h:8,
                 from /home/rdp/ffmpeg-windows-build-helpers/sandbox/win32/game-music-emu_git/gme/Blip_Buffer.cpp:3:
/usr/include/features.h:391:10: fatal error: gnu/stubs.h: No such file or directory
 #include <gnu/stubs.h>
          ^~~~~~~~~~~~~

Comments (6)

  1. Michael Pyne repo owner

    This project doesn't use the gnu/stubs.h include which is causing your build to error out.

    That appears to be included from the limits.h C/C++ header which the library does use (properly).

    Rather it seems you have an error in your build system of some sort. Make sure you can build a simple C++ project using the limits.h include.

  2. Roger Pack reporter

    Cross compiling used to work with 0.6.2. It appears it's using a file from the linux side of things [?] Cheers!

  3. Michael Pyne repo owner

    We've made some changes since 0.6.2, but nothing involving the limits.h include file.

    This file itself is a C (and C++) standard header file, not a Linux-specific header file.

    The cross-compile toolchain you are using does not appear to like this use of limits.h, which might be a problem with the toolchain that happened to work by accident up to now, or some other local issue. I can't diagnose it from here. :)

    If it wasn't for the huge merge commit from the recent pull request to integrate ZLib support then I'd maybe suggest using git bisect to help narrow down whether a game-music-emu change exposed an error in the build system.

    But it might be easier just to try and create an empty /usr/include/gnu/stubs.h in your cross-compile setup and see if that makes things at least go on.

  4. Michael Pyne repo owner

    Roger, please see issue #17. Looks like the addition of zlib causes the CMake build system to pick up the dynamic shared library version of zlib instead of a static zlib library, when you're doing a static build. Any sane toolchain is guaranteed to at least have the dynamic zlib, so it will usually be autodetected unless you manually disable it.

    For now you can try disabling zlib support when you build (I assume this will fix the build error), but I will see if I can't find a better way to filter out shared library zlib when doing a static build.

  5. Log in to comment