-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[iOS] Configure script does not support miphonesimulator-version-min
or other possibilities
#6838
Comments
To make it work with -miphonesimulator-version-min and others. Reported-by: manuyavuz-pointr on github Fixes #6838
Hi @bagder, I think this solution won't be generic enough. Currently, curl's configure script does a very strict assumption about the host and sets However, clang itself could infer deployment target from various sources as can be seen in the function here: The ordering of sources is here: Basically, clang infers deployment target with the following order:
Due to current behavior, it's not possible to build for ios/tvos/watchos or their simulator variants unless you provide Therefore, I think this default Once these are fixed, compiling for ios or similar platforms will be very simple as follows: xcrun -sdk $SDK_NAME ./configure --host $ARCH-apple-darwin
xcrun -sdk $SDK_NAME make And if someone needs a custom minimum deployment target, the change is as follows: xcrun -sdk $SDK_NAME ./configure --host $ARCH-apple-darwin
# either this
$($PLATFORM)-DEPLOYMENT_TARGET=$MIN_VERSION xcrun -sdk $SDK_NAME make
# or this
CFLAGS='-m${PLATFORM}-version-min=$MIN_VERSION' xcrun -sdk $SDK_NAME make If proposed solution is good for you, I can open a PR with the changes, along with updated documentation for building for ios/tvos/watchos platforms. |
I really don't know this stuff. It sounds fine and reasonable to me but I don't know details or specifics to tell if there are any flaws in this approach. Go ahead! |
Hey, I can definitely help, but we need to decide what policy will be used for Darwin platforms.
I suggest the option 1. Others would require having a check if min version has been added by user manually, and adding it if it's not. And still, it would break developer's expectation if developer just wants to build with the compiler default min version behavior. Also, they would require maintenance operations in future (new possible sdk platforms, breaking deployment version changes in new releases etc.). I have checked the original issue causing this default min version addition: The problem there was that the developer was supposed to add a deployment target that he wants to support. In Xcode for example, if you don't do anything, it gives you the highest possible deployment target (14.4 if your SDK version is 14.4), and you are supposed to change it if needed. So it should not be a problem. If wanted, configure script can warn user if they did not set any deployment target, but that should be all I think. Btw, @bagder if you are ok with this, I will do required changes. |
/cc @mstorsjo any feedback? I believe you were involved when this logic was added back in 2016. |
I think it should be fairly safe to remove this bit indeed. We're pretty far past that particular transition, so making default builds rely on things from 10.12 (from 2016) if they don't explicitly set the deployment target probably is uncontroversial at this point. Anybody wanting to target an older version needs to make sure to set the minimum deployment version explicitly, which isn't unresonable at this point. |
Ok then, I will be keeping |
sounds excellent! |
I did this
CFLAGS='-Os -arch x86_64 -miphonesimulator-version-min=10.0 -isysroot /Applications/Xcode-11.3.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk' ./configure --host=x86_64-apple-darwin --with-darwinssl --enable-static --disable-shared --enable-threaded-resolver --disable-verbose --enable-ipv6
I get the following result:
Click to see `./configure` output
``` ./configure --prefix=/Users/pointr/manuyavuz/core-bootstrap/core-dependencies/build/curl/iossimulator/x86_64 --host=x86_64-apple-darwin --with-darwinssl --enable-static --disable-shared --enable-threaded-resolver --disable-verbose --enable-ipv6 checking whether to enable maintainer-specific portions of Makefiles... no checking whether make supports nested variables... yes checking whether to enable debug build options... no checking whether to enable compiler optimizer... (assumed) yes checking whether to enable strict compiler warnings... no checking whether to enable compiler warnings as errors... no checking whether to enable curl debug memory tracking... no checking whether to enable hiding of library internal symbols... yes checking whether to enable c-ares for DNS lookups... no checking whether to disable dependency on -lrt... (assumed no) checking for path separator... : checking for sed... /usr/bin/sed checking for grep... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for x86_64-apple-darwin-ar... no checking for ar... /usr/bin/ar checking for a BSD-compatible install... /usr/bin/install -c checking for x86_64-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 we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking how to run the C preprocessor... gcc -E checking for a sed that does not truncate output... (cached) /usr/bin/sed checking whether to build with code coverage support... no checking whether build environment is sane... yes checking for x86_64-apple-darwin-strip... no checking for strip... strip configure: WARNING: using cross tools not prefixed with host triplet checking for a thread-safe mkdir -p... ./install-sh -c -d 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 the include directive... yes (GNU style) checking dependency style of gcc... gcc3 checking curl version... 7.60.0-DEV checking build system type... x86_64-apple-darwin19.6.0 checking host system type... x86_64-apple-darwin checking for grep that handles long lines and -e... (cached) /usr/bin/grep checking for egrep... /usr/bin/grep -E checking if OS is AIX (to define _ALL_SOURCE)... no checking if _THREAD_SAFE is already defined... no checking if _THREAD_SAFE is actually needed... no checking if _THREAD_SAFE is onwards defined... no checking if _REENTRANT is already defined... no checking if _REENTRANT is actually needed... no checking if _REENTRANT is onwards defined... no checking for special C compiler options needed for large files... no checking for _FILE_OFFSET_BITS value needed for large files... no checking how to print strings... printf checking for a sed that does not truncate output... (cached) /usr/bin/sed checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /Applications/Xcode-11.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld checking if the linker (/Applications/Xcode-11.3.1.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 x86_64-apple-darwin-dumpbin... no checking for x86_64-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... 196608 checking how to convert x86_64-apple-darwin19.6.0 file names to x86_64-apple-darwin format... func_convert_file_noop checking how to convert x86_64-apple-darwin19.6.0 file names to toolchain format... func_convert_file_noop checking for /Applications/Xcode-11.3.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r checking for x86_64-apple-darwin-objdump... no checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for x86_64-apple-darwin-dlltool... no checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for x86_64-apple-darwin-ar... /usr/bin/ar checking for archiver @file support... no checking for x86_64-apple-darwin-strip... strip checking for x86_64-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 x86_64-apple-darwin-mt... no checking for mt... no checking if : is a manifest tool... no checking for x86_64-apple-darwin-dsymutil... no checking for dsymutil... dsymutil checking for x86_64-apple-darwin-nmedit... no checking for nmedit... nmedit checking for x86_64-apple-darwin-lipo... no checking for lipo... lipo checking for x86_64-apple-darwin-otool... no checking for otool... otool checking for x86_64-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 ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... 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-11.3.1.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... no checking whether to build static libraries... yes checking whether to build shared libraries with -version-info... yes checking whether to build shared libraries with -no-undefined... no checking whether to build shared libraries with -mimpure-text... no checking whether to build shared libraries with PIC... yes checking whether to build static libraries with PIC... no checking whether to build shared libraries only... no checking whether to build static libraries only... yes checking for inline... inline checking if cpp -P is needed... no checking if compiler is DEC/Compaq/HP C... no checking if compiler is HP-UX C... no checking if compiler is IBM C... no checking if compiler is Intel C... no checking if compiler is clang... yes checking if compiler is GNU C... no checking if compiler is LCC... no checking if compiler is SGI MIPSpro C... no checking if compiler is SGI MIPS C... no checking if compiler is SunPro C... no checking if compiler is Tiny C... no checking if compiler is Watcom C... no checking if compiler accepts some basic options... yes configure: compiler options added: -Qunused-arguments checking if compiler accepts debug disabling options... yes configure: compiler options added: checking if compiler optimizer assumed setting might be used... no checking if compiler halts on compilation errors... yes checking if compiler halts on negative sized arrays... yes checking if compiler halts on function prototype mismatch... yes checking if compiler supports hiding library internal symbols... yes checking for windows.h... no checking whether build target is a native Windows one... no checking whether build target supports WIN32 file API... no checking for good-to-use Mac CFLAGS... yes checking for *version-min in CFLAGS... -mmacosx-version-min=10.8 set checking whether gcc accepts -Werror=partial-availability... no checking to see if the compiler supports __builtin_available()... no checking whether to support http... yes checking whether to support ftp... yes checking whether to support file... yes checking whether to support ldap... yes checking whether to support ldaps... yes checking whether to support rtsp... yes checking whether to support proxies... yes checking whether to support dict... yes checking whether to support telnet... yes checking whether to support tftp... yes checking whether to support pop3... yes checking whether to support imap... yes checking whether to support smb... yes checking whether to support smtp... yes checking whether to support gopher... yes checking whether to provide built-in manual... yes checking whether to enable generation of C code... yes checking whether to use libgcc... no checking if X/Open network library is required... no checking for gethostbyname... no checking for gethostbyname in -lnsl... no checking for gethostbyname in -lsocket... no checking for gethostbyname in -lwatt... no checking for gethostbyname with both nsl and socket libs... no checking for gethostbyname for Minix 3... no checking for gethostbyname for eCos... no checking for gethostbyname in -lnetwork... no checking for gethostbyname in -lnet... no configure: error: couldn't find libraries for gethostbyname() ```
Important part is this:
Apparently, the regex used to check version-min looks for
os
in the string, which is not always the case:curl/acinclude.m4
Line 2609 in 3085ccf
I think this check should be updated to provide correct flags.
Here are the all possible values:
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mios-simulator-version-min
https://bcain-llvm.readthedocs.io/projects/clang/en/latest/ClangCommandLineReference/#cmdoption-clang-mtvos-simulator-version-min
https://bcain-llvm.readthedocs.io/projects/clang/en/latest/ClangCommandLineReference/#cmdoption-clang-mwatchos-simulator-version-min
https://bcain-llvm.readthedocs.io/projects/clang/en/latest/ClangCommandLineReference/#cmdoption-clang-miphoneos-version-min
https://bcain-llvm.readthedocs.io/projects/clang/en/latest/ClangCommandLineReference/#cmdoption-clang-mmacosx-version-min
Therefore, correct regex should be
m.*-version-min
imo.I expected the following
Build successfully.
curl/libcurl version
Building from tag
curl-7_76_0
operating system
The text was updated successfully, but these errors were encountered: