Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crosscompiling shared library on macos #68

Closed
sbarex opened this issue Dec 31, 2021 · 7 comments
Closed

crosscompiling shared library on macos #68

sbarex opened this issue Dec 31, 2021 · 7 comments

Comments

@sbarex
Copy link

sbarex commented Dec 31, 2021

I try to crosscompile the shared library on macOS. My system uses an Intel processor and I want to compile for arm.

When I pass the --host argument to configure the shared library creation will be disabled:

$ ./configure --enable-jit --enable-pcre2-32 --disable-pcre2-8 --prefix=/Users/sbarex/Downloads/pcre2-32 --host arm64-apple-macos11 --enable-shared --disable-static

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm64-apple-macos11-strip... no
checking for strip... strip
checking for a race-free mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for arm64-apple-macos11-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for arm64-apple-macos11-ar... no
checking for arm64-apple-macos11-lib... no
checking for arm64-apple-macos11-link... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking for int64_t... yes
checking build system type... x86_64-apple-darwin21.2.0
checking host system type... aarch64-apple-macos11
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm64-apple-macos11-dumpbin... no
checking for arm64-apple-macos11-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert x86_64-apple-darwin21.2.0 file names to aarch64-apple-macos11 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin21.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for arm64-apple-macos11-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... unknown
checking for arm64-apple-macos11-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm64-apple-macos11-ar... ar
checking for archiver @FILE support... no
checking for arm64-apple-macos11-strip... strip
checking for arm64-apple-macos11-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for arm64-apple-macos11-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... unsupported
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking for __attribute__((uninitialized))... yes
checking for limits.h... yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for dirent.h... yes
checking for windows.h... no
checking for sys/wait.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for bcopy... yes
checking for memfd_create... no
checking for memmove... yes
checking for mkostemp... yes
checking for realpath... yes
checking for secure_getenv... no
checking for strerror... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking for bzlib.h... yes
checking for libbz2... yes
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking whether Intel CET is enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpcre2-8.pc
config.status: creating libpcre2-16.pc
config.status: creating libpcre2-32.pc
config.status: creating libpcre2-posix.pc
config.status: creating pcre2-config
config.status: creating src/pcre2.h
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing script-chmod commands
config.status: executing delete-old-chartables commands

pcre2-10.39 configuration summary:

    Install prefix ..................... : /Users/sbarex/Downloads/pcre2-32
    C preprocessor ..................... : 
    C compiler ......................... : gcc
    Linker ............................. : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    C preprocessor flags ............... : 
    C compiler flags ................... :  -O2 -fvisibility=hidden
    Linker flags ....................... : 
    Extra libraries .................... :  

    Build 8-bit pcre2 library .......... : no
    Build 16-bit pcre2 library ......... : no
    Build 32-bit pcre2 library ......... : yes
    Include debugging code ............. : no
    Enable JIT compiling support ....... : yes
    Use SELinux allocator in JIT ....... : unsupported
    Enable Unicode support ............. : yes
    Newline char/sequence .............. : lf
    \R matches only ANYCRLF ............ : no
    \C is disabled ..................... : no
    EBCDIC coding ...................... : no
    EBCDIC code for NL ................. : n/a
    Rebuild char tables ................ : no
    Internal link size ................. : 2
    Nested parentheses limit ........... : 250
    Heap limit ......................... : 20000000 kibibytes
    Match limit ........................ : 10000000
    Match depth limit .................. : MATCH_LIMIT
    Build shared libs .................. : no
    Build static libs .................. : yes
    Use JIT in pcre2grep ............... : yes
    Enable callouts in pcre2grep ....... : yes
    Enable fork in pcre2grep callouts .. : yes
    Initial buffer size for pcre2grep .. : 20480
    Maximum buffer size for pcre2grep .. : 1048576
    Link pcre2grep with libz ........... : no
    Link pcre2grep with libbz2 ......... : no
    Link pcre2test with libedit ........ : no
    Link pcre2test with libreadline .... : no
    Valgrind support ................... : no
    Code coverage ...................... : no
    Fuzzer support ..................... : no
    Use %zu and %td .................... : auto

Also if i try to configure an host with the same CPU architecture (like x86_64-apple-macos10.15) the shared library cannot be created.

