Git Product home page Git Product logo

xgo's People

Contributors

6543 avatar absolutevalentine avatar aerth avatar bearsh avatar bhcleek avatar chy373 avatar coryb avatar dan-turner avatar dismantl avatar hallgren avatar howmp avatar ivan-w avatar jyap808 avatar karalabe avatar kolaente avatar leventov avatar lixingwang avatar lruggieri avatar micbis avatar pat-s avatar qianlifeng avatar sofuture avatar tamird avatar techknowlogick avatar tklkbot avatar vielmetti avatar vmasdani avatar wernerb avatar xoxys avatar zeripath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xgo's Issues

checkDockerImage can not find image

I have docker image techknowlogick/xgo locally
image

when I run xgo,I got this
image

and I check the source code
image
the image name has a goverison(default is latest) suffix, so xgo will not find the existed image whose name without the latest suffix

should we give this a PR?

xgo 1.18 build error

When I build with xgo 1.18, I get an error.
error obtaining VCS status: exit status 128 Use -builds=false to disable VCS stamping.

Error writing go.sum (read-only file system)

I've been building without go mod for a while. But after setting up go mod, I now get this error:

Checking for required docker image build-kafka... found.
Cross compiling go-repo/consumers/sendactions...
Building locally go-repo/consumers/sendactions...
Compiling for linux/amd64...
go: writing go.sum: open /ext-go/1/src/go-repo/go.sum747278511.tmp: read-only file system
2019/09/11 15:45:50 Failed to cross compile package: exit status 1.

I tried changing permissions on my go.sum (666), and then tried renaming it, and I still get the same error.

darwin/arm64 (aka Mac M1) support - sponsors needed

Now that macs are transitioning to M1 (arm64) architecture xgo needs to be updated to support the new target.

I already have devices for many other platforms (linux arm6/7/8, darwin amd64, windows amd64), however to start to support the M1s I'll need a device to test on.

I currently have a Github sponsors page https://github.com/sponsors/techknowlogick and I'll use any funds collected from there to purchase an M1 device. Tbh I'd get the cheapest option available (confirmed that the macmini m1 is cheapest).

I'll purchase the device once I receive enough funds. I'll announce once this threshold is matched in case you decide to only sponsor for that goal, and if I receive any extra I'll use those funds to support my OSS work.

xgo fails to build dgraph/badger on arm64

Description

When compiling with either go-1.15.8 or go-1.16.0 and target of linux/arm64, xgo fails for an unknown reason.

When the target is linux/amd64, I get success. Also when I use GOARCH=arm64 go build, I also get success.

Reproducing

When compiling with xgo, I used a command something like this:

export GOVERSION=1.15.8
export GOARCH=arm64
cd $GOPATH/src/github.com/dgraph-io
git clone https://github.com/dgraph-io/badger.git
cd badger
git checkout 6c35ad6c28e0

xgo -x -go="go-$GOVERSION" \
  --targets=linux/$GOARCH --tags=jemalloc \
  -deps=https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2  \
  --depsargs='--with-jemalloc-prefix=je_ --with-malloc-conf=background_thread:true,metadata_thp:auto --enable-prof' .

Expected Results

Both linux/arm64 and linux/amd64 targets would successfully build.

Actual Results

On linux/arm64, this fails without much indication as to why it failed, other than the cp command. Below is the last several lines where it failed, and full gist of the build output.

