tpoechtrager / osxcross

Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux)
GNU General Public License v2.0
2.86k stars 324 forks source link

Fails to build tmux #255

Closed 097115 closed 3 years ago

097115 commented 3 years ago

OK, so I've cloned tmux repository, run ./autogen.sh, and then run the configure script:

CC=o64-clang CXX=o64-clang++ ./configure --host=i386-apple-darwinXX

But it failed with the following:

checking for working reallocarray... configure: error: in `/home/097115/test/tmux':
configure: error: cannot run test program while cross compiling

And if I just run ./configure --host=i386-apple-darwinXX and then do LD_LIBRARY_PATH=$HOME/osxcross/lib OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1 MACOSX_DEPLOYMENT_TARGET=10.8 CC=o64-clang CXX=o64-clang++ make

It fails with the following:

osdep-darwin.c:22:26: fatal error: Availability.h: No such file or directory
compilation terminated.
Makefile:877: recipe for target 'osdep-darwin.o' failed
make: *** [osdep-darwin.o] Error 1

I even tried to point it to the headers explicitly by adding CFLAGS=-I$HOME/osxcross/SDK/MacOSX10.11.sdk/usr/lib but it ended the same (needless to say that Availability.h is indeed present in the SDK's lib folder).

I understand that this is probably not an osxcross issue... But may be I'm just doing something wrong? Or perhaps someone could give me some advise, or may be point to a workaround? Would be really grateful, thanks :)

(osxcross reports version 1.3, and I'm running it on Ubuntu 16.04.1)

tpoechtrager commented 3 years ago
export MACOSX_DEPLOYMENT_TARGET=10.8

osxcross-macports install libevent
osxcross-macports remove-dylibs

Then remove the reallocarray checks from configure.ac and run ./autogen.sh

CC="xcrun clang -Dreallocarray=xreallocarray -Drecallocarray=xrecallocarray"  ./configure --host=x86_64-apple-darwin20.2
make

xcrun otool -lL tmux
[...]
Load command 9
    cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.8
    sdk 11.1
[...]
        /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
        /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

I haven't tested i386 though.

097115 commented 3 years ago

Thanks, Thomas!