If I remove the --host argument the shared library is build (for current arch):

$ ./configure --enable-jit --enable-pcre2-32 --disable-pcre2-8 --prefix=/Users/sbarex/Downloads/pcre2-32 -enable-shared --disable-static

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for ar... ar
checking the archiver (ar) interface... ar
checking for int64_t... yes
checking build system type... x86_64-apple-darwin21.2.0
checking host system type... x86_64-apple-darwin21.2.0
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert x86_64-apple-darwin21.2.0 file names to x86_64-apple-darwin21.2.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin21.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin21.2.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking whether ln -s works... yes
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking for __attribute__((uninitialized))... yes
checking for limits.h... yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for dirent.h... yes
checking for windows.h... no
checking for sys/wait.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for bcopy... yes
checking for memfd_create... no
checking for memmove... yes
checking for mkostemp... yes
checking for realpath... yes
checking for secure_getenv... no
checking for strerror... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking for bzlib.h... yes
checking for libbz2... yes
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking for PTHREAD_PRIO_INHERIT... yes
checking whether Intel CET is enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpcre2-8.pc
config.status: creating libpcre2-16.pc
config.status: creating libpcre2-32.pc
config.status: creating libpcre2-posix.pc
config.status: creating pcre2-config
config.status: creating src/pcre2.h
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing script-chmod commands
config.status: executing delete-old-chartables commands

pcre2-10.39 configuration summary:

    Install prefix ..................... : /Users/sbarex/Downloads/pcre2-32
    C preprocessor ..................... : 
    C compiler ......................... : gcc
    Linker ............................. : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    C preprocessor flags ............... : 
    C compiler flags ................... : -D_THREAD_SAFE -pthread -O2 -fvisibility=hidden
    Linker flags ....................... : 
    Extra libraries .................... :  

    Build 8-bit pcre2 library .......... : no
    Build 16-bit pcre2 library ......... : no
    Build 32-bit pcre2 library ......... : yes
    Include debugging code ............. : no
    Enable JIT compiling support ....... : yes
    Use SELinux allocator in JIT ....... : unsupported
    Enable Unicode support ............. : yes
    Newline char/sequence .............. : lf
    \R matches only ANYCRLF ............ : no
    \C is disabled ..................... : no
    EBCDIC coding ...................... : no
    EBCDIC code for NL ................. : n/a
    Rebuild char tables ................ : no
    Internal link size ................. : 2
    Nested parentheses limit ........... : 250
    Heap limit ......................... : 20000000 kibibytes
    Match limit ........................ : 10000000
    Match depth limit .................. : MATCH_LIMIT
    Build shared libs .................. : yes
    Build static libs .................. : no
    Use JIT in pcre2grep ............... : yes
    Enable callouts in pcre2grep ....... : yes
    Enable fork in pcre2grep callouts .. : yes
    Initial buffer size for pcre2grep .. : 20480
    Maximum buffer size for pcre2grep .. : 1048576
    Link pcre2grep with libz ........... : no
    Link pcre2grep with libbz2 ......... : no
    Link pcre2test with libedit ........ : no
    Link pcre2test with libreadline .... : no
    Valgrind support ................... : no
    Code coverage ...................... : no
    Fuzzer support ..................... : no
    Use %zu and %td .................... : auto
@zherczeg
Copy link
Collaborator

checking if libtool supports shared libraries... no
It runs some command and that fails. I don't remember the details but I had issues with this tool (on Linux with another project, and I wanted static, not shared).

@sbarex
Copy link
Author

sbarex commented Dec 31, 2021

checking if libtool supports shared libraries... no It runs some command and that fails. I don't remember the details but I had issues with this tool (on Linux with another project, and I wanted static, not shared).

Yes, but without the --host argument libtool can create a shared library.

Also with several other projects I can use configure --host to create a shared library.

The strange is if I use the same architecture for the host as my cpu and the shared library cannot be created anyway.

@zherczeg
Copy link
Collaborator

Try to find the libtool command with its arguments which fails. It is likely that one argument is invalid, and that cause the fail. Then figure out something to change (or remove) that argument.

@carenas
Copy link
Contributor

carenas commented Jan 2, 2022

