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

Not working with WSL #2

Closed
aidenesco opened this issue Oct 14, 2020 · 6 comments
Closed

Not working with WSL #2

aidenesco opened this issue Oct 14, 2020 · 6 comments

Comments

@aidenesco
Copy link

aidenesco commented Oct 14, 2020

I built a binary for GOOS=linux GOARCH=amd64, packed it (compression, random offset, no dependency), and then moved the output to a windows machine running WSL ubuntu 20.04 (same as the machine it was built and packed on).

When it's run the only output is "Segmentation Fault". It runs fine on ubuntu.

@89luca89
Copy link
Owner

Hi @aidenesco , I did not test on WSL, will test and try to see if I can reproduce the issue

Is it WSL1 or WSL2?

@alfonmga
Copy link
Contributor

alfonmga commented Mar 16, 2021

@89luca89 Where did you test this on? maybe would be nice to have a Dockerfile to avoid this type of issues. I can't get it to work on MacOS. Thanks a lot for this awesome project BTW.

EDIT: Nevermind, just saw that you did a release for Linux AMD64.

@89luca89 89luca89 reopened this Mar 16, 2021
@89luca89
Copy link
Owner

Reopening the issue, the idea of a Docker image for the packer part is appealing

@alfonmga you were referring to the packer part or to the launcher part?

@89luca89
Copy link
Owner

Expanding on this, the packer part should work fine in a docker image (and could work in any unix I think, but have not tested)

The launcher part is highly tied to Linux as it runs on specific raw syscalls

@alfonmga
Copy link
Contributor

Reopening the issue, the idea of a Docker image for the packer part is appealing

@alfonmga you were referring to the packer part or to the launcher part?

The launcher part. It fails when I run make on $GOPATH/src/github.com/89luca89/pakkero to build:

> make

go build -i \
		-gcflags="-N" \
		-gcflags="-nolocalimports" \
		-gcflags="-pack" \
		-gcflags="-trimpath=." \
		-asmflags="-trimpath=." \
		-gcflags="-trimpath=$GOPATH/src/" \
		-asmflags="-trimpath=$GOPATH/src/" \
		-ldflags="-X github.com/89luca89/pakkero/internal/pakkero.LauncherStub=$(base64 -w0 data/launcher.go) -s" \
		-o dist/pakkero;
base64: invalid option -- w
Usage:	base64 [-hvDd] [-b num] [-i in_file] [-o out_file]
  -h, --help     display this message
  -Dd, --decode   decodes input
  -b, --break    break encoded string into num character lines
  -i, --input    input file (default: "-" for stdin)
  -o, --output   output file (default: "-" for stdout)
go build: -i flag is deprecated
strip \
		-sxX \
		--remove-section=.bss \
		--remove-section=.comment \
		--remove-section=.eh_frame \
		--remove-section=.eh_frame_hdr \
		--remove-section=.fini \
		--remove-section=.fini_array \
		--remove-section=.gnu.build.attributes \
		--remove-section=.gnu.hash \
		--remove-section=.gnu.version \
		--remove-section=.got \
		--remove-section=.note.ABI-tag \
		--remove-section=.note.gnu.build-id \
		--remove-section=.note.go.buildid \
		--remove-section=.shstrtab \
		--remove-section=.typelink \
		dist/pakkero;
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: unrecognized option: -sxX
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip [-AnuSXx] [-] [-d filename] [-s filename] [-R filename] [-o output] file [...]
make: *** [all] Error 1

I'm going to try to use Docker to fix this, if my Dockerfile looks good enough I'll create a PR so you can add it to the repo.

@89luca89
Copy link
Owner

89luca89 commented Mar 16, 2021

Seems to be for starters an incompatible flag between base64 from BSD coreutils and GNU Coreutils,
try installing base64 from GNU coreutils using this project:

https://github.com/fabiomaia/linuxify

EDIT: Obviously any PR is welcome :)

EDIT2: the -w flag is the culprit, it's needed to have a one-line base64 string, but it's exclusive to the GNU Version of base64
EDIT3: And the strip flags also, needs the GNU/Linux version for those flags

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

No branches or pull requests

3 participants