Skip to content

[rfc] build-style: go: set buildmode=pie globally#46958

Draft
dkwo wants to merge 7 commits intovoid-linux:masterfrom
dkwo:gopie
Draft

[rfc] build-style: go: set buildmode=pie globally#46958
dkwo wants to merge 7 commits intovoid-linux:masterfrom
dkwo:gopie

Conversation

@dkwo
Copy link
Contributor

@dkwo dkwo commented Oct 29, 2023

  • Packages that failed to build with pie have nopie set, due to not using the build style.

  • cross building pie to musl targets it cannot find the right linker and it prefers the glibc one. Proposed fix:

# The linker checks the host sysroot, breaking static PIE musl cross builds
if [ -n "${CROSS_BUILD}" ] && [ "${XBPS_TARGET_LIBC}" = "musl" ]; then
 case "${XBPS_TARGET_MACHINE}" in
  aarch64*)
   go_ldflags+=" -I /lib/ld-musl-aarch64.so.1"
   ;;
 esac
fi

tested with

post_install() {
       readelf -l ${DESTDIR}/usr/bin/go-bindata
}

Not blocking but to be considered:

Todo: clean up git grep buildmode=pie.
[ci skip]

@dkwo dkwo marked this pull request as draft October 29, 2023 18:04
@dkwo dkwo force-pushed the gopie branch 2 times, most recently from d8efa4d to 5c4755e Compare October 31, 2023 21:01
@dkwo dkwo marked this pull request as ready for review October 31, 2023 21:06
@leahneukirchen
Copy link
Member

So, which packages do you expect to fail and why?

I'd also recommend do apply this together with a Go release bump.

@CameronNemo
Copy link
Contributor

Regarding LXD / Incus... I do want to migrate to Incus and completely remove LXD down the line. Don't really have time for that right now though :/

@benalb
Copy link
Contributor

benalb commented Nov 29, 2023

about bombadillo, I tried to rise an issue upstream, but they do not allow rising issues without a tilde account, that I do not have. Right now I am in the #helpedesk channel in tilde irc, waiting to someone to reply to me.

Update, very nicely, they created an tilde account for me, I could rise an issue about the timeout error, and also they pointed me to go-gitea/gitea#27945

It seems the bug issue has been resolved, I can donwload the tar.gz again.

@dkwo
Copy link
Contributor Author

dkwo commented Dec 2, 2023

Second rebuild completed, nothing new to report.

@dkwo dkwo force-pushed the gopie branch 3 times, most recently from 9158dc9 to d4d35f7 Compare December 6, 2023 21:25
@dkwo dkwo changed the title [rfc] build-style: go: allow pie (v2) build-style: go: allow pie (v2) Dec 7, 2023
@dkwo
Copy link
Contributor Author

dkwo commented Dec 7, 2023

@leahneukirchen Can you take a look?
In summary, sbctl is fixed in linked pr; lxd is broken since go 1.21 (unnoticed b/c they moved distfiles) and should be replaced with incus anyway; clipman has no distfiles, but builds fine with pie if using alternative ones, so not an issue here.

@leahneukirchen
Copy link
Member

sgtm!

@classabbyamp
Copy link
Member

why does nopie need nostrip set? go packages have been stripped for a while now

@dkwo
Copy link
Contributor Author

dkwo commented Dec 10, 2023

Indeed, nostrip is not necessary anymore, I removed it.

@dkwo dkwo force-pushed the gopie branch 2 times, most recently from 3da9687 to e38db7b Compare December 10, 2023 15:35
@dkwo dkwo force-pushed the gopie branch 2 times, most recently from c144f20 to 24670ec Compare December 26, 2023 17:59
@github-actions
Copy link

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions
Copy link

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions
Copy link

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@github-actions
Copy link

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

@dkwo dkwo force-pushed the gopie branch 4 times, most recently from 93e55f7 to e400877 Compare February 5, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

xbps-src xbps-src related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants