Not working with WSL
aidenesco opened this issue · comments
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.
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?
@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
.
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?
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
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.
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