Fix autotools dependency configure failures on newer Xcode toolchains (#1505)
* Fix autotools dependency configure failures on newer Xcode toolchains On recent Xcode toolchains, CMAKE_C_COMPILER can resolve to the raw absolute path inside XcodeDefault.xctoolchain rather than /usr/bin/cc or `xcrun cc`. When hamlib/lame/mpg123's own ./configure invokes that compiler to check it works, the driver no longer auto-discovers the default SDK and linking fails with "ld: library 'System' not found", breaking any full/clean build that builds these deps from source (BOOTSTRAP_WXWIDGETS / USE_STATIC_SNDFILE, or a missing system hamlib). Pass -isysroot explicitly via a shared EXTERNAL_PROJECT_APPLE_ISYSROOT variable to fix this, mirroring the same fix already applied to the RNNoise build in the freedv-backend repo (tmiw/freedv-backend#59). Also adds the -mmacosx-version-min=11.0/CFLAGS previously missing from the non-universal (BUILD_OSX_UNIVERSAL=0) branches of BuildLame.cmake and BuildMpg123.cmake, matching the flags already used in their universal-build branches and in BuildHamlib.cmake -- without any CFLAGS at all there, the same raw-CC-path SDK lookup failure hit those configure invocations regardless of deployment target. freedv-gui's own CMAKE_OSX_DEPLOYMENT_TARGET was already 11.0 (CMakeLists.txt), so no version bump was needed here. Verified by forcing source builds of hamlib, lame, and mpg123 (USE_STATIC_SNDFILE=1, hamlib not found on system) from a clean build directory: hamlib and mpg123 now configure and build successfully. lame's ./configure now succeeds too; its build fails for an unrelated, pre-existing reason -- LAME 3.100's bundled mpg123.h macro-redefines memcpy() via bcopy() without including <strings.h>, which newer Clang now treats as a hard error (implicit-function-declaration) instead of a warning. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BRyLXHuZHy1b9oLt4wJFi * Also pass -isysroot via CPPFLAGS to fix LAME build under newer Xcode The previous commit fixed autoconf's compiler-works check by passing -isysroot via CFLAGS/CXXFLAGS, but autoconf determines its own CPP command ("checking how to run the C preprocessor") as plain "$CC -E", independent of CFLAGS. Header checks that go through CPP directly (e.g. AC_HEADER_STDC's AC_EGREP_HEADER calls) therefore still failed to find SDK headers, silently reporting STDC_HEADERS as undefined even though string.h/stdlib.h etc. are all present. For LAME specifically, this broke the build: its bundled mpglib/ mpg123.h only includes <string.h> under "#ifdef STDC_HEADERS" -- otherwise it falls back to K&R-style declarations and redefines memcpy()/memset() via bcopy() without a prototype, which newer Clang now treats as a hard error (implicit-function-declaration) instead of a warning, so the fallback path no longer compiles at all. Passing -isysroot via CPPFLAGS as well fixes CPP-based checks the same way CFLAGS fixed compiler-based ones, so STDC_HEADERS is correctly defined and the broken legacy fallback path in LAME's mpg123.h is never taken. LAME itself has had no upstream release since 3.100 (2017) to upgrade to; MacPorts still packages 3.100 with unrelated patches, so fixing the build here is the only option short of switching encoders. Verified by forcing source builds of hamlib, lame, and mpg123 from a clean build directory: all three now configure and build successfully end-to-end (previously lame's build step failed on the bcopy/ memcpy issue described above). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017BRyLXHuZHy1b9oLt4wJFi * [skip ci] Add PR #1505 to changelog. --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>ms-stop-rx-file-before-tx
parent
50de1b6ebb
commit
c4ec703b73
|
|
@ -964,7 +964,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes
|
|||
* Various data race cleanups. (PR #1502)
|
||||
2. Build system:
|
||||
* Windows versions are now built with llvm-mingw 20260908 (PR #1489)
|
||||
* Ccache support extended to third party dependencies. (PR #1498)
|
||||
* Ccache support extended to third party dependencies. (PR #1498, #1505))
|
||||
3. Other:
|
||||
* Waterfall and other plot performance improvements. (PR #1481)
|
||||
* Windows audio thread timing improvements. (PR #1488)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ else(MINGW AND CMAKE_CROSSCOMPILING)
|
|||
set(HAMLIB_PATCH_CMD "")
|
||||
if(APPLE)
|
||||
if(BUILD_OSX_UNIVERSAL)
|
||||
set(CONFIGURE_COMMAND ./configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist --without-cxx-binding --without-libusb CC=${EXTERNAL_PROJECT_CC} CXX=${EXTERNAL_PROJECT_CXX} CFLAGS=-g\ -O3\ -mmacosx-version-min=11.0\ -arch\ x86_64\ -arch\ arm64 CXXFLAGS=-g\ -O3\ -mmacosx-version-min=11.0\ -arch\ x86_64\ -arch\ arm64)
|
||||
set(CONFIGURE_COMMAND ./configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist --without-cxx-binding --without-libusb CC=${EXTERNAL_PROJECT_CC} CXX=${EXTERNAL_PROJECT_CXX} CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -g\ -O3\ -mmacosx-version-min=11.0\ -arch\ x86_64\ -arch\ arm64 CXXFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -g\ -O3\ -mmacosx-version-min=11.0\ -arch\ x86_64\ -arch\ arm64)
|
||||
else()
|
||||
set(CONFIGURE_COMMAND ./configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist --without-cxx-binding --without-libusb CC=${EXTERNAL_PROJECT_CC} CXX=${EXTERNAL_PROJECT_CXX} CFLAGS=-g\ -O3\ -mmacosx-version-min=11.0 CXXFLAGS=-g\ -O3\ -mmacosx-version-min=11.0)
|
||||
set(CONFIGURE_COMMAND ./configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist --without-cxx-binding --without-libusb CC=${EXTERNAL_PROJECT_CC} CXX=${EXTERNAL_PROJECT_CXX} CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -g\ -O3\ -mmacosx-version-min=11.0 CXXFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -g\ -O3\ -mmacosx-version-min=11.0)
|
||||
endif(BUILD_OSX_UNIVERSAL)
|
||||
else()
|
||||
set(CONFIGURE_COMMAND ./configure --enable-shared --prefix=${CMAKE_BINARY_DIR}/external/dist --without-cxx-binding --without-libusb CC=${EXTERNAL_PROJECT_CC} CXX=${EXTERNAL_PROJECT_CXX})
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ if(APPLE AND BUILD_OSX_UNIVERSAL)
|
|||
ExternalProject_Add(build_mp3lame_x86
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP NO
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=x86_64-apple-darwin --target=x86_64-apple-darwin CFLAGS=-arch\ x86_64\ -O3\ -mmacosx-version-min=11.0
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=x86_64-apple-darwin --target=x86_64-apple-darwin CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -arch\ x86_64\ -O3\ -mmacosx-version-min=11.0
|
||||
BUILD_COMMAND $(MAKE) && $(MAKE) install
|
||||
INSTALL_COMMAND ""
|
||||
URL ${LAME_URL}
|
||||
|
|
@ -25,7 +25,7 @@ ExternalProject_Add(build_mp3lame_x86
|
|||
ExternalProject_Add(build_mp3lame_arm
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP NO
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=aarch64-apple-darwin --target=aarch64-apple-darwin CFLAGS=-arch\ arm64\ -O3\ -mmacosx-version-min=11.0
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=aarch64-apple-darwin --target=aarch64-apple-darwin CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -arch\ arm64\ -O3\ -mmacosx-version-min=11.0
|
||||
BUILD_COMMAND $(MAKE) && $(MAKE) install
|
||||
INSTALL_COMMAND ""
|
||||
URL ${LAME_URL}
|
||||
|
|
@ -53,6 +53,9 @@ set_target_properties(mp3lame PROPERTIES
|
|||
)
|
||||
|
||||
else(APPLE AND BUILD_OSX_UNIVERSAL)
|
||||
if(APPLE)
|
||||
set(CONFIGURE_COMMAND ${CONFIGURE_COMMAND} CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -O3\ -mmacosx-version-min=11.0)
|
||||
endif(APPLE)
|
||||
ExternalProject_Add(build_mp3lame
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ if(APPLE AND BUILD_OSX_UNIVERSAL)
|
|||
ExternalProject_Add(build_mpg123_x86
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP NO
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=x86_64-apple-darwin --target=x86_64-apple-darwin CFLAGS=-arch\ x86_64\ -O3\ -mmacosx-version-min=11.0
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=x86_64-apple-darwin --target=x86_64-apple-darwin CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -arch\ x86_64\ -O3\ -mmacosx-version-min=11.0
|
||||
BUILD_COMMAND $(MAKE) && $(MAKE) install
|
||||
INSTALL_COMMAND ""
|
||||
URL ${MPG123_URL}
|
||||
|
|
@ -25,7 +25,7 @@ ExternalProject_Add(build_mpg123_x86
|
|||
ExternalProject_Add(build_mpg123_arm
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP NO
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=aarch64-apple-darwin --target=aarch64-apple-darwin CFLAGS=-arch\ arm64\ -O3\ -mmacosx-version-min=11.0
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND} --host=aarch64-apple-darwin --target=aarch64-apple-darwin CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -arch\ arm64\ -O3\ -mmacosx-version-min=11.0
|
||||
BUILD_COMMAND $(MAKE) && $(MAKE) install
|
||||
INSTALL_COMMAND ""
|
||||
URL ${MPG123_URL}
|
||||
|
|
@ -53,6 +53,9 @@ set_target_properties(mpg123 PROPERTIES
|
|||
)
|
||||
|
||||
else(APPLE AND BUILD_OSX_UNIVERSAL)
|
||||
if(APPLE)
|
||||
set(CONFIGURE_COMMAND ${CONFIGURE_COMMAND} CPPFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT} CFLAGS=${EXTERNAL_PROJECT_APPLE_ISYSROOT}\ -O3\ -mmacosx-version-min=11.0)
|
||||
endif(APPLE)
|
||||
ExternalProject_Add(build_mpg123
|
||||
BUILD_IN_SOURCE 1
|
||||
CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
|
||||
|
|
|
|||
|
|
@ -26,3 +26,26 @@ if(CMAKE_CXX_COMPILER_LAUNCHER)
|
|||
else()
|
||||
set(EXTERNAL_PROJECT_CXX "${CMAKE_CXX_COMPILER}")
|
||||
endif()
|
||||
|
||||
# CMAKE_C_COMPILER/CMAKE_CXX_COMPILER above can resolve to the Xcode
|
||||
# toolchain's raw absolute cc/c++ path (inside XcodeDefault.xctoolchain)
|
||||
# rather than /usr/bin/cc or `xcrun cc`. autoconf's own compiler-works check
|
||||
# invokes that path directly, without going through xcrun, so it doesn't
|
||||
# auto-discover the default SDK and fails with "ld: library 'System' not
|
||||
# found". Pass -isysroot explicitly via CFLAGS/CXXFLAGS so these
|
||||
# dependencies' ./configure can actually link its test program.
|
||||
#
|
||||
# Separately, autoconf determines its own CPP command ("checking how to run
|
||||
# the C preprocessor") as plain "$CC -E", without CFLAGS -- so header checks
|
||||
# that go through CPP directly (e.g. AC_HEADER_STDC's AC_EGREP_HEADER calls)
|
||||
# still can't find SDK headers even once CFLAGS above is fixed. Callers must
|
||||
# also pass this via CPPFLAGS, or those checks silently report headers/
|
||||
# functions as missing (e.g. STDC_HEADERS ends up undefined even though
|
||||
# string.h etc. are all present) and dependents can hit obscure build
|
||||
# failures as a result (e.g. old K&R-style fallback code paths that assume
|
||||
# an ANSI-less libc and don't compile under a modern, strict C compiler).
|
||||
if(APPLE AND CMAKE_OSX_SYSROOT)
|
||||
set(EXTERNAL_PROJECT_APPLE_ISYSROOT -isysroot\ ${CMAKE_OSX_SYSROOT})
|
||||
else()
|
||||
set(EXTERNAL_PROJECT_APPLE_ISYSROOT "")
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Reference in New Issue