This question already has answers here:
Cross compiling from Windows to other OSs
(2 answers)
Closed 1 year ago.
All the examples I've found so far assume you are using a Mac and compile for the other platforms.
As stated you can set the GOOS and GOARCH.
you can check all the distro using the following go command
go tool dist list
How to build the application for MacOS
GOOS=darwin GOARCH=amd64 go build main.go
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am developing a tool using the clang library on Linux and I would like to port this tool to Windows.
On Linux, I can install Clang from the LLVM repositories using apt-get clang-6.0-dev and simply link my tool with -lclang. I do not need to compile LLVM and Clang myself.
Is there a way to do something similar on Windows, or do I need to compile the Clang library myself?
All of the Clang-related posts I could find are about using clang as a tool, not as a library.
I have installed the pre-build executables for Clang and LLVM from the LLVM website, and these work nicely in combination with mingw. However, the download for Windows does not seem to include the Clang library as a separate file (DLL), and linking with -lclang results in a linker error.
If there is no pre-built library for Windows, what is the best way to proceed, preferably using mingw and not MSVC?
There are pre-built LLVM/clang binaries on Zig's github page:
https://github.com/ziglang/zig/wiki/Building-Zig-on-Windows
You can find libclang.dll in the bin folder.
The currently available versions are:
llvm+clang-6.0.0-win64-msvc-release.tar.xz
llvm+clang-7.0.0-win64-msvc-release.tar.xz
llvm+clang-8.0.0-win64-msvc-release.tar.xz
llvm+clang-9.0.0-win64-msvc-release.tar.xz
llvm+clang+lld-10.0.0-x86_64-windows-msvc-release-mt.tar.xz
There are also detailed build instructions, here.
For anyone coming to this question that's just looking to install libclang on their system, the choco llvm package appears to install libclang correctly. I can't speak to whether this is adequate for actually linking against this library for C/C++, but it worked for my case.
Just run this in an elevated command prompt or powershell:
choco install llvm
You may need to run refreshenv or open a new console for tools to pick this up.
In my case, and to help with future googlers (since I couldn't find a simple answer elsewhere) my issue was specifically while trying to compile a Rust project that made use of the onig_sys crate:
Compiling onig_sys v69.2.0
error: failed to run custom build command for `onig_sys v69.2.0`
Caused by:
process didn't exit successfully: `[redacted]\target\debug\build\onig_sys-b53394f57ee5e2c5\build-script-build` (exit code: 101)
--- stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: The system cannot find the file specified. (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
--- stderr
thread 'main' panicked at 'Unable to find libclang: "couldn\'t find any valid shared libraries matching: [\'clang.dll\', \'libclang.dll\'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src\libcore\result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
After installing llvm, the cargo build finished successfully
I am using Go 1.6 on OSX 10.11.4 and trying to cross compile my go program for windows and linux. I use a library (https://github.com/pebbe/zmq4) in my go program which is a Go binding for a C based implementation. I followed the instructions to cross compile for x86 windows as listed here by issuing the following command:
env GOOS=windows GOARCH=386 go build -v znode.go
However the above command gives me the following error
znode.go:15:2: C source files not allowed when not using cgo or SWIG: dummy.c
Is there a workaround for this? I saw other posts on stackoverflow which suggest moving to go1.5 but i am already on go1.6
FWIW after six years ... user720694's comment has the clue. If there are any .c or .cpp/cc/etc. files in the build directory, adding CGO_ENABLED=0 before go build does the trick.
This question already has answers here:
What does go build build? (go build vs. go install)
(2 answers)
Closed 7 years ago.
I used go build to generate files. But I can only generate main, which mean go build main.go works while go build dao.go does not generate anything?
How can I generate dao?
From go help build:
When the command line specifies a single main package,
build writes the resulting executable to output.
Otherwise build compiles the packages but discards the results,
serving only as a check that the packages can be built.
This question already has answers here:
Setting up scala with IntelliJ
(8 answers)
Closed 9 years ago.
NB: Marking this question as duplicate was faulty given it ignores the comment I made here in the OP:
From the OP: Yes there is a similar question Setting up scala with IntelliJ that answers a portion of this one - particularly as relates to brew defined paths. But that but it pertains to IJ 11 for which the scala configuration is quite different.
I am missing some step to properly configure scala on OS X 10.8.4 for IJ Ultimate 12.1.4.
The following shows that scala has been installed (via brew):
mellyrn:~ steve$ brew install scala
Warning: scala-2.10.2 already installed
The scala compiler is set to 'external build':
Following screenshot shows interpreter is 'missing' the basic scala libraries:
Following shows the library missing in the scala facet:
here is what works for me in intellij idea 12.1.4 community edition
open Project Structure
add a java library named "scala-library" which includes all the scala-*.jar in the lib directory of your scala installation
in the scala facet -> Compiler library, select "scala-library" you just created in the dropdown list
This question already has answers here:
How to delete all contents of a folder with Ruby-Rails?
(3 answers)
Closed 9 years ago.
I have a Ubuntu 13.04 system and want to install cross compiler to build the same source code to Windows platform (x86).
I don't know where to start.
Also, I need to set the path for cross compiler in eclipse.
You need to include fileutils first-
Then use rm_rf() method -
require 'fileutils'
FileUtils.rm_rf('your_directory_path/filename')
Check more options for the module -
http://www.ruby-doc.org/stdlib-2.0/libdoc/fileutils/rdoc/FileUtils.html
You can also use rm_r() for deletion.