lambdanative
lambdanative copied to clipboard
Cross-compiling for win32 of libfreetype
When cross-compiling for windows on ubuntu linux my system hangs withth the libfreetype part
checking whether we are cross compiling...
The other libraries seem to compile OK. Has anyone been successful?
Full verbose
=> libfreetype..
=> shasum.. ok
=> extracting /home/karliwalti/.cache/lambdanative/packages/freetype-2.10.1.tar.gz..
=> tar.. ok
=> patching source...
=> configuring source in /home/karliwalti/.lambdanative/tmp_install/freetype-2.10.1 ...
CHOST=i686-w64-mingw32 PKG_CONFIG_PATH=/home/karliwalti/.cache/lambdanative/win32/lib/pkgconfig PATH="/home/karliwalti/.cache/lambdanative/win32/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/PHP/v7.4:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/MATLAB/R2021a/runtime/win64:/mnt/c/Program Files/MATLAB/R2021a/bin:/mnt/c/Program Files (x86)/Nordic Semiconductor/nrf-command-line-tools/bin/:/mnt/c/Program Files (x86)/STMicroelectronics/STM32 ST-LINK Utility/ST-LINK Utility:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Microsoft/Web Platform Installer/:/mnt/c/Users/Walter Karlen/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Walter Karlen/AppData/Local/atom/bin:/mnt/c/Users/Walter Karlen/AppData/Local/Programs/MiKTeX/miktex/bin/x64/:/mnt/c/ProgramData/ComposerSetup/bin:/mnt/c/Users/Walter Karlen/AppData/Roaming/Composer/vendor/bin:/mnt/c/Program Files/Inkscape/bin:/snap/bin" LDFLAGS=-L/home/karliwalti/.cache/lambdanative/win32/lib LD_LIBRARY_PATH=/home/karliwalti/.cache/lambdanative/win32/lib CPPFLAGS=-I/home/karliwalti/.cache/lambdanative/win32/include CC="/bin/i686-w64-mingw32-gcc -isysroot -DWIN32 -DWINVER=0x0501 -fcommon -I/home/karliwalti/.cache/lambdanative/win32/include -L/home/karliwalti/.cache/lambdanative/win32/lib" CXX="/bin/i686-w64-mingw32-g++ -isysroot -DWIN32 -DWINVER=0x0501 -fcommon -I/home/karliwalti/.cache/lambdanative/win32/include -L/home/karliwalti/.cache/lambdanative/win32/lib" AR="/bin/i686-w64-mingw32-ar" RANLIB="/bin/i686-w64-mingw32-ranlib" NM="/bin/i686-w64-mingw32-nm" LD="/bin/i686-w64-mingw32-ld" AS="/bin/i686-w64-mingw32-as" CPP="/bin/i686-w64-mingw32-cpp" OBJCOPY="/bin/i686-w64-mingw32-objcopy" STRIP="/bin/i686-w64-mingw32-strip" GPROF="/bin/i686-w64-mingw32-gprof" READELF="/bin/i686-w64-mingw32-readelf" OBJDUMP="/bin/i686-w64-mingw32-objdump" ./configure --prefix=/home/karliwalti/.cache/lambdanative/win32 --host=i686-w64-mingw32 --enable-static --disable-shared --without-png --without-harfbuzz --without-zlib --without-bzip2 --enable-freetype-config
make[1]: Entering directory '/home/karliwalti/.lambdanative/tmp_install/freetype-2.10.1'
FreeType build system -- automatic system detection
The following settings are used:
platform unix
compiler /bin/i686-w64-mingw32-gcc -isysroot -DWIN32 -DWINVER=0x0501 -fcommon -I/home/karliwalti/.cache/lambdanative/win32/include -L/home/karliwalti/.cache/lambdanative/win32/lib
configuration directory ./builds/unix
configuration rules ./builds/unix/unix.mk
If this does not correspond to your system or settings please remove the file
`config.mk' from this directory then read the INSTALL file for help.
Otherwise, simply type `make' again to build the library,
or `make refdoc' to build the API reference (this needs python >= 2.6).
Generating modules list in ./objs/ftmodule.h...
done.
* module: truetype (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1 (Postscript font files with extension *.pfa or *.pfb)
* module: cff (OpenType fonts with extension *.otf)
* module: cid (Postscript CID-keyed fonts, no known extension)
* module: pfr (PFR/TrueDoc font files with extension *.pfr)
* module: type42 (Type 42 font files with no known extension)
* module: winfnt (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf (pcf bitmap fonts)
* module: bdf (bdf bitmap fonts)
* module: sfnt (helper module for TrueType & OpenType formats)
* module: autofit (automatic hinting module)
* module: pshinter (Postscript hinter module)
* module: raster (monochrome bitmap renderer)
* module: smooth (anti-aliased bitmap renderer)
* module: smooth (anti-aliased bitmap renderer for LCDs)
* module: smooth (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux (Postscript Type 1 & Type 2 helper module)
* module: psnames (Postscript & Unicode Glyph name handling)
cd builds/unix; \
./configure '--prefix=/home/karliwalti/.cache/lambdanative/win32' '--host=i686-w64-mingw32' '--enable-static' '--disable-shared' '--without-png' '--without-harfbuzz' '--without-zlib' '--without-bzip2' '--enable-freetype-config'
checking build system type... x86_64-pc-linux-gnu
checking host system type... i686-w64-mingw32
checking for i686-w64-mingw32-gcc... /bin/i686-w64-mingw32-gcc -isysroot -DWIN32 -DWINVER=0x0501 -fcommon -I/home/karliwalti/.cache/lambdanative/win32/include -L/home/karliwalti/.cache/lambdanative/win32/lib
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling...
Tried ./configure DemoUIForm win32;make;
on macOS, which is fine until some later problem with libjpeg
=== using profile PART BC Children's [/Users/mg/Documents/Programming/parts/PROFILE]..
=== configured to build DemoUIForm version 1.1 for win32 on macosx in normal mode
[...]
=> libfreetype..
=> extracting /Users/mg/Library/Caches/lambdanative/packages/freetype-2.11.1.tar.gz..
=> patching source...
=> configuring source in /Users/mg/.lambdanative/tmp_install/freetype-2.11.1 ...
=> compiling source..
=> compiling source..
=> cleaning up..
=> libjpeg..
[...]
checking whether the C compiler (/usr/local/Cellar/mingw-w64/9.0.0_2/toolchain-i686/bin/i686-w64-mingw32-gcc -O3 -isysroot /usr/local/Cellar/mingw-w64/9.0.0_2/toolchain-i686/i686-w64-mingw32 -DWIN32 -DWINVER=0x0501 -fcommon -I/Users/mg/Library/Caches/lambdanative/win32/include -L/Users/mg/Library/Caches/lambdanative/win32/lib -L/Users/mg/Library/Caches/lambdanative/win32/lib) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
Will need to set up a Linux box that has the mingw64 cross-compiler installed - are you using Ubuntu?
On Ubuntu 20.04 libfreetype is also fine, but again libjpeg fails:
mgorges@ECEM01:~/lambdanative$ cat /etc/issue
Ubuntu 20.04.3 LTS \n \l
mgorges@ECEM01:~/lambdanative$ ./configure DemoUIForm win32
make
=== using profile your profile name here [/home/mgorges/lambdanative/PROFILE]..
=== configured to build DemoUIForm version 1.1 for win32 on linux in normal mode
[...]
=> libfreetype..
=> extracting /home/mgorges/.cache/lambdanative/packages/freetype-2.10.1.tar.gz..
=> patching source...
=> configuring source in /home/mgorges/.lambdanative/tmp_install/freetype-2.10.1 ...
=> compiling source..
=> compiling source..
=> cleaning up..
=> libjpeg..
[...]
checking whether the C compiler (/usr/bin/i686-w64-mingw32-gcc -isysroot /usr/i686-w64-mingw32 -DWIN32 -DWINVER=0x0501 -I/home/mgorges/.cache/lambdanative/win32/include -L/home/mgorges/.cache/lambdanative/win32/lib -L/home/mgorges/.cache/lambdanative/win32/lib) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
ERROR: failed with exit code 1
The problem with libjpeg is in line 628 of its (very old) configure
, where the test is if { (eval echo configure:629: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
and that doesn't consider that the executable extension for win32 is .exe
. --> I fixed this with a hack in e9020b2
Thank you for fixing the libjpeg. Still stuck with the freetype which comes earlier. Is there a reason mac takes v 2.11.1 and linux 2.10.1 ?
It was rolled back due to #428 (the merge is in #429)?, but I had left mine on macOS to do more testing? Either works fine for this purpose - I did report that I was not able to reproduce this on Ubuntu 20.04.3 LTS so not quite sure how to help troubleshoot. Maybe you could try some manual configure in the folder that already exists and see which part causes the issue with not detecting something?
I´m also on Ubuntu 20.04.3 LTS, but on WSL2. Seems like there is an issue with paths https://github.com/rdp/ffmpeg-windows-build-helpers/issues/284
I had to add --build=x86_64-unknown-linux-gnu
to the make.sh of libfreetype, libgd and libdmtx.
just in case someone faces similar issues
Is there a way to programatically detect that someone is using Windows Subsystem for Linux, as I didn't think a lot of people use that? If so, we could add this flag to EXTRACONF=
https://github.com/microsoft/WSL/issues/4071#issuecomment-496737093 has an idea that checks if one is running WSL?
My /proc/version contains
Linux version 5.10.60.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Aug 25 23:20:18 UTC 2021
I don´t have a WSL1 installation to check how it looks there.
So I guess a case-insensitive grep for Microsoft in it could work as your WSL2 example had a lower case one while the one I referred to had an uppercase one? https://lifesaver.codes/answer/how-to-tell-in-linux-under-wsl-if-using-wsl1-vs-wsl2-4555 states examples of what the string looks like for both examples?
From these examples, it looks like it could take many forms...
Working with WSL1 for lambdanative likely makes not much sense as the Xsrv can´t be connected easily (I tried a long time ago and abandoned, now with WSL2 this is a trivial step).
So likely it would be sufficient to grep for the WSL2 term?
I can't test this, but could you try if adding something like the snipped below to the respective make.sh for libfreetype, libgd and libdmtx solves it for you? Also, can you confirm that it is only these libraries that need fixing, as otherwise we might want to think about changing the targets/win32/host_linux
or something related to it more globally?
if [ "$SYS_PLATFORM" = "win32" ]; then
if [[ $(grep Microsoft /proc/version) ]]; then
EXTRACONF="$EXTRACONF --build=x86_64-unknown-linux-gnu"
fi
fi
Changed this slightly to ignore case. There were a few more libraries with same issue, see pull request.
Cross compilation fails on LNHealth https://github.com/part-cw/LNhealth/tree/master/apps/LNhealth , specifically all apps that include the module lnhealth with the compilation of libuuid.
I wonder whether this has ever compiled on win32 (cross compilation or not)?
When I include the module uuid directly in an app, all works fine (i.e. the compilation of library for win32 is excluded), but when requested for lnhealth, the exclusion seems to no longer be considered. Likely another, unrelated issue, as libuuid should not be compiled for win32 in the first place: https://github.com/part-cw/lambdanative/blob/e9020b219b05fa9502f4bd27037faa2012964ca0/modules/uuid/LIBRARIES#L1
Just as a quick comment - I merged the pull request but the test with grep outputs an error?
=== using profile PART BC Children's [/Users/mg/Documents/Programming/parts/PROFILE]..
=== configured to build LNHealth version 1.0 for win32 on macosx in normal mode
[...]
=> libfreetype..
=> extracting /Users/mg/Library/Caches/lambdanative/packages/freetype-2.10.1.tar.gz..
=> patching source...
grep: /proc/version: No such file or directory
=> configuring source in /Users/mg/.lambdanative/tmp_install/freetype-2.10.1 ...
Finally your uuid problems comes from a dependency in libraries/libpahomqtt/LIB_DEPENDS but will need to investigate more how to fix that.
Fixed the LNhealth problem in 8e3bc3f. I also learned that >&2 echo $filter
can be used to pipe things to STDERR which is needed as the filter_entries
in make.sh
can't use echo $filter
directly as it breaks otherwise.