[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
strange issues with -all-static link flag under MinGW
From: |
Werner LEMBERG |
Subject: |
strange issues with -all-static link flag under MinGW |
Date: |
Fri, 07 Feb 2014 12:08:22 +0100 (CET) |
[libtool 2.4.2]
Folks,
I have two programs, which I try to link with
make LDFLAGS=-all-static
to build stand-alone Windows binaries. One program has a command line
interface, and everything is just fine. The other one has a Qt GUI,
and suddenly there is a mysterious problem: The program uses DLLs
instead of the static libraries.
Note that all of the affected libraries (HarfBuzz, FreeType, and
libpng) use libtool, and both static and dynamic libraries have been
built and installed. The other libraries mentioned are coming with
MinGW. Attached you can find the three .la files.
Here the libtool commands for the CLI program:
/bin/sh ../libtool \
--tag=CXX \
--mode=link g++ \
-g -O2 -all-static \
-o ttfautohint.exe \
info.o main.o \
../lib/libttfautohint.la \
../gnulib/src/libgnu.la \
/usr/local/lib/libfreetype.la
This gets translated to
libtool: link: g++ \
-g -O2 -static \
-o ttfautohint.exe \
info.o main.o \
../lib/.libs/libttfautohint.a \
-L/usr/local/lib \
-LD:/Werner/MinGW.new/msys/1.0/local/lib \
/usr/local/lib/libharfbuzz.a \
../gnulib/src/.libs/libgnu.a \
/usr/local/lib/libfreetype.a \
-lbz2 \
/usr/local/lib/libpng16.a \
-lz
Here the same for the GUI program. The large bunch of additional
flags are extracted automatically from Qt's build mechanism using the
`autotroll' m4 package, cf. http://repo.or.cz/w/autotroll.git. Qt has
been configured as a static build. Since I don't know the cause, I
don't shorten the libtool arguments here, showing the complete call.
/bin/sh ../libtool \
--tag=CXX \
--mode=link g++ \
-pipe -Os \
-momit-leaf-frame-pointer -fno-exceptions \
-Wall -Wextra -fno-rtti \
-DUNICODE -DQT_STATIC_BUILD -DQT_NO_DEBUG \
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX \
-DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT \
-DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT \
-DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST \
-g -O2 -static -static-libgcc \
-Wl,-s -Wl,-subsystem,windows -all-static \
-o ttfautohintGUI.exe \
ttfautohintGUI-ddlineedit.o ttfautohintGUI-info.o \
ttfautohintGUI-main.o ttfautohintGUI-maingui.o \
ttfautohintGUI-ttlineedit.o ttfautohintGUI-ddlineedit.moc.o \
ttfautohintGUI-maingui.moc.o ttfautohintGUI-ttlineedit.moc.o \
../lib/libttfautohint.la \
../gnulib/src/libgnu.la \
/usr/local/lib/libfreetype.la \
-L'd:/Werner/qt-4.8.5/lib' \
-lmingw32 -lqtmain -lQtGui -lgdi32 -lcomdlg32 \
-loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 \
-lQtCore -lole32 -luuid -lws2_32 -ladvapi32 \
-lshell32 -luser32 -lkernel32
And here the translation.
libtool: link: g++ \
-pipe -Os \
-momit-leaf-frame-pointer -fno-exceptions \
-Wall -Wextra -fno-rtti \
-DUNICODE -DQT_STATIC_BUILD -DQT_NO_DEBUG \
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX \
-DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT \
-DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT \
-DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST \
-g -O2 -static-libgcc \
-Wl,-s -Wl,-subsystem -Wl,windows -static \
-o ttfautohintGUI.exe \
ttfautohintGUI-ddlineedit.o ttfautohintGUI-info.o \
ttfautohintGUI-main.o ttfautohintGUI-maingui.o \
ttfautohintGUI-ttlineedit.o ttfautohintGUI-ddlineedit.moc.o \
ttfautohintGUI-maingui.moc.o ttfautohintGUI-ttlineedit.moc.o \
../lib/.libs/libttfautohint.a \
-L/usr/local/lib \
-LD:/Werner/MinGW.new/msys/1.0/local/lib \
/usr/local/lib/libharfbuzz.dll.a \
../gnulib/src/.libs/libgnu.a \
/usr/local/lib/libfreetype.dll.a \
-lbz2 \
/usr/local/lib/libpng16.dll.a \
-lz \
-Ld:/Werner/qt-4.8.5/lib \
-lmingw32 -lqtmain -lQtGui -lgdi32 -lcomdlg32 \
-loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 \
-lQtCore -lole32 -luuid -lws2_32 -ladvapi32 \
-lshell32 -luser32 -lkernel32 \
-L/usr/local/lib -L/usr/local/lib
Why does libtool decide to use the `.dll.a' stuff in the second call?
Werner
# libfreetype.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='../bin/libfreetype-6.dll'
# Names of this library.
library_names='libfreetype.dll.a'
# The name of the static archive.
old_library='libfreetype.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -lbz2 -L/usr/local/lib /usr/local/lib/libpng16.la -lz'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libfreetype.
current=17
age=11
revision=1
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
# libharfbuzz.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.2.418
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='../bin/libharfbuzz-0.dll'
# Names of this library.
library_names='libharfbuzz.dll.a'
# The name of the static archive.
old_library='libharfbuzz.a'
# Linker flags that cannot go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -L/usr/local/lib /usr/local/lib/libfreetype.la -lbz2
/usr/local/lib/libpng16.la -lz'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libharfbuzz.
current=926
age=926
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
# libpng16.la - a libtool library file
# Generated by libtool (GNU libtool) 2.4.2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='../bin/libpng16-16.dll'
# Names of this library.
library_names='libpng16.dll.a'
# The name of the static archive.
old_library='libpng16.a'
# Linker flags that can not go in dependency_libs.
inherited_linker_flags=''
# Libraries that this one depends upon.
dependency_libs=' -lz'
# Names of additional weak libraries provided by this library
weak_library_names=''
# Version information for libpng16.
current=24
age=8
revision=0
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=no
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/local/lib'
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- strange issues with -all-static link flag under MinGW,
Werner LEMBERG <=