~eliasnaur/gio#165: 
Gio cross-compilation for linux, build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files

Hello,

So I am having issues cross compiling for linux and other platforms as I get the above error.

Following the comment on https://lists.sr.ht/~eliasnaur/gio/%3C1591186246741.35915%40wil.waw.pl%3E, you recommended that CGO_ENABLED be set to 1, I have done that and this does not seem to resolve this issue for me.

Is there something I am missing?

<<< Error log >>>

GOOS=linux GOARCH=amd64 go build -o godcr-linux-amd64 build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=linux GOARCH=386 go build -o godcr-linux-386 build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=linux GOARCH=ppc64 go build -o godcr-linux-ppc64 build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=linux GOARCH=ppc64le go build -o godcr-linux-ppc64le build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=linux GOARCH=mips64 go build -o godcr-linux-mips64 build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=linux GOARCH=mips64le go build -o godcr-linux-mips64le build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files GOOS=freebsd GOARCH=amd64 go build -o godcr-freebsd-amd64 build gioui.org/app/internal/glimpl: cannot load gioui.org/app/internal/glimpl: no Go source files

Status
RESOLVED INVALID
Submitter
~sirmorrison
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.

~eliasnaur 2 years ago

I don't see your CGO_ENABLED=1 in your commands. What is your OS and Go version?

What does

$ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build

say?

~sirmorrison 2 years ago

What is your OS and Go version? go version go1.13.5 darwin/amd64

This out are for different platforms, linux, freebsd, openbsd etc.

CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o godcr-linux-amd64

#pkg-config --cflags -- xkbcommon

Package xkbcommon was not found in the pkg-config search path. Perhaps you should add the directory containing `xkbcommon.pc' to the PKG_CONFIG_PATH environment variable No package 'xkbcommon' found pkg-config: exit status 1

#pkg-config --cflags -- glesv2

Package glesv2 was not found in the pkg-config search path. Perhaps you should add the directory containing `glesv2.pc' to the PKG_CONFIG_PATH environment variable No package 'glesv2' found pkg-config: exit status 1

#os/user

/usr/local/go/src/os/user/getgrouplist_unix.go:16:35: warning: passing 'gid_t *' (aka 'unsigned int *') to parameter of type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:650:43: note: passing argument to parameter here

CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -o godcr-linux-386

#runtime/cgo

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS) ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libpthread.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libpthread.tbd Undefined symbols for architecture i386: "___stack_chk_fail", referenced from: _x_cgo_init in _x006.o __cgo_sys_thread_start in _x006.o "___stack_chk_guard", referenced from: _x_cgo_init in _x006.o __cgo_sys_thread_start in _x006.o "___stderrp", referenced from: _fatalf in _x004.o _x_cgo_sys_thread_create.cold.1 in _x005.o _x_cgo_thread_start.cold.1 in _x009.o _fatalf in _x004.o _x_cgo_sys_thread_create.cold.1 in _x005.o _x_cgo_thread_start.cold.1 in _x009.o _fatalf in _x004.o _x_cgo_sys_thread_create.cold.1 in _x005.o _x_cgo_thread_start.cold.1 in _x009.o "_abort", referenced from: _fatalf in _x004.o _x_cgo_sys_thread_create.cold.1 in _x005.o _x_cgo_thread_start.cold.1 in _x009.o "_fprintf", referenced from: _x_cgo_sys_thread_create.cold.1 in _x005.o "_free", referenced from: _threadentry in _x006.o "_fwrite$UNIX2003", referenced from: _fatalf in _x004.o _x_cgo_thread_start.cold.1 in _x009.o "_malloc", referenced from: _x_cgo_thread_start in _x009.o "_nanosleep$UNIX2003", referenced from: _x_cgo_sys_thread_create in _x005.o __cgo_try_pthread_create in _x005.o "_pthread_attr_destroy", referenced from: _x_cgo_init in _x006.o "_pthread_attr_getstacksize", referenced from: _x_cgo_init in _x006.o __cgo_sys_thread_start in _x006.o "_pthread_attr_init", referenced from: _x_cgo_init in _x006.o __cgo_sys_thread_start in _x006.o "_pthread_cond_broadcast", referenced from: _x_cgo_notify_runtime_init_done in _x005.o "_pthread_cond_wait$UNIX2003", referenced from: __cgo_wait_runtime_init_done in _x005.o "_pthread_create", referenced from: _x_cgo_sys_thread_create in _x005.o __cgo_try_pthread_create in _x005.o (maybe you meant: __cgo_try_pthread_create) "_pthread_detach", referenced from: _x_cgo_sys_thread_create in _x005.o __cgo_try_pthread_create in _x005.o "_pthread_mutex_lock", referenced from: __cgo_wait_runtime_init_done in _x005.o _x_cgo_notify_runtime_init_done in _x005.o _x_cgo_set_context_function in _x005.o __cgo_get_context_function in _x005.o "_pthread_mutex_unlock", referenced from: __cgo_wait_runtime_init_done in _x005.o _x_cgo_notify_runtime_init_done in _x005.o _x_cgo_set_context_function in _x005.o __cgo_get_context_function in _x005.o "_pthread_sigmask$UNIX2003", referenced from: __cgo_sys_thread_start in _x006.o "_setenv$UNIX2003", referenced from: _x_cgo_setenv in _x007.o "_strerror$UNIX2003", referenced from: _x_cgo_sys_thread_create.cold.1 in _x005.o __cgo_sys_thread_start in _x006.o "_unsetenv$UNIX2003", referenced from: _x_cgo_unsetenv in _x007.o "_vfprintf", referenced from: _fatalf in _x004.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

