x86_64-unknown-linux-musl cross-build fails on rustc 1.64 with PIE linking error #286

Closed
opened 2022-07-01 00:35:45 +00:00 by foldedcascode · 5 comments
foldedcascode commented 2022-07-01 00:35:45 +00:00 (Migrated from gitlab.com)

Description

When using a rust toolchain with version 1.64 (and likely any version >= 1.59), cross build for x86_64-unknown-linux-musl fails in the final step with a linker error indicating that libc was not compiled with fPIE and therefore can't be used to build a PIE.

Based on https://github.com/rust-lang/rust/pull/70740 I realized that conduit's custom cross image was linking against a system musl when it should be linking against the toolchain's musl, due to the way flags had been set to allow linking to libstdc++. This is a simple fix in the dockerfile used to build that cross image: https://gitlab.com/jfowl/conduit-containers/-/merge_requests/1

Once https://gitlab.com/jfowl/conduit-containers/-/merge_requests/1 is merged, updating Cross.toml to use the new cross images will fix the problem.

As a side-note: Interesting that cross uses a containerized toolchain to build, but uses the host toolchain to link. Or something like that; maybe I have it backwards, but, I'm surprised that the version of the host toolchain has an impact on the outcome of a build. I expected builds to be more consistently reproducible, I guess.

### Description When using a rust toolchain with version 1.64 (and likely any version >= 1.59), cross build for x86_64-unknown-linux-musl fails in the final step with a linker error indicating that libc was not compiled with fPIE and therefore can't be used to build a PIE. Based on https://github.com/rust-lang/rust/pull/70740 I realized that conduit's custom cross image was linking against a system musl when it should be linking against the toolchain's musl, due to the way flags had been set to allow linking to libstdc++. This is a simple fix in the dockerfile used to build that cross image: https://gitlab.com/jfowl/conduit-containers/-/merge_requests/1 Once https://gitlab.com/jfowl/conduit-containers/-/merge_requests/1 is merged, updating Cross.toml to use the new cross images will fix the problem. As a side-note: Interesting that cross uses a containerized toolchain to build, but uses the host toolchain to link. Or something like that; maybe I have it backwards, but, I'm surprised that the version of the host toolchain has an impact on the outcome of a build. I expected builds to be more consistently reproducible, I guess.
foldedcascode commented 2022-07-01 00:37:10 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
foldedcascode commented 2022-07-01 00:39:31 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
joshhansen commented 2022-08-23 05:03:42 +00:00 (Migrated from gitlab.com)

mentioned in issue #302

mentioned in issue #302
foldedcascode commented 2022-10-09 20:02:59 +00:00 (Migrated from gitlab.com)

mentioned in merge request !387

mentioned in merge request !387
CobaltCause commented 2024-01-25 00:21:59 +00:00 (Migrated from gitlab.com)

This will be fixed in https://gitlab.com/famedly/conduit/-/merge_requests/569: we'll be producing statically linked binaries for this target in CI and you'll be able to use Nix to make your own binaries too.

This will be fixed in https://gitlab.com/famedly/conduit/-/merge_requests/569: we'll be producing statically linked binaries for this target in CI and you'll be able to use Nix to make your own binaries too.
Sign in to join this conversation.
No labels
Android
CS::needs customer feedback
CS::needs follow up
CS::needs on prem installation
CS::waiting
Chrome
Design:: Ready
Design:: in progress
Design::UX
E2EE
Edge
Firefox
GDPR
Iteration 13 IM
Linux
MacOS
Need::Discussion
Need::Steps to reproduce
Need::Upstream fix
Needs:: Planning
Needs::Dev-Team
Needs::More information
Needs::Priority
Needs::Product
Needs::Refinement
Needs::Severity
Priority::1-Critical
Priority::2-Max
Priority::3-Impending
Priority::4-High
Priority::5-Medium
Priority::6-Low
Priority::7-None
Progress::Backlog
Progress::Review
Progress::Started
Progress::Testing
Progress::Triage
Progress::Waiting
Reporter::Sentry
Safari
Target::Community
Target::Customer
Target::Internal
Target::PoC
Target::Security
Team:Customer-Success
Team:Design
Team:Infrastructure
Team:Instant-Messaging
Team:Product
Team:Workflows
Type::Bug
Type::Design
Type::Documentation
Type::Feature
Type::Improvement
Type::Support
Type::Tests
Windows
blocked
blocked-by-spec
cla-signed
conduit
contribution::advanced
contribution::easy
contribution::help needed
from::review
iOS
p::ti-tenant
performance
product::triage
proposal
refactor
release-blocker
s: dart_openapi_codegen
s::Famedly-Patient
s::Org-Directory
s::Passport-Generator
s::Requeuest
s:CRM
s:Famedly-App
s:Famedly-Web
s:Fhiroxide
s:Fhiroxide-cli
s:Fhiroxide-client
s:Fhirs
s:Hedwig
s:LISA
s:Matrix-Dart-SDK
s:Role-Manager
s:Synapse
s:User-Directory
s:WFS-Matrix
s:Workflow Engine
s:dtls
s:famedly-error
s:fcm-shared-isolate
s:matrix-api-lite
s:multiple-tab-detector
s:native-imaging
severity::1
severity::2
severity::3
severity::4
technical-debt
voip
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Matthias/conduit#286
No description provided.