Menu

#223 Incorrect processing of Makefiles while building libraries with MSYS2

2.0
closed
nobody
None
2015-12-02
2015-12-01
sav
No

Input:

  • MSYS (http://www.mingw.org/msys.shtml), MSYS2 x86 (msys2-x86_64-20150916.exe), MSYS2 x64 (msys2-x86_64-20150916.exe),
  • MinGW-W64 x86 (v5.2.0, i686-posix-sjlj-rev0),
  • GMP sources (v6.1.0), MPFR sources (v3.1.3), OpenSSL sources (v1.0.2d),

Build GMP x86 using MSYS (almost same for GMP x64):

sh-3.1$ cd <GMP sources dir>
sh-3.1$ ./configure --prefix=$PWD/RESULT --disable-shared --enable-static ABI="32" > _configure.log && make > _make.log && make install > _install.log && make check > _check.log
obprintf.c:59:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
obvprintf.c:52:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
obprntffuns.c:72:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
libtool: warning: undefined symbols not allowed in core2-pc-mingw32 shared libraries; building static only
[build finished successfully]

sh-3.1$ cd tune && make speed
gcc -m32 -O2 -pedantic -fomit-frame-pointer -mtune=core2 -march=core2    speed.c   -o speed
speed.c:43:20: fatal error: config.h: No such file or directory
compilation terminated.
make: *** [speed] Error 1
[standard error]

Build GMP x86 using MSYS2 (almost same for GMP x64):

sh-4.3$ cd <GMP sources dir>
sh-4.3$ ./configure --prefix=$PWD/RESULT --disable-shared --enable-static ABI="32" > _configure.log && make > _make.log && make install > _install.log && make check > _check.log
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:732: warning: overriding recipe for target '.s.o'
makefile:717: warning: ignoring old recipe for target '.s.o'
makefile:736: warning: overriding recipe for target '.s.obj'
makefile:719: warning: ignoring old recipe for target '.s.obj'
makefile:740: warning: overriding recipe for target '.s.lo'
makefile:721: warning: ignoring old recipe for target '.s.lo'
obprintf.c:59:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
obvprintf.c:52:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
obprntffuns.c:72:0: warning: ISO C forbids an empty translation unit [-Wpedantic]
 #endif /* HAVE_OBSTACK_VPRINTF */
 ^
makefile:911: warning: overriding recipe for target '.s.o'
makefile:896: warning: ignoring old recipe for target '.s.o'
makefile:915: warning: overriding recipe for target '.s.obj'
makefile:898: warning: ignoring old recipe for target '.s.obj'
makefile:919: warning: overriding recipe for target '.s.lo'
makefile:900: warning: ignoring old recipe for target '.s.lo'
libtool: warning: undefined symbols not allowed in core2-pc-mingw32 shared libraries; building static only
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:732: warning: overriding recipe for target '.s.o'
makefile:717: warning: ignoring old recipe for target '.s.o'
makefile:736: warning: overriding recipe for target '.s.obj'
makefile:719: warning: ignoring old recipe for target '.s.obj'
makefile:740: warning: overriding recipe for target '.s.lo'
makefile:721: warning: ignoring old recipe for target '.s.lo'
makefile:732: warning: overriding recipe for target '.s.o'
makefile:717: warning: ignoring old recipe for target '.s.o'
makefile:736: warning: overriding recipe for target '.s.obj'
makefile:719: warning: ignoring old recipe for target '.s.obj'
makefile:740: warning: overriding recipe for target '.s.lo'
makefile:721: warning: ignoring old recipe for target '.s.lo'
makefile:911: warning: overriding recipe for target '.s.o'
makefile:896: warning: ignoring old recipe for target '.s.o'
makefile:915: warning: overriding recipe for target '.s.obj'
makefile:898: warning: ignoring old recipe for target '.s.obj'
makefile:919: warning: overriding recipe for target '.s.lo'
makefile:900: warning: ignoring old recipe for target '.s.lo'
makefile:911: warning: overriding recipe for target '.s.o'
makefile:896: warning: ignoring old recipe for target '.s.o'
makefile:915: warning: overriding recipe for target '.s.obj'
makefile:898: warning: ignoring old recipe for target '.s.obj'
makefile:919: warning: overriding recipe for target '.s.lo'
makefile:900: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:1328: warning: overriding recipe for target '.s.o'
makefile:1313: warning: ignoring old recipe for target '.s.o'
makefile:1332: warning: overriding recipe for target '.s.obj'
makefile:1315: warning: ignoring old recipe for target '.s.obj'
makefile:1336: warning: overriding recipe for target '.s.lo'
makefile:1317: warning: ignoring old recipe for target '.s.lo'
makefile:732: warning: overriding recipe for target '.s.o'
makefile:717: warning: ignoring old recipe for target '.s.o'
makefile:736: warning: overriding recipe for target '.s.obj'
makefile:719: warning: ignoring old recipe for target '.s.obj'
makefile:740: warning: overriding recipe for target '.s.lo'
makefile:721: warning: ignoring old recipe for target '.s.lo'
makefile:911: warning: overriding recipe for target '.s.o'
makefile:896: warning: ignoring old recipe for target '.s.o'
makefile:915: warning: overriding recipe for target '.s.obj'
makefile:898: warning: ignoring old recipe for target '.s.obj'
makefile:919: warning: overriding recipe for target '.s.lo'
makefile:900: warning: ignoring old recipe for target '.s.lo'
[build finished successfully]

sh-4.3$ cd tune && make speed
makefile:911: warning: overriding recipe for target '.s.o'
makefile:896: warning: ignoring old recipe for target '.s.o'
makefile:915: warning: overriding recipe for target '.s.obj'
makefile:898: warning: ignoring old recipe for target '.s.obj'
makefile:919: warning: overriding recipe for target '.s.lo'
makefile:900: warning: ignoring old recipe for target '.s.lo'
speed.c   -o speed
process_begin: CreateProcess(C:\GMP-6.1.0\src32\tune\speed.c, speed.c -o speed, ...) failed.
make (e=193): Error 193
<builtin>: recipe for target 'speed' failed
make: *** [speed] Error 193
[not standard error]

Build MPFR x86 using MSYS (almost same for MPFR x64):

sh-3.1$ cd <MPFR sources dir>
sh-3.1$ ./configure --prefix=$PWD/RESULT --disable-shared --enable-static --with-gmp="/c/GMP-6.1.0/RESULT" > _configure.log && make > _make.log && make install > _install.log && make check > _check.log
[snip]
[build finished successfully]

Build MPFR x86 using MSYS2 (almost same for MPFR x64):

sh-4.3$ cd <MPFR sources dir>
sh-4.3$ ./configure --prefix=$PWD/RESULT --disable-shared --enable-static --with-gmp="/c/GMP-6.1.0/RESULT" > _configure.log && make > _make.log && make install > _install.log && make check > _check.log
libtool: warning: libobj name 'exceptions.Tpo -c -o exceptions.lo exceptions.lo' may not contain shell special characters.
rm: unknown option -- c
Try 'rm --help' for more information.
gcc.exe: error: exceptions.o: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
rm: unknown option -- c
Try 'rm --help' for more information.
make[2]: *** [exceptions.lo] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

FIX 1 (as recommended at https://github.com/luke-jr/bfgminer/issues/331):
for files '<mpfr sources="" dir="">\src\Makefile', '<mpfr sources="" dir="">\tests\Makefile', '<mpfr sources="" dir="">\tune\Makefile',
change string
$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$.Tpo -c -o $@ $<
TO
$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$
.Tpo -c -o $@ test -f '$<'|| echo '$(srcdir)/'$<</mpfr></mpfr></mpfr>

Build MPFR x86 using MSYS2 (continue):

sh-4.3$ make > _make.log && make install > _install.log && make check > _check.log
libtool: warning: library '/d/Projects/libBuilds/libGMP-6.1.0/GCC32lib/lib/libgmp.la' was moved.
libtool: warning: undefined symbols not allowed in i686-pc-mingw32 shared libraries; building static only
tests.c: In function 'ld_trace':
tests.c:528:11: warning: unknown conversion type character 'L' in format [-Wformat=]
   printf ("] %.20Lg\n", ld);
           ^
tests.c:528:11: warning: too many arguments for format [-Wformat-extra-args]
libtool: warning: '-no-install' is ignored for i686-pc-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: warning: library '/d/Projects/libBuilds/libGMP-6.1.0/GCC32lib/lib/libgmp.la' was moved.
In file included from mpfr-test.h:28:0,
                 from tversion.c:25:
../src/mpfr-impl.h:88:19: fatal error: gmp.h: No such file or directory
compilation terminated.
make[2]: *** [tversion.o] Error 1
make[1]: *** [check-am] Error 2
make: *** [check-recursive] Error 1

FIX 2:

sh-4.3$ cp "/c/GMP-6.1.0/RESULT/include/gmp.h" "./src/gmp.h" 

Build MPFR x86 using MSYS2 (continue):

sh-4.3$ make check > _check.log
[snip]
[build finished successfully]

Build OpenSSL x86 using MSYS (almost same for OpenSSL x64):

sh-3.1$ cd <OpenSSL sources dir>
sh-3.1$ ./Configure --prefix=$PWD/RESULT --openssldir=$PWD/RESULT/ssl mingw shared > _configure.log && make depend > _depend.log && make > _make.log && make install > _install.log
[snip]
[build finished successfully]

Build OpenSSL x86 using MSYS2 (almost same for OpenSSL x64):

sh-3.1$ cd <OpenSSL sources dir>
sh-3.1$ ./Configure --prefix=$PWD/RESULT --openssldir=$PWD/RESULT/ssl mingw shared > _configure.log && make depend > _depend.log && make > _make.log && make install > _install.log
makefile:59: warning: overriding recipe for target 'rc4-ia64.S'
makefile:53: warning: ignoring old recipe for target 'rc4-ia64.S'
makefile:59: warning: overriding recipe for target 'rc4-ia64.S'
makefile:53: warning: ignoring old recipe for target 'rc4-ia64.S'
In file included from cryptlib.c:117:0:
cryptlib.h:65:19: fatal error: e_os.h: No such file or directory
compilation terminated.
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1

Quotation to this topic by Ri0n (https://github.com/openssl/openssl/issues/226):
"The problem is in implicit make rules.
I don't know why gnumake decided to use g++ instead of gcc but by the same reason it does not use declared CFLAGS what leads to the lost e_os.h header.
It seems there are no way o force gcc but explicit make rule. So in my case I've added next code to crypto/Makefile

%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<

and it compiled a little more.
Unfortunately all other makefiles do not have such explicit rule too."

Discussion

  • Ray Donnelly

    Ray Donnelly - 2015-12-02

    Explain your problems in normal English please detailing the steps you went though.

    As far as I can tell, you aren't using MSYS2 as it should be used. To build MinGW-w64 i686 software run mingw32_shell.bat. We aren't interested in bug reports that involve software outside of MSYS2 so please don't report issues with MSYS since clearly one of the reasons MSYS2 was created in the first place was because MSYS was deficient.

     
  • sav

    sav - 2015-12-02

    I'll try to explain in another way:

    • when using MSYS from mingw.org, all libs (GMP, MPFR, OpenSSL) are built without any errors,
    • when using MSYS2, compiler throw lot of warnings (GMP case), or errors (MPFR, OpenSSL case),
      with the same rest conditions (same compiler, environment variables, build commands).
      Therefore looks as if the problem in MSYS2.

    UPD1: Tried to build libs using mingw32_shell.bat and got the same errors. To find out who is at fault, could you build OpenSSL (https://www.openssl.org/source/openssl-1.0.2d.tar.gz) with MinGW-W64 + MSYS2?
    (command './Configure --prefix=$PWD/RESULT --openssldir=$PWD/RESULT/ssl mingw shared && make depend && make && make install')

     

    Last edit: sav 2015-12-02
  • David Macek

    David Macek - 2015-12-02

    I think you're using incompatible build tools. You need to be using make and others from MSYS2.

    I just tried building openssl-1.0.2d (www.openssl.org) like ./Configure mingw64 shared && make depend && make in mingw64_shell and everything worked. I have pacman -S base-devel mingw-w64-x86_64-toolchain installed and I don't have any other tools in my PATH.

     
  • sav

    sav - 2015-12-02

    I used 'make' from MinGW-W64. Going to try as you have recommended. I'll wright as soon as the results will be.

     

    Last edit: sav 2015-12-02
  • sav

    sav - 2015-12-02

    All warnings and errors have gone after removing 'make' from MinGW-W64 and instaling 'make' for MSYS2 (tested with GMP, MPFR and OpenSSL). So this ticket can be closed.

    By the way, it's not obvious enough error as for the average MSYS2 user. Perhaps it makes sense to add some information about incompatibilities of MinGW-W64 'make' utility with MSYS2 'GNU bash' to the wiki (https://sourceforge.net/p/msys2/wiki/Porting/).

    Thank you and good luck!

     
  • David Macek

    David Macek - 2015-12-02

    Sounds reasonable. I added a short section to the page you mentioned.

     
  • David Macek

    David Macek - 2015-12-02
    • status: open --> closed
     
MongoDB Logo MongoDB