no_weak_imports does not work with autoconf-based checks

Originator:david.fuhrmann
Number:rdar://29498853 Date Originated:03-Dec-2016 01:04 PM
Status:Open Resolved:
Product:macOS + SDK Product Version:
Classification: Reproducible:
 
Area:
Xcode

Summary:
Current Xcode 8 release on 10.11 only includes a 10.12 SDK. With that SDK, some weak linking for libc symbols was added. One example: mkostemp was added in 10.12, and it will be linked against in 10.12, but if you compile on 10.11 with 10.11 as minimum target, it weak links that symbol.

According to https://github.com/Homebrew/homebrew-core/issues/3727, "-no_weak_imports" shall be passed to the compiler, to specifically avoid that behaviour and allow existing autotools based projects to continue to work on the same platform.

Issue is, that this compiler flag has no effects for any autotools based project with uses AC_CHECK_FUNCS to check for a function.

Please find the test program attached which autotools produce for the check. Please find the compiler line at the top. This program should fail to compile if the flag would work correctly. But it just compiles fine and only fails at runtime.

Steps to Reproduce:
1. Setup 10.11 machine with Xcode 8 and 10.12 SDK only.
2. Create autotool based project, use AC_CHECK_FUNCS to check for mkostemp (which was only added in 10.12)
3. Do configure with "-no_weak_imports" flag set.

Expected Results:
configure should not detect mkostemp as available

Actual Results:
configure still thinks mkostemp is available.

Version:
Mac OS 10.11.6, Xcode 8.1.

Notes:


Configuration:


Attachments:
successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!