How to build glib for iOS x86 simulator on macOS

I try to build glib for iOS simulator.
I create a cross-file:

[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[constants]
sys_config =  ['-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk']
preprocessor_definitions = ['-arch', 'x86_64'] + sys_config

target=['--target=arm64-apple-ios11.0-simulator']

[built-in options]
c_args = [  '-miphoneos-version-min=11.0','-c'] + preprocessor_definitions
cpp_args = ['-stdlib=libc++', '-c', '-miphoneos-version-min=11.0'] + preprocessor_definitions
objc_args = [  '-miphoneos-version-min=11.0'] + preprocessor_definitions
objcpp_args = ['-stdlib=libc++', '-miphoneos-version-min=11.0'] + preprocessor_definitions
c_link_args = [  '-Wl,-iphoneos_version_min,11.0' ] + preprocessor_definitions
cpp_link_args = [  '-Wl,-iphoneos_version_min,11.0'] + preprocessor_definitions
objc_link_args = [  '-Wl,-iphoneos_version_min,11.0'] + preprocessor_definitions
objcpp_link_args = [  '-Wl,-iphoneos_version_min,11.0'] + preprocessor_definitions

[properties]
growing_stack = true
needs_exe_wrapper = true

sizeof_int = 4
sizeof_wchar_t = 4
sizeof_void* = 4

alignment_char = 1
alignment_void* = 4
alignment_double = 4

has_function_printf = true
sys_root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk'

[binaries]
c = ['clang'] + target
cpp = ['clang++'] + target
objc = ['clang'] + target
objcpp = ['clang++'] + target
ar = ['ar'] 
ld = ['ld'] + target
strip = ['strip'] + target

My compile shell

#!/usr/bin/env bash

if [ ! -d "build" ]; then
  mkdir build
else
  rm -rf build
  mkdir build
fi

# ios
meson setup \
  --cross-file "config/ios-simulator.ini" \
  build \
  . \
  -Dprefix="$PWD/install/ios/ios-simulator-x86_64"


# compile
meson compile -C build

# install
meson install -C build

The setup is succes, but the build happen errors:

[88/759] Linking target subprojects/proxy-libintl/libintl.8.dylib
FAILED: subprojects/proxy-libintl/libintl.8.dylib 
clang --target=arm64-apple-ios11.0-simulator  -o subprojects/proxy-libintl/libintl.8.dylib subprojects/proxy-libintl/libintl.8.dylib.p/libintl.c.o -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -shared -install_name @rpath/libintl.8.dylib -compatibility_version 10 -current_version 10.5 -Wl,-iphoneos_version_min,11.0 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
ld: warning: building for iOS/iOS Simulator, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd) built for iOS Simulator
ld: building for iOS/iOS Simulator, but linking in object file built for iOS Simulator, file 'subprojects/proxy-libintl/libintl.8.dylib.p/libintl.c.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[95/759] Compiling C object subprojects/pcre2-10.42/libpcre2-32.a.p/src_pcre2_match.c.o
ninja: build stopped: subcommand failed.
ninja: Entering directory `/Volumes/SanDisk_2T/code/c/libs/glib/glib/build'
[1/665] Linking target subprojects/libffi/src/libffi.7.dylib
FAILED: subprojects/libffi/src/libffi.7.dylib 
clang --target=arm64-apple-ios11.0-simulator  -o subprojects/libffi/src/libffi.7.dylib subprojects/libffi/src/libffi.7.dylib.p/prep_cif.c.o subprojects/libffi/src/libffi.7.dylib.p/types.c.o subprojects/libffi/src/libffi.7.dylib.p/raw_api.c.o subprojects/libffi/src/libffi.7.dylib.p/java_raw_api.c.o subprojects/libffi/src/libffi.7.dylib.p/closures.c.o subprojects/libffi/src/libffi.7.dylib.p/x86_ffi64.c.o subprojects/libffi/src/libffi.7.dylib.p/x86_ffiw64.c.o subprojects/libffi/src/libffi.7.dylib.p/x86_unix64.S.o subprojects/libffi/src/libffi.7.dylib.p/x86_win64.S.o -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -shared -install_name @rpath/libffi.7.dylib -compatibility_version 9 -current_version 9 -Wl,-iphoneos_version_min,11.0 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
ld: warning: building for iOS/iOS Simulator, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd) built for iOS Simulator
ld: building for iOS/iOS Simulator, but linking in object file built for iOS Simulator, file 'subprojects/libffi/src/libffi.7.dylib.p/prep_cif.c.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[5/665] Linking target subprojects/proxy-libintl/libintl.8.dylib
FAILED: subprojects/proxy-libintl/libintl.8.dylib 
clang --target=arm64-apple-ios11.0-simulator  -o subprojects/proxy-libintl/libintl.8.dylib subprojects/proxy-libintl/libintl.8.dylib.p/libintl.c.o -Wl,-dead_strip_dylibs -Wl,-headerpad_max_install_names -Wl,-undefined,error -shared -install_name @rpath/libintl.8.dylib -compatibility_version 10 -current_version 10.5 -Wl,-iphoneos_version_min,11.0 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
ld: warning: building for iOS/iOS Simulator, but linking in .tbd file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libSystem.tbd) built for iOS Simulator
ld: building for iOS/iOS Simulator, but linking in object file built for iOS Simulator, file 'subprojects/proxy-libintl/libintl.8.dylib.p/libintl.c.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[8/665] Generating glib/glib-visibility.h with a custom command
ninja: build stopped: subcommand failed.
Could not rebuild /Volumes/SanDisk_2T/code/c/libs/glib/glib/build

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.