Skip to content

[Swift] let the Swift Package Manager choose between static or dynamic linking - #3743

Closed
100mango wants to merge 2 commits into
antlr:devfrom
100mango:master
Closed

100mango wants to merge 2 commits into
antlr:devfrom
100mango:master

Conversation

@100mango

@100mango 100mango commented Jun 8, 2022 •

Copy link
Copy Markdown
Contributor

When building an executable target using Swift Package Manager, We should depend on a static Antlr runtime framework to make a portable executable binary.

Or we will have to deal with the linker problem like:

dyld[36790]: Library not loaded: @rpath/libAntlr4.dylib
  Referenced from: /Users/100mango/Desktop/RossetaDartDemo/Rosseta
  Reason: tried: '/usr/lib/swift/libAntlr4.dylib' (no such file),
 '/Users/100mango/Desktop/RossetaDartDemo/../lib/libAntlr4.dylib' (no such file),
 '/usr/lib/swift/libAntlr4.dylib' (no such file), 
'/Users/100mango/Desktop/RossetaDartDemo/../lib/libAntlr4.dylib' (no such file),
 '/usr/local/lib/libAntlr4.dylib' (no such file), 
'/usr/lib/libAntlr4.dylib' (no such file)

@parrt parrt added this to the 4.10.2 milestone Jun 25, 2022
@parrt

parrt commented Jun 25, 2022

Copy link
Copy Markdown
Member

hi. How certain are you of this change? Well this affect people that are expecting dynamic?

…ager choose between static or dynamic linking (recommended).
@100mango 100mango changed the title [Swift] runtime as static framework [Swift] let the Swift Package Manager choose between static or dynamic linking Jun 28, 2022
@100mango

Copy link
Copy Markdown
Contributor Author

@parrt Good Point👍 A better approach is to leave this parameter unspecified (done)。

According to Apple Docs:
" Leave this parameter unspecified to let the Swift Package Manager choose between static or dynamic linking (recommended)."

@KvanTTT

KvanTTT commented Jun 28, 2022 •

Copy link
Copy Markdown
Member

Hi. Not sure it should be removed. Have you tried runtime tests with removed option? They don't work for me if the option is removed because Antlr4.lib and Antlr4.dll are absent at least on Windows.

@Kerze-Mann

Copy link
Copy Markdown
Contributor

#3669

@parrt

parrt commented Jul 5, 2022

Copy link
Copy Markdown
Member

Hi gang. Can you help me understand the status here? Do we need this and #3669 or does #3669 supersede this one? thanks!

@serhiybobyr-tomtom

Copy link
Copy Markdown

Hi gang. Can you help me understand the status here? Do we need this and #3669 or does #3669 supersede this one? thanks!

By default the current changes are enough and are recommended. #3669 supersedes this one. Beside the recommended way it also specifies 2 more products. So as a result swift build will produce static and dynamic libraries the default one will only produce object files which then you can choose to what used it for. BTW the other PR bumps swift version from 5.3 straight to 5.6 which is not related to this at all and raises a question why not 5.5 or 5.7.

@parrt

parrt commented Aug 4, 2022

Copy link
Copy Markdown
Member

Closed in favor of #3669. thanks!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants