Skip to content

[CMake] fix runpath for ELF platforms #303

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

Merged
merged 1 commit into from
Mar 6, 2021
Merged

Conversation

finagolfin
Copy link
Member

@finagolfin finagolfin commented May 6, 2020

Remove the absolute path to the host toolchain's stdlib from libXCTest.so and add $ORIGIN.

Otherwise, you see the following in the current official release for linux:

readelf -d swift-5.2.3-RELEASE-ubuntu18.04/usr/lib/swift/linux/libXCTest.so | ag runpath
0x000000000000001d (RUNPATH)            Library runpath: [/home/buildnode/jenkins/workspace/oss-swift-5.2-package-linux-ubuntu-18_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux]

@finagolfin
Copy link
Member Author

@ddunbar, I notice you had a similar commit before, eb46e08, let me know what you think.

@finagolfin
Copy link
Member Author

@briancroom, is there someone who could review this? I've had similar pulls merged recently in other Swift repos, swiftlang/swift-llbuild#670 and swiftlang/swift-corelibs-libdispatch#541.

@briancroom
Copy link
Contributor

Hi @buttaface, @compnerd is responsible for most of the CMake in this repo, so he seems like the most likely person to be able to effectively review the change, but if he doesn’t have feedback, I think we can go ahead and merge this assuming CI results come back green!

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RPATH should be controlled by the CMake variables for it. That will ensure that the build is done with the absolute parts which of absolutely desired and essential (avoids the wrong library used during testing).

For the origin, that’s required door repackaging. I think that you should pad that flag view CMAKE_Swift_FLAGS rather than forcefully set that.

@finagolfin
Copy link
Member Author

The RPATH should be controlled by the CMake variables for it. That will ensure that the build is done with the absolute parts which of absolutely desired and essential (avoids the wrong library used during testing).

As you're well aware, CMake can't remove the default runtime library path added by the Swift compiler, only the -no-toolchain-stdlib-rpath flag I added can do that. $ORIGIN is added by a CMake flag, as you want.

I think that you should pad that flag view CMAKE_Swift_FLAGS rather than forcefully set that.

I don't see why, for example, Foundation does it this way too, with INSTALL_RPATH.

@finagolfin
Copy link
Member Author

@briancroom, in the meantime, could you run the linux CI?

@spevans
Copy link
Contributor

spevans commented May 14, 2020

@swift-ci please test

@finagolfin
Copy link
Member Author

No response forthcoming, @spevans, can you merge?

@compnerd
Copy link
Member

I dont think that the issue has been resolved, the previous comments still hold. Having the conversation over 4 different PRs is not helpful. I recommend that all of them are closed off, a proper solution is discussed on the forums and then applied uniformly across all the repositories.

@finagolfin
Copy link
Member Author

finagolfin commented May 19, 2020

the previous comments still hold

Which would that be? I pointed out that you used INSTALL_RPATH yourself to set $ORIGIN in an earlier pull for Foundation that's still used, yet here you are telling me not to do that. You didn't respond for the last week.

I think it's pretty obvious your comments are ridiculous and should just be ignored, that's what I'm asking @spevans to do.

Remove the absolute path to the host toolchain's stdlib from libXCTest.so.
@finagolfin
Copy link
Member Author

Getting back to this again, removed the $ORIGIN portion that @compnerd asked for. This patch was already merged to the 5.3 branch a couple weeks ago in #308, just getting trunk synced here then will get this in 5.4 too.

@finagolfin
Copy link
Member Author

Ping, this was already merged in the 5.3 release branch. @spevans, mind rerunning the CI and merging?

@spevans
Copy link
Contributor

spevans commented Jan 14, 2021

@swift-ci test

@finagolfin
Copy link
Member Author

@compnerd, presumably you're okay with this pull now that it's just removing the host toolchain's absolute rpath?

@finagolfin
Copy link
Member Author

@spevans, not sure why we haven't heard from Saleem, but he already OKed this patch for the 5.3 branch in #308 and as noted there, this fixes point 2. in SR-1650, so I think this should be merged.

@tomerd
Copy link

tomerd commented Jan 27, 2021

cc @compnerd

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

@finagolfin
Copy link
Member Author

@briancroom, anything holding this back?

@briancroom briancroom merged commit dd599d0 into swiftlang:main Mar 6, 2021
@finagolfin finagolfin deleted the rpath branch March 12, 2021 02:57
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.

5 participants