need to also pass the correct target to the compiler since Apple clang is a "native" cross compiler:

./configure CFLAGS='-target arm64-apple-macos' --host=arm64-apple-darwin

@sbarex
Copy link
Author

sbarex commented Jan 2, 2022

I try with this configure:

./configure --enable-jit --enable-pcre2-32 --disable-pcre2-8 --prefix=/Users/sbarex/Downloads/pcre2-32 CFLAGS='-target arm64-apple-macos' LDFLAGS='-target arm64-apple-macos' --host=arm64-apple-darwin

This is the ouput:

checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for arm64-apple-darwin-strip... no
checking for strip... strip
checking for a race-free mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for arm64-apple-darwin-gcc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for wchar.h... yes
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether _XOPEN_SOURCE should be defined... no
checking for arm64-apple-darwin-ar... no
checking for arm64-apple-darwin-lib... no
checking for arm64-apple-darwin-link... no
checking for ar... ar
configure: WARNING: using cross tools not prefixed with host triplet
checking the archiver (ar) interface... ar
checking for int64_t... yes
checking build system type... x86_64-apple-darwin21.2.0
checking host system type... aarch64-apple-darwin
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... no
checking for arm64-apple-darwin-dumpbin... no
checking for arm64-apple-darwin-link... no
checking for dumpbin... no
checking for link... link -dump
checking the name lister (nm) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert x86_64-apple-darwin21.2.0 file names to aarch64-apple-darwin format... func_convert_file_noop
checking how to convert x86_64-apple-darwin21.2.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for arm64-apple-darwin-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for arm64-apple-darwin-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for arm64-apple-darwin-ar... ar
checking for archiver @FILE support... no
checking for arm64-apple-darwin-strip... strip
checking for arm64-apple-darwin-ranlib... no
checking for ranlib... ranlib
checking command to parse nm output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for arm64-apple-darwin-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for arm64-apple-darwin-dsymutil... no
checking for dsymutil... dsymutil
checking for arm64-apple-darwin-nmedit... no
checking for nmedit... nmedit
checking for arm64-apple-darwin-lipo... no
checking for lipo... lipo
checking for arm64-apple-darwin-otool... no
checking for otool... otool
checking for arm64-apple-darwin-otool64... no
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking whether the -Werror option is usable... yes
checking for simple visibility declarations... yes
checking for __attribute__((uninitialized))... yes
checking for limits.h... yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for dirent.h... yes
checking for windows.h... no
checking for sys/wait.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking for bcopy... yes
checking for memfd_create... no
checking for memmove... yes
checking for mkostemp... yes
checking for secure_getenv... no
checking for strerror... yes
checking for realpath... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking for bzlib.h... yes
checking for libbz2... yes
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking for PTHREAD_PRIO_INHERIT... yes
checking whether Intel CET is enabled... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpcre2-8.pc
config.status: creating libpcre2-16.pc
config.status: creating libpcre2-32.pc
config.status: creating libpcre2-posix.pc
config.status: creating pcre2-config
config.status: creating src/pcre2.h
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing script-chmod commands
config.status: executing delete-old-chartables commands

pcre2-10.40-RC1 configuration summary:

    Install prefix ..................... : /Users/sbarex/Downloads/pcre2-32
    C preprocessor ..................... : 
    C compiler ......................... : gcc
    Linker ............................. : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    C preprocessor flags ............... : 
    C compiler flags ................... : -D_THREAD_SAFE -pthread -target arm64-apple-macos -fvisibility=hidden
    Linker flags ....................... : -target arm64-apple-macos
    Extra libraries .................... :  

    Build 8-bit pcre2 library .......... : no
    Build 16-bit pcre2 library ......... : no
    Build 32-bit pcre2 library ......... : yes
    Include debugging code ............. : no
    Enable JIT compiling support ....... : yes
    Use SELinux allocator in JIT ....... : unsupported
    Enable Unicode support ............. : yes
    Newline char/sequence .............. : lf
    \R matches only ANYCRLF ............ : no
    \C is disabled ..................... : no
    EBCDIC coding ...................... : no
    EBCDIC code for NL ................. : n/a
    Rebuild char tables ................ : no
    Internal link size ................. : 2
    Nested parentheses limit ........... : 250
    Heap limit ......................... : 20000000 kibibytes
    Match limit ........................ : 10000000
    Match depth limit .................. : MATCH_LIMIT
    Build shared libs .................. : yes
    Build static libs .................. : yes
    Use JIT in pcre2grep ............... : yes
    Enable callouts in pcre2grep ....... : yes
    Enable fork in pcre2grep callouts .. : yes
    Initial buffer size for pcre2grep .. : 20480
    Maximum buffer size for pcre2grep .. : 1048576
    Link pcre2grep with libz ........... : no
    Link pcre2grep with libbz2 ......... : no
    Link pcre2test with libedit ........ : no
    Link pcre2test with libreadline .... : no
    Valgrind support ................... : no
    Code coverage ...................... : no
    Fuzzer support ..................... : no
    Use %zu and %td .................... : auto

Then when i make:

$ make

rm -f src/pcre2_chartables.c
ln -s /Users/sbarex/Downloads/pcre2/src/pcre2_chartables.c.dist /Users/sbarex/Downloads/pcre2/src/pcre2_chartables.c
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
  CC       src/pcre2test-pcre2test.o
  CC       src/libpcre2_32_la-pcre2_auto_possess.lo
  CC       src/libpcre2_32_la-pcre2_compile.lo
  CC       src/libpcre2_32_la-pcre2_config.lo
  CC       src/libpcre2_32_la-pcre2_context.lo
  CC       src/libpcre2_32_la-pcre2_convert.lo
  CC       src/libpcre2_32_la-pcre2_dfa_match.lo
  CC       src/libpcre2_32_la-pcre2_error.lo
  CC       src/libpcre2_32_la-pcre2_extuni.lo
  CC       src/libpcre2_32_la-pcre2_find_bracket.lo
  CC       src/libpcre2_32_la-pcre2_jit_compile.lo
  CC       src/libpcre2_32_la-pcre2_maketables.lo
  CC       src/libpcre2_32_la-pcre2_match.lo
  CC       src/libpcre2_32_la-pcre2_match_data.lo
  CC       src/libpcre2_32_la-pcre2_newline.lo
  CC       src/libpcre2_32_la-pcre2_ord2utf.lo
  CC       src/libpcre2_32_la-pcre2_pattern_info.lo
  CC       src/libpcre2_32_la-pcre2_script_run.lo
  CC       src/libpcre2_32_la-pcre2_serialize.lo
  CC       src/libpcre2_32_la-pcre2_string_utils.lo
  CC       src/libpcre2_32_la-pcre2_study.lo
  CC       src/libpcre2_32_la-pcre2_substitute.lo
  CC       src/libpcre2_32_la-pcre2_substring.lo
  CC       src/libpcre2_32_la-pcre2_tables.lo
  CC       src/libpcre2_32_la-pcre2_ucd.lo
  CC       src/libpcre2_32_la-pcre2_valid_utf.lo
  CC       src/libpcre2_32_la-pcre2_xclass.lo
  CC       src/libpcre2_32_la-pcre2_chartables.lo
  CCLD     libpcre2-32.la
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_compile.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_auto_possess.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_config.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_convert.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_context.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_error.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_dfa_match.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_extuni.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_find_bracket.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_maketables.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_jit_compile.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_match.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64ld: warning: ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_ord2utf.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ignoring file src/.libs/libpcre2_32_la-pcre2_match_data.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_newline.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_pattern_info.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64

ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_script_run.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_serialize.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_string_utils.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_substitute.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_tables.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_ucd.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_study.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_xclass.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_chartables.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_valid_utf.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64

ignoring file src/.libs/libpcre2_32_la-pcre2_substring.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
  CCLD     pcre2test
