Error compiling GO project for windows using mingw32 on ubuntu - windows

I am trying to build go for windows (CGO_ENABLED =1) using mingw32 on ubuntu but not able to compile the binary.
Error:
/usr/bin/x86_64-w64-mingw32-ld: cannot find -ldl: No such file or directory /usr/bin/x86_64-w64-mingw32-ld: cannot find -ldl: No such file or directory collect2: error: ld returned 1 exit status
Command used:
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CXX=x86_64-w64-mingw32-g++ CC=x86_64-w64-mingw32-gcc go build

Related

Unable to build project for ESP32

I am trying to build project esp-obd-emulator I always get the following error, maybe someone can help me with that.
I am using esp-idf to build project.
C:\Users\edvar\Desktop\esp-idf-2\examples\emu>idf.py build
Checking Python dependencies...
Python requirements from C:\Users\edvar\Desktop\esp-idf-2\requirements.txt are satisfied.
Executing action: all (aliases: build)
Running ninja in directory c:\users\edvar\desktop\esp-idf-2\examples\emu\build
Executing "ninja all"...
[1/5] Performing build step for 'bootloader'
ninja: no work to do.
[2/3] Linking CXX executable emu.elf
FAILED: emu.elf
cmd.exe /C "cd . && C:\Users\edvar\.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe -mlongcalls -Wno-frame-address -nostdlib #CMakeFiles\emu.elf.rsp -o emu.elf && cd ."
c:/users/edvar/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp32/libesp32.a(cpu_start.c.obj):(.literal.main_task+0x18): undefined reference to `app_main'
c:/users/edvar/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/esp32/libesp32.a(cpu_start.c.obj): in function `main_task':
C:/Users/edvar/Desktop/esp-idf-2/components/esp32/cpu_start.c:539: undefined reference to `app_main'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
esp-obd-emulator seems to not have been ported to ESP-IDF 2.0; it seems to still be using Make instead of CMake. Either compile this with an old version of ESP-IDF, or ask it to be updated to CMake.

linker command failed when building plugin

When I try to build a golang plugin on macOS Catalina using go 1.13.4, the build process breaks with the following error:
$ make buildPlugin
env GOOS=linux go build -buildmode=plugin -o bin/common common/*.go
# command-line-arguments
/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [buildPlugin] Error 2
✘ $ go tool cgo -V
cgo version go1.13.4
Removing env GOOS=linux helps but it is not a solution. Any ideas about the reason for this problem?

resource.rc: No such file or directory

I'm setting CodeBlocks with wxWidgets, but enountered problems when compile an empty project:
resource.rc: No such file or directory
However, when I creat win32GUI project instead of wxWidgets, I could compile and run an empty GUI.
I installed CodeBlocks 17.12 on the path (D:\GreenSoft\CodeBlocks)
Add the “D:\GreenSoft\CodeBlocks\MinGW\bin” to the path environment variable.
Download the wxWidgets3.1.2 source code to “D:\GreenSoft\wxWidgets\wxWidgets312\”
cd to “D:\GreenSoft\wxWidgets\wxWidgets312\build\msw”, and run command:
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1 CXXFLAGS=-fno-keep-inline-dllexport
After compile finished, I run the OpenBlocks and add a project wxWidget with several options:
wxWidgets 3.1.*
Project Title: App
Prefered GUI builder: wxSmith
Application type: frame-based
wxWidgets location: D:\GreenSoft\wxWidgets\wxWidgets312
Compiler: GUN GCC compiler
Create Debug…
Create Release…
With three wxWidgets Library settings checked only
Then an empty GUI panel appeared in CodeBlocks.
I do nothing but click the compile button, and error appeared:
It says that
gcc: error: D:QMDownloadrmdCsrrresource.rc: No such file or directory
But I checked that the file D:\QMDownload\rmdCs\App\resource.rc exist , and its textcontent is:
aaaa ICON "wx/msw/std.ico"
include "wx/msw/wx.rc"
I have found a post with the same issue and make sure that no blank space and special character exist in all the paths, but the problem still exist.
-------------- Build: Debug in App (compiler: GNU GCC Compiler)---------------
windres.exe -ID:\GreenSoft\wxWidgets\wxWidgets312\include -ID:\GreenSoft\wxWidgets\wxWidgets312\lib\gcc_dll\mswu -J rc -O coff -i D:\QMDownload\rmdCs\App\resource.rc -o obj\Debug\resource.res
x86_64-w64-mingw32-g++.exe -LD:\GreenSoft\wxWidgets\wxWidgets312\lib\gcc_dll -o bin\Debug\App.exe obj\Debug\AppApp.o obj\Debug\AppMain.o obj\Debug\resource.res -mthreads -lwxmsw31u -mwindows
gcc: error: D:QMDownloadrmdCsAppresource.rc: No such file or directory
gcc: warning: '-x c' after last input file has no effect
gcc: fatal error: no input files
compilation terminated.
windres: preprocessing failed.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 1 warning(s) (0 minute(s), 0 second(s))

Compiling Makefile on Mac vs Linux

I compiled my makefile for my C++ program on my Mac and it compiled just fine. I tried doing the same thing on my Linux machine with the exact same files and got:
/usr/bin/ld: cannot find -lc++abi
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [allocate-asan] Error 1
I do not know how I can go about compiling this on my linux machine with this error. Any ideas?

GODI-Batteries: Installation problems

I am trying to install godi-batteries using GODI console. I seem to have all dependencies sorted (like Camomile). I get the following error within Godi's interface:
> ocamlfind ocamlopt -shared -linkall -package camomile,num,str -o src/batteries_uni.cmxs src/batteries_uni.cmxa
> + ocamlfind ocamlopt -shared -linkall -package camomile,num,str -o src/batteries_uni.cmxs src/batteries_uni.cmxa
> ld: warning: -read_only_relocs cannot be used with x86_64
> ld: codegen problem, can't use rel32 to external symbol _caml_negf_mask in .L101 from src/batteries_uni.a(batFloat.o)
> collect2: ld returned 1 exit status
> File "caml_startup", line 1, characters 0-1:
> Error: Error during linking
> Command exited with code 2.
> make[7]: *** [all] Error 10
> Error: Exec error: File /Users/surikator/godi/build/godi/godi-batteries/./../../mk/bsd.pkg.mk, line 1039: Command returned with non-zero exit code
> Error: Exec error: File /Users/surikator/godi/build/godi/godi-batteries/./../../mk/bsd.pkg.mk, line 1378: Command returned with non-zero exit code
I'm using Mac OS X 10.6.4. and I have a 64 bit machine.
Any ideas on how to go around this?
Thanks,
Surikator.
For some reason, OSX OCaml can't build shared libraries. You'll have to disable batteries' building of shared libraries with
BATTERIES_NATIVE_SHLIB=no make
This problem has been fixed in git commit 92b323, and will be included in the next release.

Resources