Rust: x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3 - gcc

I'm trying to use GLFW with rust on windows and I'm getting this error upon running the program:
error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1
|
= note: "x86_64-w64-mingw32-gcc" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" (then a ton of other stuff that leaks my files)
= note: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3
collect2.exe: error: ld returned 1 exit status
All I am doing in the program is importing the package.
I have been trying to solve this for a while, and it doesn't help that I'm very new to rust. I guess this is what I get with trying to use rust on windows.
Thanks for your help!

Add a -L<path> linker flag where <path> points to the folder containing libglfw3.a (or libglfw3.dll.a in case of shared library).

Related

Can't build gem5 (ARM) due to missing -lgrpc++

I am trying to build gem5 (ARM) using
scons build/ARM/gem5.opt -j 1
But I keep getting this error
/usr/bin/ld: cannot find -lgrpc++
collect2: error: ld returned 1 exit status
scons: *** [build/ARM/gem5.opt] Error 1
scons: building terminated because of errors.
I can't seem to find any information on this missing file. It's not anywhere in the computer afaik and google isn't helping much either
It looks like you need to instal the grpc package. It contains the missing file, libgrpc++.so, most likely in /usr/lib/libgrpc++.so. See also Ubuntu packages site: https://packages.ubuntu.com/source/impish/misc/grpc

ld.exe: cannot find -lscrap_sys when I try to compile go-scrap

I've been trying to compile the go-scrap program on windows, but I've always got the following error
C:/Program
Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
cannot find -lscrap_sys collect2.exe: error: ld returned 1 exit status
From what I understand, the lscrap library on windows is needed.
Does anyone know what are the correct steps to compile the go-scrap program on windows correctly?

xgo cross compile not working for alsa-lib

Note: I have also created this as an issue for xgo here, but I thought it might be better suited as an SO question.
I am trying to cross compile my go application and one of the dependencies is the alsa.lib. I cannot get this to sucessfully compile using xgo.
Initially I tried with this command:
xgo --targets=linux/*,windows/*,darwin/* -deps=ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.8.tar.bz2 github.com/Lynges/susimup
And that produced this error:
/deps-build/alsa-lib-1.1.8/src/pcm/pcm_softvol.c:856: undefined reference to 'pow'
collect2: error: ld returned 1 exit status
2019/04/11 22:51:27 Failed to cross compile package: exit status 2
So then I added the depsargs to get --with-softfloat and that moved it along to a new error:
/deps-build/alsa-lib-1.1.8/src/pcm/pcm_meter.c:674: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
And that is where I am stuck now.
I have tried adding some more arguments like mentioned in the comment to this answer, but that just gave me a warning:
configure: WARNING: unrecognized options: --disable-alsamixer, --disable-xmto, --disable-nls, --disable-bat
So now I really have no idea what to do. I just want to cross compile my very simple app for arm so that it may be used on a Raspberry pi.

undefined reference to `CefURLRequest::Create(CefRefPtr<CefRequest>, CefRefPtr<CefURLRequestClient>)'

I am trying to build CEF in Release mode but I get the following linker error:
AR(target)
/home/adminuser/temp/build/linux/Release/obj.target/libcef_dll_wrapper.a
LINK(target) /home/adminuser/temp/build/linux/Release/cefclient
/home/adminuser/temp/build/linux/Release/ldb.a(ldbJS.o): In function
LdbURLLoader::LoadURL(std::string)': ldbJS.cpp:(.text+0x34e):
undefined reference toCefURLRequest::Create(CefRefPtr,
CefRefPtr)' collect2: error: ld returned 1 exit
status make: *** [/home/adminuser/temp/build/linux/Release/cefclient]
Error 1
I don't get this problem when building the Debug version so I am not quite sure how to resolve it. I tried various #pragma directives to stop the compiler from optimizing out this method but to no avail.
* UPDATE *
When I remove the -DNDEBUG flag from CFLAGS_Release in the libcef_dll_wrapper.target.mk file it will build. I don't want to do this in the Release build without knowing what I'm doing though.
I am using gcc 4.8.2.
It turns out forcing the LD linker to reanalyze my libraries was the solution. The CEF application already had an elaborate scheme of makefiles that used the --start-group and --end-group indicators to do this, but the library I previously added was not included with them. I added it and linked my application without any more problems!

cython: memoryview build error with mingw

I have been writing some python extension modules with cython. The extensions I've written build and work well. Then, I wanted to use typed memoryviews, when accessing my numpy arrays, as they seem to have several advantages http://docs.cython.org/src/userguide/memoryviews.html
However, as soon as I use a memoryview in my cython code I will get an error when building the extension. For example, if I add this test line:
cdef double[:, ::1] X = np.zeros((100, 100))
to an existing, working cython extension. I will get the following errors:
C:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\image_box.o build\temp.win32-2.7\Release\image_box.def -Lc:\python27\libs -Lc:\python27\PCbuild -lp
ython27 -lmsvcr90 -o x:\ARframework\python\image_ops\image_box.pyd
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0xe23): undefined reference to `___sync_fetch_and_add_4'
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0x3318): undefined reference to `___sync_fetch_and_add_4'
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0x4c81): undefined reference to `___sync_fetch_and_sub_4'
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0x4d37): undefined reference to `___sync_fetch_and_sub_4'
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0x10767): undefined reference to `___sync_fetch_and_sub_4'
build\temp.win32-2.7\Release\image_box.o:image_box.c:(.text+0x10793): undefined reference to `___sync_fetch_and_sub_4'
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
I've tried to add -march=i486 to the gcc line, as suggested in this post:
undefined reference to sync_fetch_and_add_4
but that didn't solve the problem. For that matter, I also tried -march=i586 and -march=pentium without success.
Any idea what's going on here?
My platform is Windows 7, mingw version is 4.70, Cython version is 0.17.1
Thanks
I found a solution.
Actually, the gcc flag -march=i486 does solve the problem! However, when I tested it in the console I just applied it to the gcc line for the link step (that's where I got the errors) and as it didn't solve the problem I thought it just didn't work.
In fact, I need to use -march=i486 both in the compile and link steps, then there is no errors anymore.
As to how to include these flags when I build the extension, I have tried to add
import os
os.environ['LDFLAGS'] = '-march=i486'
os.environ['CFLAGS'] = '-march=i486'
to the setup.py but it didn't seem to work.
So I have modified the c:\python27\Lib\distutils\cygwinccompiler.py to include these flags in the compile and link steps. Not sure if this is very elegant way of setting these flags. Any alternatives are welcome!

Resources