cd /go/pkg/mod/github.com/!data!dog/[email protected]
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x006.o -c debug.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x007.o -c divsufsort.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x008.o -c entropy_common.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x009.o -c error_private.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x010.o -c fastcover.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x011.o -c fse_compress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x012.o -c fse_decompress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x013.o -c hist.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x014.o -c huf_compress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x015.o -c huf_decompress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x016.o -c pool.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x017.o -c threading.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x018.o -c xxhash.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x019.o -c zbuff_common.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x020.o -c zbuff_compress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x021.o -c zbuff_decompress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x022.o -c zdict.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x023.o -c zstd_common.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x024.o -c zstd_compress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x025.o -c zstd_ddict.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x026.o -c zstd_decompress.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x027.o -c zstd_decompress_block.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x028.o -c zstd_double_fast.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x029.o -c zstd_fast.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x030.o -c zstd_lazy.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x031.o -c zstd_ldm.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x032.o -c zstd_opt.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x033.o -c zstd_v01.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x034.o -c zstd_v02.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x035.o -c zstd_v03.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x036.o -c zstd_v04.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x037.o -c zstd_v05.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x038.o -c zstd_v06.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x039.o -c zstd_v07.c
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I $WORK/b115/ -g -O2 -o $WORK/b115/_x040.o -c zstdmt_compress.c
cd $WORK/b115
TERM='dumb' aarch64-linux-gnu-gcc-6 -I /go/pkg/mod/github.com/!data!dog/[email protected] -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_cgo_main.o -c _cgo_main.c
cd /go/pkg/mod/github.com/!data!dog/[email protected]
TERM='dumb' aarch64-linux-gnu-gcc-6 -I . -fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b115=/tmp/go-build -gno-record-gcc-switches -o $WORK/b115/_cgo_.o $WORK/b115/_cgo_main.o $WORK/b115/_x001.o $WORK/b115/_x002.o $WORK/b115/_x003.o $WORK/b115/_x004.o $WORK/b115/_x005.o $WORK/b115/_x006.o $WORK/b115/_x007.o $WORK/b115/_x008.o $WORK/b115/_x009.o $WORK/b115/_x010.o $WORK/b115/_x011.o $WORK/b115/_x012.o $WORK/b115/_x013.o $WORK/b115/_x014.o $WORK/b115/_x015.o $WORK/b115/_x016.o $WORK/b115/_x017.o $WORK/b115/_x018.o $WORK/b115/_x019.o $WORK/b115/_x020.o $WORK/b115/_x021.o $WORK/b115/_x022.o $WORK/b115/_x023.o $WORK/b115/_x024.o $WORK/b115/_x025.o $WORK/b115/_x026.o $WORK/b115/_x027.o $WORK/b115/_x028.o $WORK/b115/_x029.o $WORK/b115/_x030.o $WORK/b115/_x031.o $WORK/b115/_x032.o $WORK/b115/_x033.o $WORK/b115/_x034.o $WORK/b115/_x035.o $WORK/b115/_x036.o $WORK/b115/_x037.o $WORK/b115/_x038.o $WORK/b115/_x039.o $WORK/b115/_x040.o -g -O2
TERM='dumb' /usr/local/go/pkg/tool/linux_amd64/cgo -dynpackage zstd -dynimport $WORK/b115/_cgo_.o -dynout $WORK/b115/_cgo_import.go
cat >$WORK/b115/importcfg << 'EOF' # internal
# import config
packagefile bytes=/usr/local/go/pkg/linux_arm64/bytes.a
packagefile errors=/usr/local/go/pkg/linux_arm64/errors.a
packagefile fmt=/usr/local/go/pkg/linux_arm64/fmt.a
packagefile io=/usr/local/go/pkg/linux_arm64/io.a
packagefile io/ioutil=/usr/local/go/pkg/linux_arm64/io/ioutil.a
packagefile runtime=/usr/local/go/pkg/linux_arm64/runtime.a
packagefile runtime/cgo=/usr/local/go/pkg/linux_arm64/runtime/cgo.a
packagefile syscall=/usr/local/go/pkg/linux_arm64/syscall.a
EOF
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b115/_pkg_.a -trimpath "$WORK/b115=>" -p github.com/DataDog/zstd -buildid JI4XFzGtRaO7UHQrFSf5/JI4XFzGtRaO7UHQrFSf5 -goversion go1.15.8 -D "" -importcfg $WORK/b115/importcfg -pack -c=4 $WORK/b115/_cgo_gotypes.go $WORK/b115/errors.cgo1.go $WORK/b115/zstd.cgo1.go $WORK/b115/zstd_stream.cgo1.go $WORK/b115/_cgo_import.go
/usr/local/go/pkg/tool/linux_amd64/pack r $WORK/b115/_pkg_.a $WORK/b115/_x001.o $WORK/b115/_x002.o $WORK/b115/_x003.o $WORK/b115/_x004.o $WORK/b115/_x005.o $WORK/b115/_x006.o $WORK/b115/_x007.o $WORK/b115/_x008.o $WORK/b115/_x009.o $WORK/b115/_x010.o $WORK/b115/_x011.o $WORK/b115/_x012.o $WORK/b115/_x013.o $WORK/b115/_x014.o $WORK/b115/_x015.o $WORK/b115/_x016.o $WORK/b115/_x017.o $WORK/b115/_x018.o $WORK/b115/_x019.o $WORK/b115/_x020.o $WORK/b115/_x021.o $WORK/b115/_x022.o $WORK/b115/_x023.o $WORK/b115/_x024.o $WORK/b115/_x025.o $WORK/b115/_x026.o $WORK/b115/_x027.o $WORK/b115/_x028.o $WORK/b115/_x029.o $WORK/b115/_x030.o $WORK/b115/_x031.o $WORK/b115/_x032.o $WORK/b115/_x033.o $WORK/b115/_x034.o $WORK/b115/_x035.o $WORK/b115/_x036.o $WORK/b115/_x037.o $WORK/b115/_x038.o $WORK/b115/_x039.o $WORK/b115/_x040.o # internal
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b115/_pkg_.a # internal
cp $WORK/b115/_pkg_.a /root/.cache/go-build/47/471dea8354ecb331e93244e8f87273d4804778c081e6f8431bfcebf56f1d726c-d # internal
2021/03/03 11:57:46 Failed to cross compile package: exit status 2.

