I'm trying to release my project in both linux and windwos machines without success.
I have tried to explicitly define the -CC to few options but non of them worked in both machines.
Pre installed packages:
sudo apt-get install build-essential
sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install gcc-mingw-w64
In the project i'm using c code which uses these flags in order to selective compilation
//#cgo windows CFLAGS: "-IC:/Program Files/OpenSSL-Win64/include"
//#cgo windows LDFLAGS: "-LC:/Program Files/OpenSSL-Win64/lib" -llibcrypto
//#cgo linux LDFLAGS: -lssl -lcrypto
//#cgo CFLAGS: -Wno-deprecated-declarations
running GoRelaser locally on windows machine will result this error.
⨯ release failed after 24.28s error=failed to build for windows_arm64: exit status 2: # runtime/cgo
gcc_arm64.S: Assembler messages:
gcc_arm64.S:28: Error: no such instruction: `stp x29,x30,[sp,'
gcc_arm64.S:32: Error: too many memory references for `mov'
gcc_arm64.S:34: Error: no such instruction: `stp x19,x20,[sp,'
gcc_arm64.S:37: Error: no such instruction: `stp x21,x22,[sp,'
gcc_arm64.S:40: Error: no such instruction: `stp x23,x24,[sp,'
gcc_arm64.S:43: Error: no such instruction: `stp x25,x26,[sp,'
gcc_arm64.S:46: Error: no such instruction: `stp x27,x28,[sp,'
gcc_arm64.S:50: Error: too many memory references for `mov'
gcc_arm64.S:51: Error: too many memory references for `mov'
gcc_arm64.S:52: Error: too many memory references for `mov'
gcc_arm64.S:54: Error: no such instruction: `blr x20'
gcc_arm64.S:55: Error: no such instruction: `blr x19'
gcc_arm64.S:57: Error: no such instruction: `ldp x27,x28,[sp,'
gcc_arm64.S:60: Error: no such instruction: `ldp x25,x26,[sp,'
gcc_arm64.S:63: Error: no such instruction: `ldp x23,x24,[sp,'
gcc_arm64.S:66: Error: no such instruction: `ldp x21,x22,[sp,'
gcc_arm64.S:69: Error: no such instruction: `ldp x19,x20,[sp,'
gcc_arm64.S:72: Error: no such instruction: `ldp x29,x30,[sp],'
⨯ release failed after 24.28s error=failed to build for windows_arm64: exit status 2: # runtime/cgo
gcc_arm64.S: Assembler messages:
gcc_arm64.S:28: Error: no such instruction: `stp x29,x30,[sp,'
gcc_arm64.S:32: Error: too many memory references for `mov'
gcc_arm64.S:34: Error: no such instruction: `stp x19,x20,[sp,'
gcc_arm64.S:37: Error: no such instruction: `stp x21,x22,[sp,'
gcc_arm64.S:40: Error: no such instruction: `stp x23,x24,[sp,'
gcc_arm64.S:43: Error: no such instruction: `stp x25,x26,[sp,'
gcc_arm64.S:46: Error: no such instruction: `stp x27,x28,[sp,'
gcc_arm64.S:50: Error: too many memory references for `mov'
gcc_arm64.S:51: Error: too many memory references for `mov'
gcc_arm64.S:52: Error: too many memory references for `mov'
gcc_arm64.S:54: Error: no such instruction: `blr x20'
gcc_arm64.S:55: Error: no such instruction: `blr x19'
gcc_arm64.S:57: Error: no such instruction: `ldp x27,x28,[sp,'
gcc_arm64.S:60: Error: no such instruction: `ldp x25,x26,[sp,'
gcc_arm64.S:63: Error: no such instruction: `ldp x23,x24,[sp,'
gcc_arm64.S:66: Error: no such instruction: `ldp x21,x22,[sp,'
gcc_arm64.S:69: Error: no such instruction: `ldp x19,x20,[sp,'
gcc_arm64.S:72: Error: no such instruction: `ldp x29,x30,[sp],'
running GoReleaser locally on ubuntu machine will result
gcc: error: unrecognized command line option ‘-mthreads’; did you mean ‘-pthread’?
GoReleaser:
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=1
goos:
- linux
- windows
archives:
- replacements:
linux: Linux
windows: Windows
386: i386
amd64: x86_64
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
By default GoReleaser will attempt to make builds for 386, amd64 and arm64. But your windows machine is likey an amd64/x86_64 machine. Normally this is no issue with Go, but since you are using CGO your C toolchain has to support compilation for arm64, which it doesn't.
You should be able to limit the CPU architectures it attempts to build by adding goarch to your config file:
...
builds:
goarch:
- amd64
...
Cross compiling cgo projects is notoriously difficult and a known limitation of GoReleaser. I recommend taking a look at the cgo cookbook if you have not already done so.
As for the error you are getting on ubuntu, it looks like you C toolchain doesn't have the right dependencies/capabilities to cross compile to windows.
I have not done any CGO cross compilation myself(attempt to avoid it at all costs) so I can't vouch for this tool, but from what I am reading online xgo might be able to help you out.
Related
AS arch/arm64/mm/proc.o
../arch/arm64/mm/proc.S: Assembler messages:
../arch/arm64/mm/proc.S:283: Error: unknown mnemonic `pte_to_phys' -- `pte_to_phys cur_pmdp,pud'
../arch/arm64/mm/proc.S:302: Error: unknown mnemonic `pte_to_phys' -- `pte_to_phys cur_ptep,pmd'
Fixing an issue error build
I am using MacOSbigsur, Macbook Pro, M1 Chip,
I installed Virtual box the latest version 6.1.26r145957, use this command for confirmation (VBoxManage --version).
I installed Vagrant 2.2.18, use this command for confirmation (Vagrant --version).
I clone the repo from https://box.scotch.io/, and then type on terminal "vagrant up"
Following an error occurs, I try many solutions available on the internet but not fixed. I uninstall both software and re-install did not work for me, permission is ok from system preference.
There was an error while executing VBoxManage, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open
/dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component
HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp
Possible Solution: sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
when I run this command its shows the following errors
Loading VBoxDrv.kext
Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Error: Failed to load org.virtualbox.kext.VBoxDrv
Loading VBoxUSB.kext
Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Error: Failed to load org.virtualbox.kext.VBoxUSB
Loading VBoxNetFlt.kext
Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Error: Failed to load org.virtualbox.kext.VBoxNetFlt
Loading VBoxNetAdp.kext
Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Error: Failed to load org.virtualbox.kext.VBoxNetAdp
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxNetAdp
Error occurred unloading extensions: Missing extension with identifier org.virtualbox.kext.VBoxNetAdp : Incompatible
architecture: Binary is for x86_64, but needed arch arm64e
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxNetFlt
Error occurred unloading extensions: Missing extension with identifier org.virtualbox.kext.VBoxNetFlt : Incompatible
architecture: Binary is for x86_64, but needed arch arm64e
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxUSB
Error occurred unloading extensions: Missing extension with identifier org.virtualbox.kext.VBoxUSB : Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Executing: /usr/bin/kmutil unload -b org.virtualbox.kext.VBoxDrv
Error occurred unloading extensions: Missing extension with identifier org.virtualbox.kext.VBoxDrv : Incompatible architecture: Binary is for x86_64, but needed arch arm64e
Fatal error: VirtualBox
I had a similar error.
Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 95 of file VBoxManageHostonly.cpp
Was able resolve simply by going to security settings and adding allow from Oracle.
For me this occurred after updating Mac OS, Oracle VB and Vagrant. Currently on Mac Os Monterey 12.3.1
I'm building a project from github (https://github.com/marsicoLab/PROmiRNA) and have the following requirements on my mac (Big Sur 11.4); gcc 9.4, cmake 3.21.1, R 4.1.0.
After using cmake, which runs without error, I use make however this gives me the below errors:
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang: note: diagnostic msg: Error generating preprocessed source(s).
make[2]: *** [CMakeFiles/PROmiRNA.dir/PROmiRNA.cpp.o] Error 254
make[1]: *** [CMakeFiles/PROmiRNA.dir/all] Error 2
make: *** [all] Error 2
A lot of other questions online with the same issue refer to XCode but I don't have it installed and am not a developer myself so don't think I need it..?
If anyone has any suggestions I'd really appreciate it, thanks :)
I am using Ubuntu 18.04.2 LTS under windows 10 by using "Windows subsystem for Linux." I am experiencing some issues with XV6.
I set up XV6 by using the command:
git clone git://pdos.csail.mit.edu/xv6/xv6.git
sudo apt-get install libc6-dev
chmod 700 -R xv6-riscv
But when I typed in make command, I having the following issue:
***
*** Error: Couldn't find an riscv64 version of GCC/binutils.
*** To turn off this error, run 'gmake TOOLPREFIX= ...'.
***
gcc -c -o kernel/entry.o kernel/entry.S
kernel/entry.S: Assembler messages:
kernel/entry.S:17: Error: no such instruction: `la sp,stack0'
kernel/entry.S:18: Error: no such instruction: `li a0,1024*4'
kernel/entry.S:19: Error: no such instruction: `csrr a1,mhartid'
kernel/entry.S:20: Error: no such instruction: `addi a1,a1,1'
kernel/entry.S:21: Error: too many memory references for `mul'
kernel/entry.S:22: Error: too many memory references for `add'
kernel/entry.S:26: Error: no such instruction: `j junk'
<builtin>: recipe for target 'kernel/entry.o' failed
make: *** [kernel/entry.o] Error 1
Can anyone help me with this? (I am using an x64 system)
you should check this link: https://pdos.csail.mit.edu/6.828/2019/tools.html
for me I am running ubuntu, so I compiled the toolchain myself and then it works
I was running MacOS and had the same error. I solved it by updating the ~/.bashrc with:
PATH=$PATH:/usr/local/opt/riscv-gnu-toolchain/bin
before sourcing it or open a new interactive session. Then make qemu under xv6-riscv just ran!
So I would suggest you go back and check if you've finished each step: install toolchain, update env vars, source, and make.
For Suse you can install cross-riscv64-gccX package, where X is the gcc version
Then use
TOOLPREFIX=/usr/bin/riscv64-suse-linux-
it worked for me
I'm trying to build a 64-bit version of libpython27.a from python27.dll on Windows 7 x64.
Following these instructions, I tried:
E:\temp>gendef python27.dll
* [python27.dll] Found PE+ image
E:\temp>dlltool --as-flags=--64 -m i386:x86-64 -k --output-lib libpython27.a --i
nput-def python27.def
Assembler messages:
Fatal error: no compiled in support for x86_64
dlltool: as exited with status 1
dlltool: failed to open temporary head file: dgtnh.o: No such file or directory
What can explain Fatal error: no compiled in support for x86_64?
I see:
E:\temp>dlltool -h
Usage dlltool <option(s)> <object-file(s)>
-m --machine <machine> Create as DLL for <machine>. [default: i386:x86-64]
possible <machine>: arm[_interwork], i386, mcore[-elf]{-le|-be}, ppc, thumb
-e --output-exp <outname> Generate an export file.
Does the issue come from the fact possible <machine> does not contain x86_64, and if so where to find a dlltool.exe that supports x86_64?