Skip to content
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

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

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

dkwo
Copy link
Contributor

@dkwo dkwo commented Oct 29, 2023

I rebuilt all packages natively on x86_64-glibc.
Packages that failed to build with pie have nopie set.

Pending:

Building with pie may interfere with static binaries (e.g. if set CGO_ENABLED=0) and cross-compiling.
Up to now I disabled it for

  • go-bindata
  • go-md2man
  • grafana

but further investigation/tests are needed. See also https://go-review.googlesource.com/c/go/+/248199

[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
@dkwo
Copy link
Contributor Author

dkwo commented Jan 6, 2024

there are some issues with go-bindata, and possibly with go-md2man, as well as git grep CGO_ENABLED=0.
need to look closer.

for example, crosscompiling go-bindata for aarch64-musl, adding

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

on master gives /destdir/aarch64-linux-musl/go-bindata-3.0.7.20151023/usr/bin/go-bindata: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=049Th31uwiIuGRUL3pij/OnBl5ikERfjKZV3TIvKW/hNR_lVksP6VDJDygk29J/d7c2_zRYyzhoaXpqlU1c, with debug_info, not stripped while on this branch gives
/destdir/aarch64-linux-musl/go-bindata-3.0.7.20151023/usr/bin/go-bindata: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, Go BuildID=2VcK8rq3V28QzwdA132q/aOXGyFpFnGRjrhFln2o8/QIb7J48ItHPlMUWCBeq-/j_Cj8T_yxdd9IaS_3uto, with debug_info, not stripped.

@dkwo dkwo marked this pull request as draft January 6, 2024 22:46
@dkwo dkwo changed the title build-style: go: allow pie (v2) [rfc] build-style: go: set pie globally Jan 7, 2024
@dkwo dkwo changed the title [rfc] build-style: go: set pie globally [rfc] build-style: go: set buildmode=pie globally Jan 8, 2024
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.

None yet

6 participants