Docker images change too often

I use it almost every half month. But almost every time I use it, I have to re-execute docker pull techknowlogick/ xgo. and it looks like Dockerfile is badly written. Having to download several gigabytes at a time.

This is very detrimental to a bad network. Hopefully it will improve.

Missing output file for Windows

Running on Ubuntu 18 using go-1.17.x image, Windows binary could not be compiled.


Reproduction:

git clone [email protected]:dnote/dnote
cd dnote
git checkout xgo-windows
./run.sh

Error:

...
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/b172/_pkg_.a -trimpath "$WORK/b172=
/cli/migrate -lang=go1.13 -complete -buildid HD31S4CDd86b_U_8o4Cc/HD31S4CDd86b_U_8o4Cc
WORK/b172/importcfg -pack -c=4 ./pkg/cli/migrate/legacy.go ./pkg/cli/migrate/migrate.go
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b107/_pkg_.a # internal
cp $WORK/b107/_pkg_.a /root/.cache/go-build/19/19e9655196bd599d704abd64ccb88c0342424f3d
ernal
/usr/local/go/pkg/tool/linux_amd64/buildid -w $WORK/b172/_pkg_.a # internal
cp $WORK/b172/_pkg_.a /root/.cache/go-build/59/592f236f90987e3f3b2a5181860cb8ce36d86792
ernal
Cleaning up build environment...
chown: cannot access '/build/github.com/dnote/dnote*': No such file or directory
2022/04/30 13:27:34 Failed to cross compile package: exit status 1.

Could not see any errors that stood out from the output.

I tried to come up with a minimal reproduction, but was not able to. Please see below for an unsuccessful reproduction (binary for Windows is present in this case)

git clone [email protected]:sungwoncho/xgo-windows.git
cd xgo-windows
./run

Support for ios/arm64 possible?

I want to compile a go project for iOS arm64 architecture. Original xgo has got support for iOS but the latest go version on it is too old.
Do you plan on adding support for ios/arm64?

Pass -trimpath flag to the Go toolchain

In Go 1.13 the -trimpath flag was added to strip the prefix from filesystem paths so that the resulting executable is filesystem layout independent. It looks like xgo does not offer a way to pass in custom compiler flags right now.

Should -trimpath become a flag recognised by xgo or should there be a way to add custom flags to the compiler?

go: go.mod file not found in current directory or any parent directory

I had used xgo to build my project for a long time. But two week ago, we upgrade from karalabe/xgo to techknowlogick/xgo , then I found all my project cannot compiled.

It gives the following errror:

Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling github.com/.../...
Building locally github.com/.../...
Compiling for linux/amd64...
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
2021/12/24 12:05:02 Failed to cross compile package: exit status 1.

My project is old styles Go project, and do not use go mod. So it's not a duplicated issue as #issue109 .

My xgo version is :

➜  wsq git:(master) go install src.techknowlogick.com/xgo@latest                                                               
go: downloading src.techknowlogick.com/xgo v1.4.1-0.20211213020332-0df875d8b7b9

the command:

xgo --targets=linux/amd64 -out myapp ./

how can i work with go.mod in parent directory

My Project Directory

agent
├── cfgparser
│   └── cfgparser.go
├── client
│   ├── cmdRunner
│   │   └── cmdRunner.go
│   ├── conf
│   │   └── conf.ini
│   ├── main.go
│   └── sqlRunner
│       └── sqlRunner.go
├── go.mod
├── go.sum
├── README.md
└── server
    ├── cmdHandler
    │   └── cmdHandler.go
    ├── conf
    │   ├── conf.ini
    │   ├── gbase8s_odbc.ini
    │   └── sourceenv
    ├── dbDriver
    │   ├── GBase8s
    │   │   └── GBase8s.go
    │   └── Informix
    │       ├── Informix.go
    │       └── pooling.go
    ├── main.go
    ├── sqlHandler
    │   └── sqlHandler.go
    ├── start.sh
    └── stop.sh

