CGO build failing due to missing system libraries - go

I have a fairly simple issue: I am using CGO w/ GCC to build a project that depends on a package that binds to C (llvm-go). As a result of this, there are several libraries that this library needs to build that appear to be default Windows system libraries. Here is the error output:
gcc.exe: error: psapi.lib: No such file or directory
gcc.exe: error: shell32.lib: No such file or directory
gcc.exe: error: ole32.lib: No such file or directory
gcc.exe: error: uuid.lib: No such file or directory
gcc.exe: error: advapi32.lib: No such file or directory
gcc.exe: error: z.lib: No such file or directory
gcc.exe: error: libxml2.lib: No such file or directory
LLVM provides a tool that generates the link and include options for CGO for me. They are fairly numerous so pasting them here would be unwise.
I am using TDM GCC for Windows 10 with Go 1.16.
I don't know if there is an additional linker flag I need to add/remove to fix this issue. Let me know if you need any additional information. Thanks!

Related

I can't run boot0.s file using gcc command

I'm a total newbie in Ubuntu & Assembly Language. Recently one of the lab tasks asks me to compile .s file in Ubuntu to see what the output shows & explain them later. My teacher has also provided me some commands to compile and object linking with boot0.S file. But whenever I try to run this following command, I get several errors.
Building boot0: Compilation
$ gcc ‐MD ‐fno‐builtin ‐nostdinc ‐fno‐stack‐protector ‐Os ‐g ‐m32 ‐I. ‐c ‐o boot0.o boot0.S
It's giving me errors like these:
gazzali#ubuntu:~/OS Lab Task/OS-challenging-IUTCSE16/Project 0/boot/boot0$ gcc ‐MD ‐fno‐builtin ‐nostdinc ‐fno‐stack‐protector ‐Os ‐g ‐m32 ‐I. ‐c ‐o boot0.o boot0.S
gcc: error: ‐MD: No such file or directory
gcc: error: ‐fno‐builtin: No such file or directory
gcc: error: ‐nostdinc: No such file or directory
gcc: error: ‐fno‐stack‐protector: No such file or directory
gcc: error: ‐Os: No such file or directory
gcc: error: ‐g: No such file or directory
gcc: error: ‐m32: No such file or directory
gcc: error: ‐I.: No such file or directory
gcc: error: ‐c: No such file or directory
gcc: error: ‐o: No such file or directory
gcc: error: boot0.o: No such file or directory
I'm currently running Ubuntu 18.04 LTS on VMWare on Windows 10. I will also provide boot0.S file if needed. Can you please help to find a way to run this assembly file? There are more 2 assembly files which I need to run via similar commands.
Thanks in Advance.

Lua 5.1.5's Makefile Produces Errors for Me

If I try to run the Makefile that comes with the source of Lua 5.1.5, I get the following errors:
gcc: error: #: No such file or directory
gcc: error: DLL: No such file or directory
gcc: error: needs: No such file or directory
gcc: error: all: No such file or directory
gcc: error: object: No such file or directory
gcc: error: files: No such file or directory
What do these errors mean? I would try fixing this issue myself before asking this question, but I don't know how to interpret these errors. If more context is needed, here is the full output.
This is a bug recorded here.
Just edit Makefile and remove # DLL needs all object files.

MinGW gcc isn't able to compile a simple test program(same with cygwin) in CLion

I've just installed CLion and i needed compiler. I installed Cygwin.
But there was an error:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
CMake Error: Error executing cmake::LoadCache(). Aborting.
Error code: 1
So, CMake was "bundled" and i tried to install it from site. But there was the next error:
Selected CMake might be incompatible with the Cygwin environment.
In order to run on Cygwin, CMake needs to be specially compiled.
Please select either CMake bundled with CLion or CMake from the Cygwin installation.
CMake Error: The source directory "/cygdrive/c/Users/Пользователь/AppData/Local/Temp/cmake_check_environment" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
Error code: 1
Then i've tried to install MinGW - this time it was the following problem:
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe
-- Check for working C compiler: D:/MinGW/mingw64/bin/gcc.exe -- broken
CMake Error at D:/CLion 182.2574.4/bin/cmake/share/cmake-3.11/Modules/CMakeTestCCompiler.cmake:52 (message):
The C compiler
"D:/MinGW/mingw64/bin/gcc.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"D:/MinGW/mingw64/bin/mingw32-make.exe" "cmTC_a4ce5/fast"
D:/MinGW/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_a4ce5.dir\build.make CMakeFiles/cmTC_a4ce5.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj
D:\MinGW\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_a4ce5.dir\testCCompiler.c.obj -c C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\╨Я╨╛╨╗╤М╨╖╨╛╨▓╨░╤В╨╡╨╗╤М\AppData\Local\Temp\cmake_check_environment\_build\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
mingw32-make.exe[1]: *** [CMakeFiles\cmTC_a4ce5.dir\build.make:65: CMakeFiles/cmTC_a4ce5.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/╧юы№чютрЄхы№/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'
mingw32-make.exe: *** [Makefile:125: cmTC_a4ce5/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:1 (project)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Пользователь/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".
Error code: 1
In both cases it's problems with paths, i think. I tried to give root to CLion, gcc, etc. - nothing.
I've tried to find logs or just way to this path - but all was worthless - path doesn't exist.I just can't find out, why that's happening.
Help me, please
Looks like there is a problem with encodings somewhere between windows/cygwin/clion/cmake (I assume you user name is non-ascii).
As a quick workaround try:
installing CLion in the location without non-latin symbols
changing CLion's system and config folders to the location without non-latin symbols. instructions
And to troubleshoot the problem, could you please check if the cygwin's console shows the user home path correctly? (e.g. use ls /cygdrive/c/Users/, then cd to the user home path).
If Cygwin can correctly work with the user home, could you please file a bug report and attach CLion's log files? (Help | Show Log in Explorer)

How to use a .rc file?

I haven't used a .rc file yet. I was looking for how to set the filename/version/product name etc of a Qt assembly file, found this. I created an empty file named resources.rc and the version.h header and added in the .pro file RC_FILE = resources.rc. But when I went to build the application I get this error:
gcc: error: Message\: No such file or directory
gcc: error: Kernel: No such file or directory
windres: preprocessing failed.
Makefile.Release:158: recipe for target 'release/resources_res.o' failed
mingw32-make[1]: *** [release/resources_res.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Users/jack/Desktop/foo/build-Message Kernel-Desktop_Qt_5_5_0_MinGW_32bit-Release'
mingw32-make: *** [release] Error 2
makefile:34: recipe for target 'release' failed
00:43:58: The process "C:\Qt2\Qt5.5.0\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project Message Kernel (kit: Desktop Qt 5.5.0 MinGW 32bit)
When executing step "Make"
How do I fix this?
Found the error! Hope this is useful to anyone!
My project name contains white spaces, by looking carefully at compiler output tab (in Qt creator) I noticied that the path passed to windres utility wasn't surrounded by quotes (as a path with spaces in name should be) causing the error:
gcc: error: Message: No such file or directory
So I just removed the spaces from project name and this worked just fine.
Here's the Qt version this is happening:

ZMQ Compilation problems for C++ examples

I am trying to compile the ZMQ C++ source code examples provided at zmq.org (i.e. github.com/imatix/zguide.git). My OS is xubuntu and I installed ZMQ prerequisites which are libtool, autoconf, automake and uuid-dev package properly. I installed czmq as well. Compilation and linking of ZMQ itself was fine and libs are located properly under /usr/local/bin. Nevertheless, I am getting below compilation errors. Googling did not help much and I wonder if anyone knows a quick solution to these errors, which originates from the missing header file zmq.hpp. Thanks in advance.
$./build all
hwclient.cpp
hwclient.cpp:6:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
hwserver.cpp
hwserver.cpp:6:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
identity.cpp
identity.cpp:7:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
lbbroker.cpp
In file included from lbbroker.cpp:7:0:
zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
lpclient.cpp
In file included from lpclient.cpp:6:0:
zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
lpserver.cpp
In file included from lpserver.cpp:8:0:
zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
mdbroker.cpp
In file included from zmsg.hpp:35:0,
from mdbroker.cpp:7:
zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
compilation terminated.
mdclient.cpp
......
It looks zmq.hpp has been moved to another git repository beginning with ZMQ 3.2 which is available at https://github.com/zeromq/cppzmq. I have clonned this to same place where a previously extracted the ZMQ's tar ball. Then I created a symbolic link to zmq.hpp from the examples's C++ directory. Then examples compiled fine.
prem#~/Code/zeromq>ls
cppzmq-master.zip zguide zmqpp-develop zmqpp-develop.zip
prem#~/Code/zeromq>unzip cppzmq-master.zip
Archive: cppzmq-master.zip
235803740753312576495301ebf5b8ed76407173
creating: cppzmq-master/
inflating: cppzmq-master/LICENSE
inflating: cppzmq-master/README
inflating: cppzmq-master/zmq.hpp
prem#~/Code/zeromq>ls
cppzmq-master cppzmq-master.zip zguide zmqpp-develop zmqpp-develop.zip
prem#~/Code/zeromq>cd cppzmq-master/
prem#~/Code/zeromq/cppzmq-master>ls
prem#~/Code/zeromq/cppzmq-master>sudo cp zmq.hpp /usr/include/
prem#~/Code/zeromq/cppzmq-master>cd ~/Code/zeromq/zguide/examples/C++
prem#~/Code/zeromq/zguide/examples/C++>./build all
Building C++ examples...
hwclient.cpp
hwserver.cpp
identity.cpp
interrupt.cpp
...
prem#~/Code/zeromq/zguide/examples/C++>

Resources