-
Notifications
You must be signed in to change notification settings - Fork 10.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
Fix build on FreeBSD #38335
base: main
Are you sure you want to change the base?
Fix build on FreeBSD #38335
Conversation
@swift-ci test |
include/swift/SILOptimizer/Differentiation/DifferentiationInvoker.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments.
Build failed |
Build failed |
@swift-ci test |
@@ -24,7 +24,7 @@ | |||
|
|||
// Clang has been defining __INTxx_TYPE__ macros for a long time. | |||
// __UINTxx_TYPE__ are defined only since Clang 3.5. | |||
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) | |||
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(FreeBSD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want defined(__FreeBSD__)
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks!
cefc502
to
a8b345b
Compare
@swift-ci test |
Build failed |
@swift-ci test linux |
Build failed |
@swift-ci clean test linux |
@@ -658,7 +658,7 @@ importer::getNormalInvocationArguments( | |||
} | |||
} | |||
|
|||
if (searchPathOpts.SDKPath.empty()) { | |||
if (searchPathOpts.SDKPath.empty() && !triple.isOSFreeBSD()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why special case this for FreeBSD, not working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it excludes all system headers, causing e.g. the Glibc module to not work. I am unsure why this works on Linux, but not FreeBSD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try adding the ClangImporter flags -Xfrontend -dump-clang-diagnostics -Xcc -v
after removing this special case to dump what it's seeing and compare with linux, as I did with SR-14796.
test/Sanitizers/tsan/tsan.swift
Outdated
threads.append(t!) | ||
#else | ||
threads.append(t) | ||
#endif | ||
} | ||
|
||
print("================ 34 2THRAEDS: \(threads)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your debugging info that can be taken out?
@@ -30,7 +30,7 @@ using namespace fine_grained_dependencies; | |||
|
|||
// This introduces a redefinition where ever std::is_same_t<size_t, uint64_t> | |||
// holds | |||
#if !(defined(__linux__) || defined(_WIN64)) | |||
#if (!(defined(__linux__) || defined(_WIN64) || defined(__FreeBSD__))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added unnecessary first parenthesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to see this. I don't know about the std::pair
changes but otherwise checks out.
FLAGS "-DCMAKE_SDK=${sdk}") | ||
list(APPEND glibc_modulemap_target_list ${glibc_header_target}) | ||
# FreeBSD uses a different module map that does not use this header, | ||
# so we don't generate it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried using this "Glibc" header instead on FreeBSD? I have it almost working for Android, #35707, so I think it should work for the BSDs too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but ran into a lot of missing functions. I did not have time to figure out what the problem is, yet, but I will take a look. Thanks for the link. I would like to land this first, though.
@swift-ci smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swift on FreeBSD is awesome! Thanks!
@swift-ci test macos |
@swift-ci test windows |
@swift-ci smoke test |
@swift-ci test windows |
1 similar comment
@swift-ci test windows |
@swift-ci test windows |
Hi. I would like to register that I really would like very much to have Swift ported and maintained on FreeBSD. |
Curious what is preventing this from happening? It would be great to be able to deploy Server Side Swift on FreeBSD. Is there anything that can be done to support this effort (financially or other wise)? Super excited and want to thank everyone who has pushed this along. |
@drexin hi, i updated the PR, the patch is based on swift release/5.6 branch. i have test this on FreeBSD 13
|
I would like to second @majortom64 question. @drexin: is there anything we can help to get this merged? Swift on FreeBSD would indeed be awesome. |
Hey, sorry for the silence here. I was pretty busy with other stuff and this was just a side project. I don't think I will be able to spend any time on this in the near future, but if anyone wants to pick this up, please feel free to. |
@drexin Thank you for the update. I completely understand. Unfortunately this is beyond by abilities, but hopefully someone else might do it. |
Hey everyone, coming from #59579 |
Pleased do
Am 20. Juni 2022 18:30:11 MESZ schrieb InfRandomness ***@***.***>:
Hey everyone, coming from #59579
I would be interesting into continuing the work on this
--
Reply to this email directly or view it on GitHub:
#38335 (comment)
You are receiving this because you commented.
Message ID: ***@***.***>
--
Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
|
Hi, Thanks a lot for the answers in advance ! 😄 |
std::pair<ApplyInst *, SILDifferentiabilityWitness *> | ||
indirectDifferentiation; | ||
/// | ||
/// Note: This used to be a std::pair, but on FreeBSD std::pair can't be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe, this is not FreeBSD specifics, but a libc++ one. Change the comment accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreeBSD specifically disables the copy constructor by setting _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
to preserve ABI. It is not a general limitation of libc++.
No, first follow the build instructions for linux here, translating to FreeBSD as much as possible, and see if you can bootstrap the compiler and run the validation suite, as has been done for OpenBSD. Only once you're able to build the compiler and run the tests on FreeBSD should you consider submitting a pull.
Yes, that is better, the tests are moving that way, as in #58975. |
Is there a process to follow for fixing LLVM build issues? |
Yes, you submit it to their Phabricator.
No, you're supposed to submit changes upstream, not to the Apple fork for Swift. |
Bring drexin's FreeBSD support patch up to date with main. Resolved conflicts in prior merge commit and made some minor buildfixes. Still requires some other more general fixes outside this pr to have this build properly at HEAD but have verified this builds OK with those fixes TK on FreeBSD 12.3. Note: I don't intend to support this platform as a priority.
Bring drexin's FreeBSD support patch up to date with main. Resolved conflicts in prior merge commit and made some minor buildfixes. Still requires some other more general fixes outside this pr to have this build properly at HEAD but have verified only this builds OK with those fixes possibly TK including swiftlang#59987 on FreeBSD 12.3. Note: I don't intend to support this platform as a priority.
Bring drexin's FreeBSD support patch up to date with main. Resolved conflicts in prior merge commit and made some minor buildfixes. Still requires some other more general fixes outside this pr to have this build properly at HEAD but have verified only this builds OK with those fixes possibly TK including swiftlang#59987 and bootstrapping disabled on FreeBSD 12.3. Note: I don't intend to support this platform as a priority.
These changes make Swift build on FreeBSD (tested on 13.0-RELEASE-p1). There are some tests that I had to XFAIL, but the majority works. SourceKit tests are very unstable and seem to fail when too many tests are executed in parallel. Running them in isolation with
lit.py -v $SWIFT_BUILD_ROOT/tests-xxx --filter=SourceKit -j12
works, but using more threads causes random failures. The more threads are used, the more tests fail. I have not found the reason, yet.