how can i compile module with mod.go in the parent directory

[root@gbasehost src]# xgo -go go-1.16.3 -v -ldflags="-extldflags=-static" -x --targets=linux/amd64 $GOPATH/src/agent
Checking docker installation...
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-205.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Apr 28 13:37:12 2021
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-205.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Apr 28 13:37:12 2021
 OS/Arch:         linux/amd64
 Experimental:    false

Checking for required docker image techknowlogick/xgo:go-1.16.3... found.
Cross compiling agent...
Enabled Go module support
[run --rm -v /home/testgo/src:/build -v /root/.xgo-cache:/deps-cache:ro -e REPO_REMOTE= -e REPO_BRANCH= -e PACK= -e DEPS= -e ARGS= -e OUT= -e FLAG_V=true -e FLAG_X=true -e FLAG_RACE=false -e FLAG_TAGS= -e FLAG_LDFLAGS=-extldflags=-static -e FLAG_BUILDMODE=default -e FLAG_TRIMPATH=false -e TARGETS=linux/amd64 -e GOPROXY= -e GO111MODULE=on -v /home/testgo:/go -v /home/testgo/src/agent:/source]
Building /source/go.mod...
Compiling for linux/amd64...
WORK=/tmp/go-build1406891538
no Go files in /source
Cleaning up build environment...

[root@gbasehost src]# xgo -go go-1.16.3 -v -ldflags="-extldflags=-static" -x --targets=linux/amd64 $GOPATH/src/agent/server
Checking docker installation...
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-205.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Apr 28 13:37:12 2021
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-205.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Apr 28 13:37:12 2021
 OS/Arch:         linux/amd64
 Experimental:    false

Checking for required docker image techknowlogick/xgo:go-1.16.3... found.
Cross compiling agent/server...
[run --rm -v /home/testgo/src:/build -v /root/.xgo-cache:/deps-cache:ro -e REPO_REMOTE= -e REPO_BRANCH= -e PACK= -e DEPS= -e ARGS= -e OUT= -e FLAG_V=true -e FLAG_X=true -e FLAG_RACE=false -e FLAG_TAGS= -e FLAG_LDFLAGS=-extldflags=-static -e FLAG_BUILDMODE=default -e FLAG_TRIMPATH=false -e TARGETS=linux/amd64 -e GOPROXY= -v /home/testgo/src:/ext-go/1/src:ro -e EXT_GOPATH=/ext-go/1]
Building locally agent/server...
Compiling for linux/amd64...
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
2021/05/19 10:41:11 Failed to cross compile package: exit status 1.

No such file or directory

Hi, I am having some troubles with xgo. I can't cross compile my Go project (https://github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go). I have ran the commands to install the docker containers and the software, but I keep getting the same error:

The command I am running: GO111MODULE=on /Users/bli24/go/bin/xgo github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go

Console Output:

bli24@macbook-air-2 Downloads % GO111MODULE=on /Users/bli24/go/bin/xgo github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go 
Checking docker installation...
Client:
 Cloud integration: v1.0.22
 Version:           20.10.11
 API version:       1.41
 Go version:        go1.16.10
 Git commit:        dea9396
 Built:             Thu Nov 18 00:36:09 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       847da18
  Built:            Thu Nov 18 00:35:39 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Checking for required docker image techknowlogick/xgo:latest... found.
Cross compiling github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go...
Fetching main repository github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go...
go: downloading github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go v0.0.0-20211227013202-ebbb4e4c77c6
/build.sh: line 91: cd: /go/src/github.com/MinecraftMediaLibrary/EzMediaCore-Native-Go: No such file or directory
2021/12/28 17:05:30 Failed to cross compile package: exit status 1.

I tried for other repositories too such as the one provided in the README.md. I still get the same issue. I've searched through Github issues but I can't find a solution. Does anyone know what could be wrong here?

Cross-compiling for darwin fails with "library not found for -lcrt0.o"

When cross-compiling for darwin with the newest version, building fails with these errors:

/usr/local/go/pkg/tool/linux_amd64/link: running o64-clang failed: exit status 1
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

2020/09/03 18:31:18 Failed to cross compile package: exit status 2.
Error: exit status 1

Full error message in CI.

The code is here.

This worked until recently so I'm not sure if this is a bug in my code or with xgo.

Feature: Support Go 1.18 workspaces

