glfw: undefined reference to `__assert_func'
Hi,
when go building nk-example from golang-ui/nuklear on Win10 64 bits using go 1.8.3 and MinGW X86_64, the following error log appears:
C:\Go\PATH\src\github.com\golang-ui\nuklear\cmd\nk-example>go build
# github.com/golang-ui/nuklear/cmd/nk-example
C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwSwapBuffers':
C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:609: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwExtensionSupported':
C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:642: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwGetProcAddress':
C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:707: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwGetInputMode':
C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:153: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwSetInputMode':
C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:174: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o:C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:262: more undefined references to `__assert_func' follow
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `_cgo_2daa1da745f8_C2func_calloc':
/c/Go/PATH/src/github.com/golang-ui/nuklear/nk/cgo-gcc-prolog:42: undefined reference to `__errno'
/c/Go/PATH/src/github.com/golang-ui/nuklear/nk/cgo-gcc-prolog:44: undefined reference to `__errno'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `nk_insert_window':
C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18401: undefined reference to `__assert_func'
C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18402: undefined reference to `__assert_func'
C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18396: undefined reference to `__assert_func'
C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18395: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `nk_do_button':
C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:14036: undefined reference to `__assert_func'
C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o:C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:14038: more undefined references to `__assert_func' follow
collect2.exe: error: ld returned 1 exit status
System info:
go version go1.8.3 windows/amd64
>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-7.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 7.1.0 (Rev2, Built by MSYS2 project)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 15 (5 by maintainers)
@vitesse-ftian I also encountered this bug, I solved it by deleting the file C:\Users\name\AppData\Local\go-build. again go build
@sdir thank you very much. After 4 hours of struggling, your solution was the only thing that worked for me on windows.
New virtual machine New Windows 10 installation New MSYS2
pacman -Syupacman -Syupacman -S base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-goAnd everything works perfectly. Tried both go-gl examples and nuklear.This is clearly an environment setup problem on the user side.
@shurcooL I have read the installation readme, but I am not sure if the issue comes from MinGW64 or GLFW.
The issue is still present with the X86_64 MinGW64, which is the 64 bits version, but is working with the i686 MinGW64, which is the 32 bits version.
I haven’t had the time to dig deeper inthe differences in the includes, as I believe the
__assert_funcdefinition should be provided by the libc which based on small tests can be found by gcc in all the cases I tested.For me it worked too. I installed mingw-w64-x86_64-gcc and it worked without any errors. You just always have to install the packages with the prefix mingw-w64 and not those without like gcc or pkg-config. That fixed it for me.