Re: Compiling and linking problems

Nigel Galloway <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <DB3PR0302MB3370BAA0E4EE38B8F97AC075FFD70@DB3PR0302MB3370.eurprd03.prod.outlook.com>
Does it link if you don't pass any parameters to ./configure? If it does then just throw the shared libraries away if you really don't want them.


If it doesn't and you want an immediate solution the source code for gmtime_r and strtok_r is available, just add it to your glpk compilation somewhere.


The problem is that  gmtime_r and strtok_r are optional POSIX features only required for systems using POSIX threads, which windows doesn't. You probably want to use winpthreads which may be as simple as adding -l pthread or not. If it isn't you may get a better answer from mingw help.

________________________________
From: Help-glpk <[email protected]> on behalf of [email protected] <[email protected]>
Sent: 15 March 2018 13:35:31
To: [email protected]
Subject: [Help-glpk] Compiling and linking problems


Dear GLPK-Team,



I have got some problems with building glpk 4.65 on Windows 10 with msys/mingw.



I tried to build it with:

./configure --enable-static --disable-shared

make



Configure finished without problems. All sources are compiled without errors.

But it ends with the following issues:

…

/bin/sh ../libtool --tag=CC   --mode=link gcc  -g -O2   -o glpsol.exe glpsol.o ../src/libglpk.la -lm

libtool: link: gcc -g -O2 -o glpsol.exe glpsol.o  ../src/.libs/libglpk.a

../src/.libs/libglpk.a(libglpk_la-stdc.o): In function `glp_xgmtime':

C:\Users\Mike\Documents\Projekte\CMPL-1-12\Cmpl\data\glpk-4.65\src/env/stdc.c:81: undefined reference to `gmtime_r'

../src/.libs/libglpk.a(libglpk_la-stdc.o): In function `glp_xstrtok':

C:\Users\Mike\Documents\Projekte\CMPL-1-12\Cmpl\data\glpk-4.65\src/env/stdc.c:93: undefined reference to `strtok_r'

collect2.exe: error: ld returned 1 exit status

make[2]: *** [glpsol.exe] Error 1

make[2]: Leaving directory `/Documents/Projekte/CMPL-1-12/Cmpl/data/glpk-4.65/examples'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/Documents/Projekte/CMPL-1-12/Cmpl/data/glpk-4.65'

make: *** [all] Error 2





I have seen that in stdc.c are alternative versions of some function depending on some defines. But I am not sure what is  do do. I was wondering that the defines are  set by the configure script.

I use as mentioned before msys/mingw:

$ gcc -v

Using built-in specs.

COLLECT_GCC=C:\MinGW\bin\gcc.exe

COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe

Target: mingw32

Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls

Thread model: win32

gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)





Any suggestions are welcome!



Thanks,



Mike

_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.