I have a project where I have been using xgo to cross-compile for Linux on MacOS for linking to Oracle client libraries.
I also have to use a 3rd party Go library that has local modifications to it. I had been using replace directive and keeping my code in GOPATH, but I'd like to be able to use the new Go 1.18 workspaces and ditch the GOPATH.

xgo fails to build with go-1.16.0

Currently with the default GO111MODULE="" and xgo -go=go-1.16.0 (techknowlogick/xgo:go-1.16.0), this will fail.

When using xgo -go=go-1.15.8 (techknowlogick/xgo:go-1.15.8), this works fine.

Expected Results

I expected that techknowlogick/xgo:go-1.16.0 would succeed.

Actual Results

go: cannot find main module; see 'go help modules'
2021/03/01 01:01:30 Failed to cross compile package: exit status 1.

Workaround

cat <<-EOF > xgo.Dockerfile
FROM techknowlogick/xgo:go-1.16.0
RUN go env -w GO111MODULE=auto
EOF
docker build -f xgo.Dockerfile -t happybuilds/xgo:1.16 .
xgo -image happybuilds/xgo:1.16 ... 

Links

Executables with dots in name show as "Document" on OSX

A minor one - OSX shows executables as "Document" or "Terminal Document" in Finder when the file has an unknown extension. Can be solved by replacing the dots with hyphen (or underscore). The file still executes as normal on double click, but it doesn't look good and satisfying 😄

build 1.12.6 error

base Dockerfile

https://github.com/gophers/xgo/tree/master/docker/base

1.12.6 Dockerfile

https://github.com/gophers/xgo/tree/master/docker/go-1.12.6

Build log

Building in Docker Cloud's infrastructure...
Cloning into '.'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
Reset branch 'master'
Your branch is up-to-date with 'origin/master'.
KernelVersion: 4.4.0-1060-aws
Components: [{u'Version': u'18.03.1-ee-3', u'Name': u'Engine', u'Details': {u'KernelVersion': u'4.4.0-1060-aws', u'Os': u'linux', u'BuildTime': u'2018-08-30T18:42:30.000000000+00:00', u'ApiVersion': u'1.37', u'MinAPIVersion': u'1.12', u'GitCommit': u'b9a5c95', u'Arch': u'amd64', u'Experimental': u'false', u'GoVersion': u'go1.10.2'}}]
Arch: amd64
BuildTime: 2018-08-30T18:42:30.000000000+00:00
ApiVersion: 1.37
Platform: {u'Name': u''}
Version: 18.03.1-ee-3
MinAPIVersion: 1.12
GitCommit: b9a5c95
Os: linux
GoVersion: go1.10.2
Starting build of index.docker.io/naiba/xgo:go-1.12.6...
Step 1/3 : FROM naiba/xgo:base
---> 0783b60d1b67
Step 2/3 : ENV GO_VERSION 1126
---> Running in dcd9e3df2915
Removing intermediate container dcd9e3df2915
---> 038734035d51
Step 3/3 : RUN export ROOT_DIST=https://storage.googleapis.com/golang/go1.12.6.linux-amd64.tar.gz && export ROOT_DIST_SHA=dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c && $BOOTSTRAP_PURE
---> Running in 027a6c6d44c9
Downloading https://storage.googleapis.com/golang/go1.12.6.linux-amd64.tar.gz...
go1.12.6.linux-amd64.tar.gz: OK
Bootstrapping linux/386...
Bootstrapping linux/arm64...
Bootstrapping linux/mips64...
Bootstrapping linux/mips64le...
Bootstrapping linux/mips...
Bootstrapping linux/mipsle...
Bootstrapping windows/amd64...
Bootstrapping windows/386...
Bootstrapping darwin/amd64...
# runtime/cgo
/usr/local/osx-ndk-x86/bin/x86_64-apple-darwin15-ld: error while loading shared libraries: libxar.so.1: cannot open shared object file: No such file or directory
clang: error: unable to execute command: No such file or directory
clang: error: linker command failed due to signal (use -v to see invocation)
Removing intermediate container 027a6c6d44c9
The command '/bin/sh -c export ROOT_DIST=https://storage.googleapis.com/golang/go1.12.6.linux-amd64.tar.gz && export ROOT_DIST_SHA=dbcf71a3c1ea53b8d54ef1b48c85a39a6c9a935d01fc8291ff2b92028e59913c && $BOOTSTRAP_PURE' returned a non-zero code: 2

can't load package: package .: no Go files in /root

