I've eventually tracked down all the problems that prevented swift
standard library and related tests to run correctly under FreeBSD but
one.When I run the testsuite as ./utils/build-script -R -t each single
test requiring SwiftGlibc fails because of missing headers.
<module-includes>:1:10: note: in file included from <module-includes>:1:
/usr/include/complex.h:32:10: error: 'sys/cdefs.h' file not found with
<angled> include; use "quotes" instead
<module-includes>:2:10: note: in file included from <module-includes>:2:
In a different thread Jordan suggested to pass -sdk / to see if that
fixed the problem, and indeed it did. Digging into the code I noticed
that the Driver checks for SDKROOT environment variable being set as
fallback if -sdk argument isn't passed on the cmdline.
If I set that environment variable and I run the tests standalone
(directly from cmdline), everything seems to be fine.
-target x86_64-unknown-freebsd11.0-CURRENT -module-cache-path
-Xfrontend -disable-access-control -Onone -o
/exps/swift/swift/test/1_stdlib/Builtins.swift:113:3: warning: result
of call to 'unsafeUnwrap' is unused
davide@rabbit1:/exps/swift/swift % echo $SDKROOT
But, if I run the whole testsuite, it fails (with the error above).
I'm no expert about swift build but it seems to me SDKROOT isn't
honored when the testsuite is invoked (maybe it doesn't share the
enviroment with the calling process?)
In any case, I'm interested in getting this fixed as it seems to be
the only missing bit to get the whole testsuite to run (and setup a
buildbot to catch regressions).
I'm not sure if it's better forcing the user to pass SDKROOT (and then
understanding why it's not honoured), or forcing -sdk / to be passed
to each test. I'm not sure what Linux does (and wasn't entirely
obvious to me where to look).
Any suggestion on how to handle this case is greatly appreciated.