CGO_ENABLED=1 GOOS=linux GOARCH=ppc64 go build -o godcr-linux-ppc64

#runtime/cgo

gcc_linux_ppc64x.S:27:7: error: invalid register name mflr %r0 ^ gcc_linux_ppc64x.S:28:6: error: invalid register name std %r0, 16(%r1) ^ gcc_linux_ppc64x.S:29:6: error: invalid register name std %r2, 24(%r1) ^ gcc_linux_ppc64x.S:30:2: error: invalid instruction mnemonic 'bl' bl saveregs ^~ gcc_linux_ppc64x.S:31:7: error: invalid register name stdu %r1, -296(%r1) ^ gcc_linux_ppc64x.S:34:2: error: invalid instruction mnemonic 'bl' bl _cgo_reginit ^~ gcc_linux_ppc64x.S:38:5: error: invalid register name mr %r30, %r4 ^~ gcc_linux_ppc64x.S:41:11: error: invalid register name mr %r12, %r3 ^ gcc_linux_ppc64x.S:42:8: error: invalid register name mtctr %r3 ^ gcc_linux_ppc64x.S:43:2: error: invalid instruction mnemonic 'bctrl' bctrl ^ gcc_linux_ppc64x.S:45:7: error: invalid register name addi %r1, %r1, 296 ^ gcc_linux_ppc64x.S:46:2: error: invalid instruction mnemonic 'bl' bl restoreregs ^~ gcc_linux_ppc64x.S:47:5: error: invalid register name ld %r2, 24(%r1) ^ gcc_linux_ppc64x.S:48:5: error: invalid register name ld %r0, 16(%r1) ^ gcc_linux_ppc64x.S:49:7: error: invalid register name mtlr %r0 ^ gcc_linux_ppc64x.S:50:2: error: invalid instruction mnemonic 'blr' blr ^ gcc_linux_ppc64x.S:55:17: error: invalid register name std %r14, -288(%r1) ^ gcc_linux_ppc64x.S:56:17: error: invalid register name std %r15, -280(%r1) ^ gcc_linux_ppc64x.S:57:6: error: invalid register name std %r16, -272(%r1) ^~ gcc_linux_ppc64x.S:58:6: error: invalid register name std %r17, -264(%r1) ^~ gcc_linux_ppc64x.S:59:6: error: invalid register name std %r18, -256(%r1) ^~ gcc_linux_ppc64x.S:60:6: error: invalid register name std %r19, -248(%r1) ^~ gcc_linux_ppc64x.S:61:6: error: invalid register name std %r20, -240(%r1) ^~ gcc_linux_ppc64x.S:62:6: error: invalid register name std %r21, -232(%r1) ^~ gcc_linux_ppc64x.S:63:6: error: invalid register name std %r22, -224(%r1) ^~ gcc_linux_ppc64x.S:64:6: error: invalid register name std %r23, -216(%r1) ^~ gcc_linux_ppc64x.S:65:6: error: invalid register name std %r24, -208(%r1) ^~ gcc_linux_ppc64x.S:66:6: error: invalid register name std %r25, -200(%r1) ^~ gcc_linux_ppc64x.S:67:6: error: invalid register name std %r26, -192(%r1) ^~ gcc_linux_ppc64x.S:68:6: error: invalid register name std %r27, -184(%r1) ^~ gcc_linux_ppc64x.S:69:6: error: invalid register name std %r28, -176(%r1) ^~ gcc_linux_ppc64x.S:70:6: error: invalid register name std %r29, -168(%r1) ^~ gcc_linux_ppc64x.S:71:6: error: invalid register name std %r30, -160(%r1) ^~ gcc_linux_ppc64x.S:72:6: error: invalid register name std %r31, -152(%r1) ^~ gcc_linux_ppc64x.S:73:7: error: invalid register name stfd %f14, -144(%r1) ^~ gcc_linux_ppc64x.S:74:7: error: invalid register name stfd %f15, -136(%r1) ^~ gcc_linux_ppc64x.S:75:7: error: invalid register name stfd %f16, -128(%r1) ^~ gcc_linux_ppc64x.S:76:7: error: invalid register name stfd %f17, -120(%r1) ^~ gcc_linux_ppc64x.S:77:7: error: invalid register name stfd %f18, -112(%r1) ^~ gcc_linux_ppc64x.S:78:7: error: invalid register name stfd %f19, -104(%r1) ^~ gcc_linux_ppc64x.S:79:7: error: invalid register name stfd %f20, -96(%r1) ^~ gcc_linux_ppc64x.S:80:7: error: invalid register name stfd %f21, -88(%r1) ^~ gcc_linux_ppc64x.S:81:7: error: invalid register name stfd %f22, -80(%r1) ^~ gcc_linux_ppc64x.S:82:7: error: invalid register name stfd %f23, -72(%r1) ^~ gcc_linux_ppc64x.S:83:7: error: invalid register name stfd %f24, -64(%r1) ^~ gcc_linux_ppc64x.S:84:7: error: invalid register name stfd %f25, -56(%r1) ^~ gcc_linux_ppc64x.S:85:7: error: invalid register name stfd %f26, -48(%r1) ^~ gcc_linux_ppc64x.S:86:7: error: invalid register name stfd %f27, -40(%r1) ^~ gcc_linux_ppc64x.S:87:7: error: invalid register name stfd %f28, -32(%r1) ^~ gcc_linux_ppc64x.S:88:7: error: invalid register name stfd %f29, -24(%r1) ^~ gcc_linux_ppc64x.S:89:7: error: invalid register name stfd %f30, -16(%r1) ^~ gcc_linux_ppc64x.S:90:7: error: invalid register name stfd %f31, -8(%r1) ^~ gcc_linux_ppc64x.S:92:2: error: invalid instruction mnemonic 'blr' blr ^ gcc_linux_ppc64x.S:96:16: error: invalid register name ld %r14, -288(%r1) ^ gcc_linux_ppc64x.S:97:16: error: invalid register name ld %r15, -280(%r1) ^ gcc_linux_ppc64x.S:98:5: error: invalid register name ld %r16, -272(%r1) ^~ gcc_linux_ppc64x.S:99:5: error: invalid register name ld %r17, -264(%r1) ^~ gcc_linux_ppc64x.S:100:5: error: invalid register name ld %r18, -256(%r1) ^~ gcc_linux_ppc64x.S:101:5: error: invalid register name ld %r19, -248(%r1) ^~ gcc_linux_ppc64x.S:102:5: error: invalid register name ld %r20, -240(%r1) ^~ gcc_linux_ppc64x.S:103:5: error: invalid register name ld %r21, -232(%r1) ^~ gcc_linux_ppc64x.S:104:5: error: invalid register name ld %r22, -224(%r1) ^~ gcc_linux_ppc64x.S:105:5: error: invalid register name ld %r23, -216(%r1) ^~ gcc_linux_ppc64x.S:106:5: error: invalid register name ld %r24, -208(%r1) ^~ gcc_linux_ppc64x.S:107:5: error: invalid register name ld %r25, -200(%r1) ^~ gcc_linux_ppc64x.S:108:5: error: invalid register name ld %r26, -192(%r1) ^~ gcc_linux_ppc64x.S:109:5: error: invalid register name ld %r27, -184(%r1) ^~ gcc_linux_ppc64x.S:110:5: error: invalid register name ld %r28, -176(%r1) ^~ gcc_linux_ppc64x.S:111:5: error: invalid register name ld %r29, -168(%r1) ^~ gcc_linux_ppc64x.S:112:5: error: invalid register name ld %r30, -160(%r1) ^~ gcc_linux_ppc64x.S:113:5: error: invalid register name ld %r31, -152(%r1) ^~ gcc_linux_ppc64x.S:114:6: error: invalid register name lfd %f14, -144(%r1) ^~ gcc_linux_ppc64x.S:115:6: error: invalid register name lfd %f15, -136(%r1) ^~ gcc_linux_ppc64x.S:116:6: error: invalid register name lfd %f16, -128(%r1) ^~ gcc_linux_ppc64x.S:117:6: error: invalid register name lfd %f17, -120(%r1) ^~ gcc_linux_ppc64x.S:118:6: error: invalid register name lfd %f18, -112(%r1) ^~ gcc_linux_ppc64x.S:119:6: error: invalid register name lfd %f19, -104(%r1) ^~ gcc_linux_ppc64x.S:120:6: error: invalid register name lfd %f20, -96(%r1) ^~ gcc_linux_ppc64x.S:121:6: error: invalid register name lfd %f21, -88(%r1) ^~ gcc_linux_ppc64x.S:122:6: error: invalid register name lfd %f22, -80(%r1) ^~ gcc_linux_ppc64x.S:123:6: error: invalid register name lfd %f23, -72(%r1) ^~ gcc_linux_ppc64x.S:124:6: error: invalid register name lfd %f24, -64(%r1) ^~ gcc_linux_ppc64x.S:125:6: error: invalid register name lfd %f25, -56(%r1) ^~ gcc_linux_ppc64x.S:126:6: error: invalid register name lfd %f26, -48(%r1) ^~ gcc_linux_ppc64x.S:127:6: error: invalid register name lfd %f27, -40(%r1) ^~ gcc_linux_ppc64x.S:128:6: error: invalid register name lfd %f28, -32(%r1) ^~ gcc_linux_ppc64x.S:129:6: error: invalid register name lfd %f29, -24(%r1) ^~ gcc_linux_ppc64x.S:130:6: error: invalid register name lfd %f30, -16(%r1) ^~ gcc_linux_ppc64x.S:131:6: error: invalid register name lfd %f31, -8(%r1) ^~~~ gcc_linux_ppc64x.S:133:2: error: invalid instruction mnemonic 'blr' blr