Using a docker in docker setup throws this error:

Checking docker installation...
Client:
 Version:      17.05.0-ce
 API version:  1.29
 Go version:   go1.7.5
 Git commit:   89658be
 Built:        Thu May  4 22:09:06 2017
 OS/Arch:      linux/amd64

Server:
 Version:      19.03.2
 API version:  1.40 (minimum version 1.12)
 Go version:   go1.12.8
 Git commit:   6a30dfc
 Built:        Thu Aug 29 05:27:45 2019
 OS/Arch:      linux/amd64
 Experimental: false

Checking for required docker image techknowlogick/xgo:latest... not found!
Pulling techknowlogick/xgo:latest from docker registry...
latest: Pulling from techknowlogick/xgo
Digest: sha256:3c738e1309c6854de9fe1f299e79944b14f228179c16cac82141fa69b52e1abe
Status: Image is up to date for techknowlogick/xgo:latest
Cross compiling github.com/ethereum/go-ethereum/cmd/geth...
Building locally github.com/ethereum/go-ethereum/cmd/geth...
Compiling for linux/amd64...
can't load package: package .: no Go files in /root
2019/09/07 14:38:32 Failed to cross compile package: exit status 1.

Is it possible at all to run xgo inside a docker container?
Thanks.

Revert the mobile support

Hi @techknowlogick
thanks for the awesome fork. We are currently using it and it worked well so far

I have a request regarding mobile support: is there any chance that it will be back soon? If no could you please provide some context on why you decided to remove it?

Thanks in advance!

Add support for s390x and ppc64le

At the moment targets linux/s390x and linux/ppc64le are not supported.

They are missing in

  • build.sh
  • in the dockerFile which doesn't pull the s390x and ppc64le cross compilers.

Should be pretty straightforward. I'll do a PR if needed.

go: go.mod file not found in current directory or any parent directory

I get:

go: go.mod file not found in current directory or any parent directory

However:

bash-3.2$ ls go.mod
go.mod

The command:

xgo -x --deps https://www.sqlite.org/2020/sqlite-autoconf-3320300.tar.gz --depsargs '--disable-fts4 --disable-fts5 --disable-rtree --disable-static-shell' --pkg internal/log_analysis/datalake/database_api/snowflake/driver/main --targets=linux/amd64 -out main --tags 'libsqlite3 linux' -dest out/bin/internal/log_analysis/datalake/database_api/snowflake/driver/main .

Any ideas?

This worked with go 1.13 but now I have to move to 1.16 because of other changes in the code base.

Executable not found

When I try to run the compiled executable (I am targeting linux/mipsle) using './', I get the error " ./datsync-linux-mipsle: not found".(datsync is the name of my program) I have tried targeting darwin/amd64 (my Mac) and that works fine. Am I missing something with the linux/mipsle target? Any help is appreciated.

Issue installing private packages

Many thanks for extending the original xgo package and introducing go mod support.

I'm having an issue where private packages are not being installed on build. When trying to build, I get issues like this:

go: github.com/some_private_repo git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/...: exit status 128:
        fatal: could not read Username for 'https://github.com': terminal prompts disabled

Running go get works fine on the local machine since I have in the ~/.gitconfig file:

[url "ssh://[email protected]/"]
	insteadOf = https://github.com/

Any ideas?

Support -gcflags flags

Recently, I need to debug a go program with -gcflgas="all=-N -l", unfortunately, xgo doesn't support this flag(-ldflags is supported). Please add -gcflags support. If you are busy, I can make a pull request, thx.

Vendoring broke with new image

I just pulled xgo:latest and now I cannot build with vendoring anymore. I get the following error message

Enabled Go module support
Using vendored Go module dependencies
Building /source/go.mod...
sed: can't read /source/go.mod: No such file or directory
Compiling for darwin-10.12/amd64...

Support custom C library install script

Right now the README says that only C libraries that are based on configure and make can be used. It'd be nice if a script could be specified that would be used to build the library instead.

For example I am wondering about cross-compiling gocv which requires the OpenCV library, which is built like so:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS} -D OPENCV_EXTRA_MODULES_PATH=$(TMP_DIR)opencv/opencv_contrib-$(OPENCV_VERSION)/modules -D BUILD_DOCS=OFF -D BUILD_EXAMPLES=OFF -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_opencv_java=OFF -D BUILD_opencv_python=NO -D BUILD_opencv_python2=NO -D BUILD_opencv_python3=NO -D ENABLE_VFPV2=ON -D WITH_JASPER=OFF -D OPENCV_GENERATE_PKGCONFIG=ON ..
$(MAKE) -j $(shell nproc --all)
$(MAKE) preinstall

