xgo | Go CGO cross compiler | Compiler library
kandi X-RAY | xgo Summary
kandi X-RAY | xgo Summary
Although Go strives to be a cross platform language, cross compilation from one platform to another is not as simple as it could be, as you need the Go sources bootstrapped to each platform and architecture. The first step towards cross compiling was Dave Cheney's golang-crosscompile package, which automatically bootstrapped the necessary sources based on your existing Go installation. Although this was enough for a lot of cases, certain drawbacks became apparent where the official libraries used CGO internally: any dependency to third party platform code is unavailable, hence those parts don't cross compile nicely (native DNS resolution, system certificate access, etc). A step forward in enabling cross compilation was Alan Shreve's gonative package, which instead of bootstrapping the different platforms based on the existing Go installation, downloaded the official pre-compiled binaries from the golang website and injected those into the local toolchain. Since the pre-built binaries already contained the necessary platform specific code, the few missing dependencies were resolved, and true cross compilation could commence... of pure Go code. However, there was still one feature missing: cross compiling Go code that used CGO itself, which isn't trivial since you need access to OS specific headers and libraries. This becomes very annoying when you need access only to some trivial OS specific functionality (e.g. query the CPU load), but need to configure and maintain separate build environments to do it.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xgo
xgo Key Features
xgo Examples and Code Snippets
Community Discussions
Trending Discussions on xgo
QUESTION
I've written a small go program to be run on a MIPS 32-bit router. I'm able to get a basic hello world program running on the router using the go build toolchain.
...ANSWER
Answered 2019-May-14 at 17:23I'm unsure how to interpret this
Google for "MIPS sdc1" shows that this is a floating-point "Store Doubleword from Coprocessor-1" instruction.
A guess: your embedded system doesn't have a floating-point co-processor?
You would likely need to add -msoft-float
to your xgo
command and rebuild.
Update:
it is crashing on the same
sdc1
call, the registers are the same$f20,56(a0)
.
Yes, but is in the same function (__sigsetjmp_aux
), or in some different one?
Here is the call I'm building with xgo:
xgo --go=1.12 --targets=linux/mips --ldflags '-extldflags "-static -msoft-float"' ~/path/to/project
It looks like the routine __sigsetjmp_aux
is coming from GLIBC, which is not built by xgo
.
And the version of GLIBC you are using was built without -msoft-float
, so you are still linking in the code that expects hardware floating point, that your system lacks.
Step 1: verify where __sigsetjmp_aux
is coming from. To do so, you need to pass -y __sigsetjmp_aux
to the linker. Maybe --ldflags '-extldflags "-static -msoft-float -Wl,-y,__sigsetjmp_aux"'
will do that.
You should see something similar to this:
QUESTION
I've been working on this for a while, this is what I've got so far... this code doesn't work. This code is just for reference. The assignment is a maze without walls. I have to use a recursive algorithm. Each space has a number, when I land on a space, that number tells me how much I can move in a specific direction. I have to return the path. (I already did the version where I return True or False if there is a solution.) I can't seem to return the path itself.
...ANSWER
Answered 2018-Mar-01 at 15:24Some things to note:
contrary to how
vis
is passed as argument and needs to maintain its state throughout the recursive search, this is not howpath
should work: it should be a local variable that only takes the return value from the recursive call and prepends the current cell (start
) to it.vis
should not be adeque
, but aset
, which is more suitable for quickly knowing whether a cell was visited before.
Here is how you could code it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xgo
A handful of flags can be passed to go build. The currently supported ones are.
-v: prints the names of packages as they are compiled
-x: prints the build commands as compilation progresses
-race: enables data race detection (supported only on amd64, rest built without)
-tags='tag list': list of build tags to consider satisfied during the build
-ldflags='flag list': arguments to pass on each go tool link invocation
-buildmode=mode: binary type to produce by the compiler
By default xgo will try and build the specified package to all platforms and architectures supported by the underlying Go runtime. If you wish to restrict the build to only a few target systems, use the comma separated --targets CLI argument:.
--targets=linux/arm: builds only the ARMv5 Linux binaries (arm-6/arm-7 allowed)
--targets=windows/*,darwin/*: builds all Windows and OSX binaries
--targets=*/arm: builds ARM binaries for all platforms
--targets=*/*: builds all suppoted targets (default)
Platforms: android, darwin, ios, linux, windows
Achitectures: 386, amd64, arm-5, arm-6, arm-7, arm64, mips, mipsle, mips64, mips64le
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page