~sirmorrison 2 years ago

CGO_ENABLED=1 GOOS=linux GOARCH=ppc64le go build -o godcr-linux-ppc64le

#runtime/cgo

gcc_linux_ppc64x.S:27:7: error: invalid register name mflr %r0 ^ gcc_linux_ppc64x.S:28:6: error: invalid register name std %r0, 16(%r1) ^ gcc_linux_ppc64x.S:29:6: error: invalid register name std %r2, 24(%r1) ^ gcc_linux_ppc64x.S:30:2: error: invalid instruction mnemonic 'bl' bl saveregs ^~ gcc_linux_ppc64x.S:31:7: error: invalid register name stdu %r1, -296(%r1) ^ gcc_linux_ppc64x.S:34:2: error: invalid instruction mnemonic 'bl' bl _cgo_reginit ^~ gcc_linux_ppc64x.S:38:5: error: invalid register name mr %r30, %r4 ^~ gcc_linux_ppc64x.S:41:11: error: invalid register name mr %r12, %r3 ^ gcc_linux_ppc64x.S:42:8: error: invalid register name mtctr %r3 ^ gcc_linux_ppc64x.S:43:2: error: invalid instruction mnemonic 'bctrl' bctrl ^ gcc_linux_ppc64x.S:45:7: error: invalid register name addi %r1, %r1, 296 ^ gcc_linux_ppc64x.S:46:2: error: invalid instruction mnemonic 'bl' bl restoreregs ^~ gcc_linux_ppc64x.S:47:5: error: invalid register name ld %r2, 24(%r1) ^ gcc_linux_ppc64x.S:48:5: error: invalid register name ld %r0, 16(%r1) ^ gcc_linux_ppc64x.S:49:7: error: invalid register name mtlr %r0 ^ gcc_linux_ppc64x.S:50:2: error: invalid instruction mnemonic 'blr' blr ^ gcc_linux_ppc64x.S:55:17: error: invalid register name std %r14, -288(%r1) ^ gcc_linux_ppc64x.S:56:17: error: invalid register name std %r15, -280(%r1) ^ gcc_linux_ppc64x.S:57:6: error: invalid register name std %r16, -272(%r1) ^~ gcc_linux_ppc64x.S:58:6: error: invalid register name std %r17, -264(%r1) ^~ gcc_linux_ppc64x.S:59:6: error: invalid register name std %r18, -256(%r1) ^~ gcc_linux_ppc64x.S:60:6: error: invalid register name std %r19, -248(%r1) ^~ gcc_linux_ppc64x.S:61:6: error: invalid register name std %r20, -240(%r1) ^~ gcc_linux_ppc64x.S:62:6: error: invalid register name std %r21, -232(%r1) ^~ gcc_linux_ppc64x.S:63:6: error: invalid register name std %r22, -224(%r1) ^~ gcc_linux_ppc64x.S:64:6: error: invalid register name std %r23, -216(%r1) ^~ gcc_linux_ppc64x.S:65:6: error: invalid register name std %r24, -208(%r1) ^~ gcc_linux_ppc64x.S:66:6: error: invalid register name std %r25, -200(%r1) ^~ gcc_linux_ppc64x.S:67:6: error: invalid register name std %r26, -192(%r1) ^~ gcc_linux_ppc64x.S:68:6: error: invalid register name std %r27, -184(%r1) ^~ gcc_linux_ppc64x.S:69:6: error: invalid register name std %r28, -176(%r1) ^~ gcc_linux_ppc64x.S:70:6: error: invalid register name std %r29, -168(%r1) ^~ gcc_linux_ppc64x.S:71:6: error: invalid register name std %r30, -160(%r1) ^~ gcc_linux_ppc64x.S:72:6: error: invalid register name std %r31, -152(%r1) ^~ gcc_linux_ppc64x.S:73:7: error: invalid register name stfd %f14, -144(%r1) ^~ gcc_linux_ppc64x.S:74:7: error: invalid register name stfd %f15, -136(%r1) ^~ gcc_linux_ppc64x.S:75:7: error: invalid register name stfd %f16, -128(%r1) ^~ gcc_linux_ppc64x.S:76:7: error: invalid register name stfd %f17, -120(%r1) ^~ gcc_linux_ppc64x.S:77:7: error: invalid register name stfd %f18, -112(%r1) ^~ gcc_linux_ppc64x.S:78:7: error: invalid register name stfd %f19, -104(%r1) ^~ gcc_linux_ppc64x.S:79:7: error: invalid register name stfd %f20, -96(%r1) ^~ gcc_linux_ppc64x.S:80:7: error: invalid register name stfd %f21, -88(%r1) ^~ gcc_linux_ppc64x.S:81:7: error: invalid register name stfd %f22, -80(%r1) ^~ gcc_linux_ppc64x.S:82:7: error: invalid register name stfd %f23, -72(%r1) ^~ gcc_linux_ppc64x.S:83:7: error: invalid register name stfd %f24, -64(%r1) ^~ gcc_linux_ppc64x.S:84:7: error: invalid register name stfd %f25, -56(%r1) ^~ gcc_linux_ppc64x.S:85:7: error: invalid register name stfd %f26, -48(%r1) ^~ gcc_linux_ppc64x.S:86:7: error: invalid register name stfd %f27, -40(%r1) ^~ gcc_linux_ppc64x.S:87:7: error: invalid register name stfd %f28, -32(%r1) ^~ gcc_linux_ppc64x.S:88:7: error: invalid register name stfd %f29, -24(%r1) ^~ gcc_linux_ppc64x.S:89:7: error: invalid register name stfd %f30, -16(%r1) ^~ gcc_linux_ppc64x.S:90:7: error: invalid register name stfd %f31, -8(%r1) ^~ gcc_linux_ppc64x.S:92:2: error: invalid instruction mnemonic 'blr'

~sirmorrison 2 years ago

Done.

~eliasnaur REPORTED INVALID 2 years ago

I'm sorry, but cross-compiling projects that require Cgo such as Gio require a cross compiler. See for example https://rakyll.org/cross-compilation/. It is usually easier to not cross-compiler and just build your binaries on the target system. So for GOOS=linux you should build on a Linux system.

Register here or Log in to comment, or comment via email.