Build changes the owner of files to root

Hi, thanks for extending the package.

I tested your version today and found that it changes the permissions of a few files on my system.

After the build, the following files were assigned to the root user:

  • go.sum
  • go.mod
  • All created executable files
  • A few dependencies in $GOPATH/pkg

After that I could no longer build without xgo because I lacked the necessary permissions.

My system:

  • Arch Linux
  • go 1.12.1
  • with go modules

I think it would be best if xgo does not change the owner, but instead takes over the current one.

Server certificate verification failed

I'm having trouble using xgo to compile my project, WriteFreely. It only occurs when trying to pull dependencies from a git repository that uses a Let's Encrypt certificate. So based on the error message, I believe it's caused by the new Let's Encrypt root certificate changes from late last year, and the xgo Docker image not containing that.

Is there something I can do to work around this?

Steps to reproduce

Get the https://github.com/writefreely/writefreely repository. Checkout hotfix-0.13.2 branch.

Run this:

xgo --targets=linux/amd64 -go go-1.15.x -out writefreely ./cmd/writefreely

I get the following output:

Checking docker installation...
Client: Docker Engine - Community
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:45:33 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:42 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Checking for required docker image techknowlogick/xgo:go-1.15.x... found.
Cross compiling github.com/writefreely/writefreely/cmd/writefreely...
Building locally github.com/writefreely/writefreely/cmd/writefreely...
Compiling for linux/amd64...
go: github.com/manifoldco/[email protected] requires
        gopkg.in/[email protected]: invalid version: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/9241c28341fcedca6a799ab7a465dd6924dc5d94044cbfabb75778817250adfc: exit status 128:
        fatal: unable to access 'https://gopkg.in/check.v1/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
2022/04/29 14:56:38 Failed to cross compile package: exit status 1.

Go module support with vendor directory is apparently not working

Create a main that uses a module

package main

import (
        "fmt"

        "github.com/dustin/go-humanize"
)

func main() {
   fmt.Printf("%s\n", humanize.IBytes(100000))
}

Init and generate the vendor directory

go mod init
go mod vendor

Compile with xgo

GOPATH=~/go xgo -x -v -go go-1.14.2 --targets=darwin/amd64 .

Examine the output of xgo, you'll see that it fails to detect the use of modules by the lack of Enabled Go module support output and that the go modules are downloaded again. This is a big probem when private repo's are included in the module dependency list, as neither GOPRIVATE nor the vendor directory can be used.

Part of the problem is that the compile path is normalized which prevents the directory stat from working correctly. Passing in the full path rather than . doesn't help.

EDIT: The directory containing the module is at the location ~/go/src/github.com/<user name>/test

go get is deprecated in 1.17

go get is deprecated in Go 1.17, and has to be replaced with go install.

Screenshot from 2021-08-21 08-07-09

using this command, it's correct

go install src.techknowlogick.com/xgo@latest

I've made a PR here
#133

xgo 1.16 fails to crosscompile darwin/amd64

I'm cross-compiling an application using xgo. After migrating to go-1.16 building darwin/amd64 fails with the following error:

#85 82.23 Undefined symbols for architecture x86_64:
#85 82.23   "_clock_gettime", referenced from:
#85 82.23       _runtime.walltime_trampoline in go.o
#85 82.23 ld: symbol(s) not found for architecture x86_64
#85 82.23 clang: error: linker command failed with exit code 1 (use -v to see invocation)
#85 82.23 
#85 82.27 2021/02/17 19:35:02 Failed to cross compile package: exit status 2.

Windows and Linux for amd64 (I do not target other architectures currently) still build.

My build command looks like this:

RUN xgo --targets=darwin/amd64 --tags 'osusergo netgo static_build sqlite_omit_load_extension' --ldflags="-linkmode external -extldflags '' -s -w -X github.com/offen/offen/server/config.Revision=485f7f7" github.com/offen/offen/server/cmd/offen:

Is this specific to the code I am trying to compile or is this a general problem in the 1.16 version of xgo?

clang / SDK mismatch?

I'm getting these errors when cross compiling to darwin using the latest 1.16 docker image:

/osxcross/target/bin/../SDK/MacOSX11.1.sdk/usr/include/os/availability.h:105:33: note: expanded from macro 'API_UNAVAILABLE_END'
    #define API_UNAVAILABLE_END _Pragma("clang attribute pop")