ld: warning: ignoring file ./.libs/libpcre2-32.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "_pcre2_callout_enumerate_32", referenced from:
      _show_pattern_info in pcre2test-pcre2test.o
  "_pcre2_code_copy_32", referenced from:
      _process_command in pcre2test-pcre2test.o
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_code_copy_with_tables_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_code_free_32", referenced from:
      _main in pcre2test-pcre2test.o
      _process_command in pcre2test-pcre2test.o
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_compile_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_compile_context_copy_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_compile_context_create_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_compile_context_free_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_config_32", referenced from:
      _main in pcre2test-pcre2test.o
      _c_option in pcre2test-pcre2test.o
      _process_command in pcre2test-pcre2test.o
  "_pcre2_convert_context_copy_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_convert_context_create_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_convert_context_free_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_converted_pattern_free_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_dfa_match_32", referenced from:
      _process_data in pcre2test-pcre2test.o
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_general_context_copy_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_general_context_create_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_general_context_free_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_get_error_message_32", referenced from:
      _main in pcre2test-pcre2test.o
      _print_error_message in pcre2test-pcre2test.o
  "_pcre2_get_match_data_size_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_get_ovector_count_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_get_startchar_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_jit_compile_32", referenced from:
      _process_command in pcre2test-pcre2test.o
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_jit_free_unused_memory_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_jit_match_32", referenced from:
      _process_data in pcre2test-pcre2test.o
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_jit_stack_assign_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_jit_stack_create_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_jit_stack_free_32", referenced from:
      _main in pcre2test-pcre2test.o
      _process_data in pcre2test-pcre2test.o
  "_pcre2_maketables_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_match_32", referenced from:
      _process_data in pcre2test-pcre2test.o
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_match_context_copy_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_match_context_create_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_match_context_free_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_match_data_create_32", referenced from:
      _main in pcre2test-pcre2test.o
      _process_data in pcre2test-pcre2test.o
  "_pcre2_match_data_create_from_pattern_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_match_data_free_32", referenced from:
      _main in pcre2test-pcre2test.o
      _process_data in pcre2test-pcre2test.o
  "_pcre2_pattern_convert_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_pattern_info_32", referenced from:
      _show_pattern_info in pcre2test-pcre2test.o
      _pattern_info in pcre2test-pcre2test.o
  "_pcre2_serialize_decode_32", referenced from:
      _process_command in pcre2test-pcre2test.o
  "_pcre2_serialize_encode_32", referenced from:
      _process_command in pcre2test-pcre2test.o
  "_pcre2_serialize_free_32", referenced from:
      _process_command in pcre2test-pcre2test.o
  "_pcre2_serialize_get_number_of_codes_32", referenced from:
      _process_command in pcre2test-pcre2test.o
  "_pcre2_set_bsr_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_callout_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_set_character_tables_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_set_compile_extra_options_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_compile_recursion_guard_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_set_depth_limit_32", referenced from:
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_set_glob_escape_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_set_glob_separator_32", referenced from:
      _process_pattern in pcre2test-pcre2test.o
  "_pcre2_set_heap_limit_32", referenced from:
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_set_match_limit_32", referenced from:
      _check_match_limit in pcre2test-pcre2test.o
  "_pcre2_set_max_pattern_length_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_newline_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_offset_limit_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_parens_nest_limit_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_recursion_memory_management_32", referenced from:
      _main in pcre2test-pcre2test.o
  "_pcre2_set_substitute_callout_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_substitute_32", referenced from:
      _process_data in pcre2test-pcre2test.o
  "_pcre2_substring_copy_byname_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_copy_bynumber_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_free_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_get_byname_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_get_bynumber_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_length_byname_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_length_bynumber_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_list_free_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_list_get_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
  "_pcre2_substring_number_from_name_32", referenced from:
      _copy_and_get in pcre2test-pcre2test.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [pcre2test] Error 1
make: *** [all] Error 2

@carenas
Copy link
Contributor

carenas commented Jan 2, 2022

ld: warning: ignoring file src/.libs/libpcre2_32_la-pcre2_compile.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64

this most likely means that it is trying to link with an x86_64 library instead of the apple silicon one you should provide in your crosslinking worktree.

either way, I don't think this is a PCRE specific problem and the following seems to work fine for me with the latest release in an intel macOS 11 system:

$ uname -m
x86_64
$ ./configure CC='cc -target arm64-apple-macos' --host=aarch64-apple-darwin
...
$ file .libs/libpcre2-8.dylib
.libs/libpcre2-8.dylib: Mach-O 64-bit dynamically linked shared library arm64

@sbarex
Copy link
Author

sbarex commented Jan 2, 2022

Thanks!
Settings cc as C compiler finally works! Without the CC env the configure instead adopt gcc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants