Build problems on macOS 11.2.3
After the initial compiling attempt failed due to missing dependencies, I installed the corresponding packages using homebrew.
brew install wasm3
brew install libuv
brew install libffi
Homebrew gives the following message after installing libffi:
libffi is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libffi you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
So I exported it:
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
Although the submodules libffi, libuv and wasm3 are already installed via homebrew and the above environment variables are exported, make still tries to install submodules by itself.
git clone --recursive https://github.com/saghul/txiki.js --shallow-submodules && cd txiki.js
Cloning into 'txiki.js'...
remote: Enumerating objects: 6486, done.
remote: Counting objects: 100% (586/586), done.
remote: Compressing objects: 100% (127/127), done.
remote: Total 6486 (delta 451), reused 562 (delta 447), pack-reused 5900
Receiving objects: 100% (6486/6486), 12.72 MiB | 4.22 MiB/s, done.
Resolving deltas: 100% (4488/4488), done.
Submodule 'deps/libffi' (https://github.com/libffi/libffi) registered for path 'deps/libffi'
Submodule 'deps/libuv' (https://github.com/libuv/libuv) registered for path 'deps/libuv'
Submodule 'deps/wasm3' (https://github.com/saghul/wasm3.git) registered for path 'deps/wasm3'
Cloning into '/Volumes/Development/txiki.js/deps/libffi'...
remote: Enumerating objects: 14823, done.
remote: Counting objects: 100% (53/53), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 14823 (delta 14), reused 43 (delta 13), pack-reused 14770
Receiving objects: 100% (14823/14823), 8.07 MiB | 3.16 MiB/s, done.
Resolving deltas: 100% (9273/9273), done.
Cloning into '/Volumes/Development/txiki.js/deps/libuv'...
remote: Enumerating objects: 35470, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 35470 (delta 5), reused 11 (delta 3), pack-reused 35451
Receiving objects: 100% (35470/35470), 17.04 MiB | 3.40 MiB/s, done.
Resolving deltas: 100% (26213/26213), done.
Cloning into '/Volumes/Development/txiki.js/deps/wasm3'...
remote: Enumerating objects: 9785, done.
remote: Counting objects: 100% (1587/1587), done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 9785 (delta 1525), reused 1457 (delta 1457), pack-reused 8198
Receiving objects: 100% (9785/9785), 5.42 MiB | 3.38 MiB/s, done.
Resolving deltas: 100% (6526/6526), done.
Submodule path 'deps/libffi': checked out 'f9ea41683444ebe11cfa45b05223899764df28fb'
Submodule path 'deps/libuv': checked out '0c1fa696aa502eb749c2c4735005f41ba00a27b8'
Submodule path 'deps/wasm3': checked out '5e8638aa6ad38d7004108390bacb5dbcf0df67c4'
make
[ 64%] Performing install step for 'libffi'
MAKE : 1 * install
Making install in include
/opt/homebrew/bin/gmkdir -p '/Volumes/Development/txiki.js/build/ffi_root/usr/local/include'
/usr/bin/install -c -m 644 ffi.h ffitarget.h '/Volumes/Development/txiki.js/build/ffi_root/usr/local/include'
Making install in testsuite
Making install in man
/opt/homebrew/bin/gmkdir -p '/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/man/man3'
/usr/bin/install -c -m 644 ../../man/ffi.3 ../../man/ffi_call.3 ../../man/ffi_prep_cif.3 ../../man/ffi_prep_cif_var.3 '/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/man/man3'
Making install in doc
/opt/homebrew/bin/gmkdir -p '/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/info'
/usr/bin/install -c -m 644 ../../doc/libffi.info '/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/info'
install-info --info-dir='/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/info' '/Volumes/Development/txiki.js/build/ffi_root/usr/local/share/info/libffi.info'
/opt/homebrew/bin/gmkdir -p '/Volumes/Development/txiki.js/build/ffi_root/usr/local/lib'
/opt/homebrew/bin/gmkdir -p '/Volumes/Development/txiki.js/build/ffi_root/usr/local/lib/pkgconfig'
/bin/sh ./libtool --mode=install /usr/bin/install -c libffi.la '/Volumes/Development/txiki.js/build/ffi_root/usr/local/lib'
/usr/bin/install -c -m 644 libffi.pc '/Volumes/Development/txiki.js/build/ffi_root/usr/local/lib/pkgconfig'
libtool: install: /usr/bin/install -c .libs/libffi.lai /Volumes/Development/txiki.js/build/ffi_root/usr/local/lib/libffi.la
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
make[7]: *** [install-toolexeclibLTLIBRARIES] Error 64
make[6]: *** [install-am] Error 2
make[5]: *** [install-recursive] Error 1
make[4]: *** [install] Error 2
make[3]: *** [libffi-prefix/src/libffi-stamp/libffi-install] Error 2
make[2]: *** [CMakeFiles/libffi.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 66%] Linking C static library libqjs.a
[ 66%] Built target qjs
make[1]: *** [all] Error 2
make: *** [build] Error 2
Any ideas how to instruct make to use the already installed submodules libffi, libuv and wasm3 instead downloading and trying to compile itself again?
The build system is designed to use the embedded libraries rather than the system ones, for the most part.
That said, I haven't seen the error you got before. I wonder if it's related to the libraries you installed. Can you try to uninstall them and retry?
Thanks for the swift reply.
It didn't work in my first attempt. For that reason I've installed libffi with homebrew.
Unfortunately, I cannot uninstall it due to dependencies. But if I remove /opt/homebrew from the path it shouldn't find it.
Any other ideas?
Hum, that's odd! I'll give it a try when I get back to my laptop, I'm AFK for a few more days.
I also encountered the same problem. I think there is something wrong with the script automatically generated when compiling libffi, but I haven't found the root cause. :-(
I am no longer able to test on macOS 11, sorry :-/
I also link my own libffi:
mkdir build; cd build; cmake .. -DUSE_EXTERNAL_FFI=on;
Just tested this on macos 13.5.