I'd read it could be that the version of clang being used is too old to support new pragmas. Any ideas?

Go 1.15 based cross compilation fails with "copy_file_range: operation not permitted"

I'm cross compiling an app using this Docker image for a while now (thank you for maintaining the fork!). I just tried upgrading to Go 1.15 (techknowlogick/xgo:go-1.15.x) which made compilation fail for reasons I do not fully understand. The error message I am seeing is:

Compiling for linux/amd64...

... modules being downloaded...

# github.com/offen/offen/server/cmd/offen
/usr/local/go/pkg/tool/linux_amd64/link: cannot write /tmp/go-link-617276537/000004.o: write /tmp/go-link-617276537/000004.o: copy_file_range: operation not permitted
/usr/local/go/pkg/tool/linux_amd64/link: cannot write /tmp/go-link-617276537/000023.o: write /tmp/go-link-617276537/000023.o: copy_file_range: operation not permitted
2020/08/19 16:33:27 Failed to cross compile package: exit status 2.

This builds as expected with techknowlogick/xgo:go-1.14.x.

The build command I am running is:

RUN xgo --targets=linux/amd64,windows/amd64 --tags 'osusergo netgo static_build sqlite_omit_load_extension' --ldflags="-linkmode external -extldflags '-static' -s -w -X github.com/offen/offen/server/config.Revision=$GIT_REVISION" github.com/offen/offen/server/cmd/offen

Digging through the Go 1.15 release notes I cannot find anything that could be causing this or build flags I would need to adjust, so I am kind of stumped on how to debug this further. Did anyone else encounter this since upgrading? Do you have any pointer about what might be causing this?


You can find the full build output here: https://app.circleci.com/pipelines/github/offen/offen/2614/workflows/ef98696e-244b-4ab0-9879-8cf22d3fde37/jobs/17686

When compiling local module based package i get "unknown import path" error

I have a local module based code base with CGO dependancies, which builds on my host OS (OSX). I am working with it outside the GOPATH which is why I am using this fork. My packages import path is, let's say, "github.com/foo/bar". I have a cmd directory, with a "server" command, which would then be at "github.com/foo/bar/cmd/server". My xgo command is something like:

xgo -targets=linux/amd64 -out dist/linux/hsmserver ./cmd/server

but it fails with:

can't load package: package github.com/foo/bar: unknown import path "github.com/foo/bar": cannot find module providing package github.com/foo/bar

build windows/amd64 with main.syso seems not work

Use github.com/lxn/walk to build windows gui program on macos.

There's a main.syso in my project and use "xgo -ldflags="-H windowsgui" -targets=windows/amd64 ." to build.
All seems ok, but the exe crash when i open it on windows. the lxn/walk's log show icon resource notFoundErr.

I build same project use 'go build -ldflags="-H windowsgui"' on windows,the exe can open(icon load successful).

Did xgo not support build with syso file?

xgo -v:

Checking docker installation...
Client: Docker Engine - Community
 Version:           19.03.1
 API version:       1.40
 Go version:        go1.12.5
 Git commit:        74b1e89
 Built:             Thu Jul 25 21:18:17 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.1
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.5
  Git commit:       74b1e89
  Built:            Thu Jul 25 21:17:52 2019
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.2.6
  GitCommit:        894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc:
  Version:          1.0.0-rc8
  GitCommit:        425e105d5a03fabd737a126ad93d62a9eeede87f
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Allow export customs environments variables and local files

Currently xgo can use a local path of the project and use the local GOPATH environment variable, but some require dependencies like this ibm driver: https://github.com/ibmdb/go_ibm_db

The driver requires some custom environments variables and set CGO_CFLAGS, CGO_LDFLAGS and LD_LIBRARY_PATH (linux) and DYLD_LIBRARY_PATH (darwin)

The path of the clidriver (the dependencies) can be in any path.

Is possible to export or set in docker other locals environments variables from xgo and read the local content like the project to build content?

How to deal with this to build the project in linux or darwin?

Cross Compiling to Mac M1

When I compile to mac M1, the resulting binary doesn't seem to run.

I assume the docker image is using osxcross? Another cross-compiler I tried, https://github.com/crazy-max/docker-osxcross would use o64-clang, when I think oa64-clang is required as the CC argument when compiling to darwin/arm64.

Am I missing something obvious? Does this buildchain work OK for others?

option to mount go build cache directory

Would be great to have an option to mount container's /root/.cache/go-build directory somewhere, as it will allow users to use Go build caching mechanism to speed up builds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.