Skip to content

Conversation

@drodriguez
Copy link
Contributor

Always pass the -static parameter, instead of relying on the default of libtool.

Motivation:

This matches the implementation of the static linker in swift-driver, which always adds the explicit -static.

https://github.com/apple/swift-driver/blob/caa81e560362a4e14034cd4502114d03e45ea261/Sources/SwiftDriver/Jobs/DarwinToolchain%2BLinkerSupport.swift#L95-L102

Additionally, this improves the compatibility with LLVM's libtool, which does not (intentionally) default to static libraries (it defaults to do nothing).

Modifications:

Adds a new parameter -static for every invocation of libtool to create static libraries in Darwin.

Result:

The internal invocation of libtool always uses the -static. No changes should be experienced, since this is the default for cctools' libtool.

/cc @compnerd as the author of #5720 which added the usage of libtool

@neonichu
Copy link
Contributor

neonichu commented Dec 6, 2022

@swift-ci please smoke test

@drodriguez drodriguez force-pushed the libtool-explicit-static branch from 72427ee to b090688 Compare December 7, 2022 02:41
@drodriguez
Copy link
Contributor Author

Modify the test that checks the correct command line is used. Sorry about forgetting that.

@MaxDesiatov
Copy link
Contributor

@swift-ci please smoke test

@drodriguez
Copy link
Contributor Author

Is the error in Swift Test Linux Platform related?

error: terminated(127): /tmp/Miscellaneous_TestDiscovery_Simple.7UaaBN/Miscellaneous_TestDiscovery_Simple/.build/x86_64-unknown-linux-gnu/debug/SimplePackageTests.xctest --dump-tests-json output:
        /tmp/Miscellaneous_TestDiscovery_Simple.7UaaBN/Miscellaneous_TestDiscovery_Simple/.build/x86_64-unknown-linux-gnu/debug/SimplePackageTests.xctest: error while loading shared libraries: libswift_RegexParser.so: cannot open shared object file: No such file or directory

@MaxDesiatov
Copy link
Contributor

@swift-ci smoke test Linux

@neonichu
Copy link
Contributor

neonichu commented Dec 8, 2022

@swift-ci smoke test windows

@drodriguez
Copy link
Contributor Author

Every platform seems to be green. Is this good to merge?

@neonichu
Copy link
Contributor

I believe so, thanks @drodriguez!

@neonichu neonichu merged commit 420ef0a into swiftlang:main Dec 14, 2022
@drodriguez drodriguez deleted the libtool-explicit-static branch December 14, 2022 23:54
@tomerd
Copy link
Contributor

tomerd commented Dec 21, 2022

should we add (or modify) a test for this?

@drodriguez
Copy link
Contributor Author

should we add (or modify) a test for this?

The existing test was modified to also expect the -static. Or do you mean some other test? What would that test be testing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants