I wanted to install the python module sip (version 4.17) according to the documentation on my Windows 7 machine:
Download from the official page as described in the documentation
Unzip the repository to the folder C:\Python27\Lib\site-packages\sip-4.17
Configure the package with the command python.exe configure.py in this folder
Building the module mingw32-make fails.
Mingw's make returns the following error message:
mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o main.o main.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o transform.o transform.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o gencode.o gencode.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o extracts.o extracts.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o export.o export.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o heap.o heap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o parser.o parser.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -o lexer.o lexer.c
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -Wl,-s -o sip.exe main.o transform.o gencode.o extracts.o export.o heap.o parser.o lexer.o
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/sipgen'
mingw32-make[1]: Entering directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o siplib.o siplib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o apiversions.o apiversions.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o descriptors.o descriptors.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o qtlib.o qtlib.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o threads.o threads.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o objmap.o objmap.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o voidptr.o voidptr.c
gcc -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o array.o array.c
g++ -c -O2 -w -DNDEBUG -DUNICODE -DQT_LARGEFILE_SUPPORT -I. -IC:\Python27\include -o bool.o bool.cpp
g++ -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -shared -Wl,-subsystem,console -Wl,-s -o sip.pyd siplib.o apiversions.o descriptors.o qtlib.o threads.o objmap.o voidptr.o array.o bool.o -LC:\Python27\libs -lpython27
C:\Python27\libs/libpython27.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
Makefile:36: recipe for target 'sip.pyd' failed
mingw32-make[1]: *** [sip.pyd] Error 1
mingw32-make[1]: Leaving directory 'C:/Python27/Lib/site-packages/sip-4.17/siplib'
Makefile:3: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I have no clue why it failed to compile the code saying File format not recognized. Is it the same mistake as in g++ output: file not recognized: File format not recognized?
Thank you for your help in advance!
Comment:
I followed the following questions too but I want to install it using the zip file - so I know what is installed.
Can't configure pyQt
How to install SIP & PyQT on windows 7
How did you configure SIP? You need to choose a configuration option (see documentation in the docs file of the SIP archive). I got this to work once I chose --platform win32-g++.
Related
I try to compile my written C++ code G++ GMP on Windows. My program works fine on Ubuntu. I need to recompile and build the library with Mingw-G++ to eventually compile my final program with Mingw for Windows.
My problem now:
The configure file provided with the library does not look like it can set Mingw-GCC over GCC as compiler anywhere. You can set flags for build and host type but they don't bring the desired results (in my testing).
Im far from being an expert with makefiles and shell scripts, so it might seem like I can't set the compiler, but I think I just overlook something. I can imagine that i need so set the path to Mingw in the configure file myself, but i dont want to break anything YET.
I figured out that there is a CClist in the configure file, which is set to gcc / gcc icc etc... it determines which list of compilers to set depending on the CPU build type (arm/amd64/etc...).<
Another problem: the mingw gcc compiler on linux isn't named gcc unlike on windows but rather x86_64-w64-mingw32-gcc...so the script can't detect it as gcc
Thanks in advance
Edit
After some help from #SuperStormer i set the compiler as mingw32-gcc correctly as my config.status file show, however make check fails with the following warnings:
z.lo spinner.lo trace.lo ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-ar cq .libs/libtests.a memory.o misc.o refmpf.o refmpn.o refmpq.o refmpz.o spinner.o trace.o
libtool: link: x86_64-w64-mingw32-ranlib .libs/libtests.a
libtool: link: ( cd ".libs" && rm -f "libtests.la" && ln -s "../libtests.la" "libtests.la" )
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-bswap.o t-bswap.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-bswap.exe t-bswap.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-bswap.exe t-bswap.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-constants.o t-constants.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-constants.exe t-constants.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-constants.exe t-constants.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-count_zeros.o t-count_zeros.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-count_zeros.exe t-count_zeros.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-count_zeros.exe t-count_zeros.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-hightomask.o t-hightomask.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-hightomask.exe t-hightomask.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-hightomask.exe t-hightomask.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-modlinv.o t-modlinv.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-modlinv.exe t-modlinv.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-modlinv.exe t-modlinv.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-popc.o t-popc.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-popc.exe t-popc.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-popc.exe t-popc.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-parity.o t-parity.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-parity.exe t-parity.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-parity.exe t-parity.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -c -o t-sub.o t-sub.c
/bin/bash ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -no-install -o t-sub.exe t-sub.o libtests.la ../libgmp.la
libtool: warning: '-no-install' is ignored for x86_64-w64-mingw32
libtool: warning: assuming '-no-fast-install' instead
libtool: link: x86_64-w64-mingw32-gcc -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -o t-sub.exe t-sub.o ./.libs/libtests.a /home/me/Downloads/gmp-6.2.1/.libs/libgmp.a ../.libs/libgmp.a
make[4]: Verzeichnis „/home/me/Downloads/gmp-6.2.1/tests“ wird verlassen
and this
FAIL: t-bswap.exe
FAIL: t-constants.exe
FAIL: t-count_zeros.exe
FAIL: t-hightomask.exe
FAIL: t-modlinv.exe
FAIL: t-popc.exe
FAIL: t-parity.exe
FAIL: t-sub.exe
============================================================================
Testsuite summary for GNU MP 6.2.1
============================================================================
# TOTAL: 8
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 8
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Test-suite-log says: it can't run the .exe file. It's clear to me why it can't, but is there any workaround to create a linux excutable instead? Or is make check expected to fail?
Solution
Quick guess is that make check can't succeed on linux with mingw.
I ran make install, and my program now runs fine (regarding my library issues)
This answer is mostly based on this mailing list post.
Commands ran:
export CC=x86_64-w64-mingw32-gcc
export CC_FOR_BUILD=x86_64-linux-gnu-gcc
./configure --build=x86_64-linux-gnu --host=x86_64-w64-mingw32 --enable-cxx
make
Tweak this however you want.
I compile a dynamic and static version of my library on Debian 7. My user wants to use the library on RHEL6, so after reading many posts it seemed linking libstdc++ statically should fix the issue.
I am using qmake, so in the .pro file I added
unix: QMAKE_CXXFLAGS_RELEASE += -static-libstdc++ -static-libgcc -fvisibility=hidden -w
Then I execute following command:
qmake MyLibrary.pro -spec linux-g++-64 "CONFIG += release"
and the output is
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexAbstraction.o MyLibrary/LexAbstraction.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o MyLibrary.o MyLibrary/MyLibrary.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexBotan.o MyLibrary/LexBotan.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexCrypter.o MyLibrary/LexCrypter.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexHelper.o MyLibrary/LexHelper.cpp
rm -f libMyLibrary.so
g++ -m64 -Wl,-O1 -shared -o libMyLibrary.so LexAbstraction.o MyLibrary.o LexBotan.o LexCrypter.o LexHelper.o -L/usr/lib/x86_64-linux-gnu -lpthread
But when I execute
ldd -v libMyLibrary.so | grep GLIBCXX
It gives following output:
libstdc++.so.6 (GLIBCXX_3.4.15) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.9) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
-static-libstdc++ and -static-libgcc are linkage options, but you are
passing them for compilation (where they are ignored) and not for linkage.
C++ compile options go in QMAKE_CXXFLAGS_{RELEASE|DEBUG}. Linkage
options go in QMAKE_LFLAGS_{RELEASE|DEBUG}.
-fvisibility is a compile option, so it should remain in QMAKE_CXXFLAGS_RELEASE
Help me to understand, why simple qt application with dynamically loading libraries run under gdb, but more complex is not. Qt Toolkit I use the for both.
This is how my test application builds (lib and exe afterwards):
C:/devtools/mingw-i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/juriy/testlib'
g++ -c -pipe -Wall -Wextra -Werror -g -fprofile-arcs -ftest-coverage -O0 -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DTESTLIB_LIBRARY -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I'../../../Qt/4.8.6/include/QtCore' -I'../../../Qt/4.8.6/include/QtGui' -I'../../../Qt/4.8.6/include' -I'../../../Qt/4.8.6/include/ActiveQt' -I'debug' -I'../../../Qt/4.8.6/mkspecs/win32-g++' -o debug/testlib.o testlib.cpp
g++ -export-dynamic -lgcov -coverage -mthreads -shared -Wl,--out-implib,debug/libtestlib.a -o debug/testlib.dll debug/testlib.o -L'c:/Qt/4.8.6/lib' -lQtGuid4 -lQtCored4
C:/devtools/mingw-i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?
mingw32-make[1]: Leaving directory 'C:/Users/juriy/testlib'
g++ -c -pipe -Wall -Wextra -Werror -g -fprofile-arcs -ftest-coverage -O0 -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../Qt/4.8.6/include/QtCore' -I'../../../Qt/4.8.6/include/QtGui' -I'../../../Qt/4.8.6/include' -I'../testlib' -I'../../../Qt/4.8.6/include/ActiveQt' -I'debug' -I'.' -I'../../../Qt/4.8.6/mkspecs/win32-g++' -o debug/widget.o widget.cpp
g++ -c -pipe -Wall -Wextra -Werror -g -fprofile-arcs -ftest-coverage -O0 -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I'../../../Qt/4.8.6/include/QtCore' -I'../../../Qt/4.8.6/include/QtGui' -I'../../../Qt/4.8.6/include' -I'../testlib' -I'../../../Qt/4.8.6/include/ActiveQt' -I'debug' -I'.' -I'../../../Qt/4.8.6/mkspecs/win32-g++' -o debug/moc_widget.o debug/moc_widget.cpp
g++ -export-dynamic -lgcov -coverage -mthreads -Wl,-subsystem,windows -o debug/test.exe debug/main.o debug/widget.o debug/moc_widget.o -L'c:/Qt/4.8.6/lib' -lmingw32 -lqtmaind -ltestlib -L../testlib/debug -lQtGuid4 -lQtCored4
C:/devtools/mingw-i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?
mingw32-make[1]: Leaving directory 'C:/Users/juriy/test'
And my complex application building:
g++ -c -pipe -Wall -Wextra -Werror -g -g -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DSIP_LIB -DQWT_DLL -DQT_DLL -DQT_WEBKIT_LIB -DQT_SVG_LIB -DQT_SQL_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I'../../../../Qt/4.8.6/include/QtCore' -I'../../../../Qt/4.8.6/include/QtNetwork' -I'../../../../Qt/4.8.6/include/QtGui' -I'../../../../Qt/4.8.6/include/QtXml' -I'../../../../Qt/4.8.6/include/QtXmlPatterns' -I'../../../../Qt/4.8.6/include/QtSql' -I'../../../../Qt/4.8.6/include/QtSvg' -I'../../../../Qt/4.8.6/include/QtWebKit' -I'../../../../Qt/4.8.6/include' -I'.' -I'../SIP_Common' -I'../SIP_Qwt' -I'../SIP_Qwt/src' -I'../../../../Qt/4.8.6/include/ActiveQt' -I'debug/mocs' -I'debug/uics' -I'../../../../Qt/4.8.6/mkspecs/win32-g++' -o debug/objs/moc_sbmrscwidget.o debug/mocs/moc_sbmrscwidget.cpp
g++ -export-dynamic -mthreads -shared -Wl,--out-implib,./debug/libWidgets.a -o debug/Widgets.dll object_script.Widgets.Debug -L'c:/Qt/4.8.6/lib' -lCommon -L../SIP_Common/debug -lQwt_4 -L../SIP_Qwt/debug -lQtWebKitd4 -lQtSvgd4 -lQtSqld4 -lQtXmlPatternsd4 -lQtXmld4 -lQtGuid4 -lQtNetworkd4 -lQtCored4
C:/devtools/mingw-i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE targets, did you mean --export-all-symbols?
Tha last illustrates both library and exe building flags, flags the same.
When gdb starts I see in QtCreator gdb output concrete differencies. For simple app gdb starts to load libs like so:
>=library-loaded,id="C:\\Windows\\system32\\ntdll.dll",target-name="C:\\Windows\\system32\\ntdll.dll",host-name="C:\\Windows\\system32\\ntdll.dll",symbols-loaded="0",thread-group="i1"
sLibrary C:\Windows\system32\ntdll.dll loaded
>=library-loaded,id="C:\\Windows\\syswow64\\kernel32.dll",target-name="C:\\Windows\\syswow64\\kernel32.dll",host-name="C:\\Windows\\syswow64\\kernel32.dll",symbols-loaded="0",thread-group="i1"
sLibrary C:\Windows\syswow64\kernel32.dll loaded
>=library-loaded,id="C:\\Windows\\syswow64\\KernelBase.dll",target-name="C:\\Windows\\syswow64\\KernelBase.dll",host-name="C:\\Windows\\syswow64\\KernelBase.dll",symbols-loaded="0",thread-group="i1"
sLibrary C:\Windows\syswow64\KernelBase.dll loaded
>=library-loaded,id="C:\\Users\\juriy\\testlib\\debug\\testlib.dll",target-name="C:\\Users\\juriy\\testlib\\debug\\testlib.dll",host-name="C:\\Users\\juriy\\testlib\\debug\\testlib.dll",symbols-loaded="0",thread-group="i1"
sLibrary C:\Users\juriy\testlib\debug\testlib.dll loaded
But when more complex one starts up, gdb omits the loading and outputs following instead:
>=thread-exited,id="1",group-id="i1"
sThread 1 in group i1 exited
>=thread-group-exited,id="i1"
sThread group i1 exited
>19^error,msg="During startup program exited with code 0xc0000022."
dCOOKIE FOR TOKEN 19 ALREADY EATEN (InferiorRunOk). TWO RESPONSES FOR ONE COMMAND?
dNOTE: INFERIOR EXITED
dState changed from InferiorRunOk(11) to InferiorExitOk(16) [master]
dState changed from InferiorExitOk(16) to InferiorShutdownOk(19) [master]
dState changed from InferiorShutdownOk(19) to EngineShutdownRequested(20) [master]
dQUEUE: SHUTDOWN ENGINE
sExecutable failed: During startup program exited with code 0xc0000022.
PS. There is some warnings about CROSS_COMPILE, should I ignore this?
Here some same question, but it a bit useless because of I couldn't see the decision.
I have Qt-Creator on OpenSUSE. In it a have a C++ project with compiler 'clang'. There I have this '.pro' configuration:
INCLUDEPATH += "/✪Data_Disk⚜✼/Build/include/c++/v1/"
LIBS += "-stdlib=libc++"
LIBS += "/✪Data_Disk⚜✼/Build/lib/libc++abi.a"
QMAKE_CXXFLAGS += -std=c++14 -stdlib=libc++
TARGET = testCpp
SOURCES += main.cpp
And when I compile I got this output:
clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/unsupported/linux-clang -I../testCpp -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I/✪Data_Disk⚜✼/Build/include/c++/v1 -I. -I../testCpp -I. -o main.o ../testCpp/main.cpp
I want it to be either:
clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/✪Data_Disk⚜✼/Build/include/c++/v1 -I/usr/share/qt4/mkspecs/unsupported/linux-clang -I../testCpp -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I../testCpp -I. -o main.o ../testCpp/main.cpp
Or:
clang++ -c -pipe -Qunused-arguments -std=c++14 -stdlib=libc++ -g -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/✪Data_Disk⚜✼/Build/include/c++/v1 -o main.o ../testCpp/main.cpp
In other words - I want to either include this path (
-I/✪Data_Disk⚜✼/Build/include/c++/v1
) before the system defined ones or to completely remove them and leave only it. Any ideas?
If you look into qmake source, for example Win32MakefileGenerator::writeStandardParts() or UnixMakefileGenerator::writeMakeParts() you will see that the flags are included in the following order:
QMAKE_CC
QMAKE_CXX
QMAKE_CFLAGS
QMAKE_CXXFLAGS
INCLUDEPATH
...
INCLUDEPATH always goes after the first four. You can use QMAKE_CXXFLAGS and add -I path there:
QMAKE_CXXFLAGS += -I/✪Data_Disk⚜✼/Build/include/c++/v1
I wrote a GCC Plugin which works very well. I created a Makefile which executes the following command to create the Plugin:
$ g++ -I$(INCLUDE_PATHS) -fPIC -shared $(SOURCE_PATHS) -o Plugin.so
I execute the Plugin with following command:
$ g++ -S -fplugin=./Plugin.so /TestProgramm.cpp
This works pretty well. Now I want to display a QT GUI when calling the Plugin. I wrote the GUI in Eclipse, so i got an auto-generated MakeFile. When executing the GUI, Eclipse executes following commands:
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I$(QT_INCLUDE_PATHS) -o debug/GUI.o GUI.cpp
g++ -Wl,-rpath,/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -o GraphGUI debug/GUI.o debug/main.o debug/GraphGUI.o debug/moc_GraphGUI.o -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -lQtGui -L/opt/QtSDK/Desktop/Qt/4.8.1/gcc/lib -L/usr/X11R6/lib -lQtCore -lpthread
GraphGUI and GUI are the classes of the GUI I wrote.
Now I want to combine these statements in my own Makefile, so that the Compiler compiles my Plugin and my GUI. I started working with Makefiles a few days ago, so I only got the basics about Makefiles. Hope somebody can help me.
Here is my Makefile:
GCC := g++
FILENAME := Explorer.so
GCC_INCLUDE := -I/usr/lib/gcc/i686-linux-gnu/4.6/plugin/include
QT_INCLUDE := -I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/mkspecs/default \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtCore \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include/QtGui \
-I/opt/QtSDK/Desktop/Qt/4.8.1/gcc/include
SOURCE_FILES = ## Some .cpp files for the plugin ##
$(FILENAME):
#$(GCC) $(GCC_INCLUDE) -fPIC -shared $(SOURCE_FILES) -o $# $^
clean:
#rm $(FILENAME)
I tried creating object files of the GUI and then include them in the command which creates the Plugin; like this:
$(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/GUI.o src/Visualize/GUI.cpp
$(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/GraphGUI.o src/Visualize/GraphGUI.cpp
# /opt/QtSDK/Desktop/Qt/4.8.1/gcc/bin/moc -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. src/Visualize/GraphGUI.h -o debug/moc_GraphGUI.cpp
# $(GCC) -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED $(QT_INCLUDE) -Idebug -I. -o debug/moc_GraphGUI.o debug/moc_GraphGUI.cpp
$(GCC) $(PLUGIN_INCLUDE) -fPIC -shared $(SOURCE_FILES) debug/GraphGUI.o debug/GUI.o -o $# $^
If i execute it like this, I get undefined symbol: _ZN11QMainWindowC2EP7QWidget6QFlagsIN2Qt10WindowTypeEE error. If I execute the two commands beginning with "#" too, I get "undefined reference to main". I just copied these commands from eclipse; I don't actually know what they are doing.