Wednesday, November 17, 2021

[SOLVED] MinGW32 can't configure sources: "undefined reference to `signal' and etc

Issue

Last year I builded some sources on MinGW without any problem. Now when I try to reconfigure this souces with another parameters I get (part of output of ./configure of libjansson-2.10 in config.log):

configure:3318: checking whether the C compiler works
configure:3340: gcc    conftest.c  >&5
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../crt2.o:(.text+0x34): 
undefined reference to `signal'
...
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../crt2.o:(.text+0x89): 
undefined reference to `_imp___iob'
...

and others undefined reference. BUT if I make this old configured sources they are reduilded successfully.

I uninstalled the old MinGW and downloaded a new one, checked all the dll, bin and dev related checkboxes, but still get the same error with different sources. I changed PATH to remove all links except C:\MinGW\bin;C:\MinGW\msys\1.0\bin;, and etc. but all the same. Is this a problem with PATH or pkg-config or something else?

UPDATE: When I compile Hello world I get the same errors.

g++ -Wall -o2 -s -nodefaultlibs Hello.cpp -o Hello.exe
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: 
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../crt2.o:(.text+0x97): undefined reference to `signal'

Solution

My problem was in LIBRARY_PATH variable that stores this value:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\lib\x64;
C:\Program Files (x86)\Windows Kits\8.1\Include\um 
C:\MinGW\msys\1.0\lib;

LD_LIBRARY_PATH vs LIBRARY_PATH

When I delete it and restart computer all of that undefined is gone.



Answered By - javierMarquez