[Ctk-developers] mingw build failure

Dean Inglis dean.inglis at camris.ca
Fri Aug 20 18:04:48 EDT 2010


Hi Julien,

thanks for the suggestions.  Im using the latest stable release for MinGW 
and to
gcc that comes with is all there is aFAIK.  In CTK root CMakeLists.txt,
I commented out

#-----------------------------------------------------------------------------
# Set symbol visibility Flags
#
#IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
#  SET(VISIBILITY_CXX_FLAGS 
"-fvisibility=hidden -fvisibility-inlines-hidden")
#ENDIF()

and removed -Wstrict-null-sentinel

IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  SET(cflags 
"-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2")
  ctkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
  ctkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)
  SET(CTK_C_FLAGS "${cflags} ${CTK_C_FLAGS}")
#  SET(CTK_CXX_FLAGS 
"${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo 
${CTK_CXX_FLAGS}")
  SET(CTK_CXX_FLAGS 
"${cflags} -Woverloaded-virtual -Wold-style-cast -Wsign-promo 
${CTK_CXX_FLAGS}")
ENDIF()

Now Im getting the following linking errors:

[ 83%] Performing build step for 'CTK-build'
Linking CXX shared library ..\..\bin\libCTKCore.dll
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0xc5): undefined 
reference
 to `_imp___ZN7QString17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x146): undefined 
referenc
e to `_imp___ZN7QString17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x216): undefined 
referenc
e to `_imp___ZN7QString17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x23f): undefined 
referenc
e to `_imp___ZN7QObject13setObjectNameERK7QString'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x2e6): undefined 
referenc
e to `_imp___ZN7QString17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x390): undefined 
referenc
e to `_imp___ZN7QString17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x5c5): undefined 
referenc
e to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x708): undefined 
referenc
e to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(ba
sicconfigurator.cpp.obj):basicconfigurator.cpp:(.text+0x71f): undefined 
referenc
e to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x63): undefined reference to 
`_imp___ZN14QReadW
riteLock6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x7c): undefined reference to 
`_imp___ZN14QReadW
riteLock11lockForReadEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x149): undefined reference to 
`_imp___ZN7QStrin
g17fromLatin1_helperEPKci'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0xcea): undefined reference to 
`_imp___ZN14QRead
WriteLock11lockForReadEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0xd6f): undefined reference to 
`_imp___ZN14QRead
WriteLock6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0xe85): undefined reference to 
`_imp___ZN14QRead
WriteLock6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x160d): undefined reference to 
`_imp___ZN14QRea
dWriteLock11lockForReadEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x1648): undefined reference to 
`_imp___ZN14QRea
dWriteLock6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(lo
gger.cpp.obj):logger.cpp:(.text+0x1712): undefined reference to 
`_imp___ZN14QRea
dWriteLockC1ENS_13RecursionModeE'

etc etc etc

D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_rollingfileappender.cxx.obj):moc_rollingfileappender.cxx:(.text+0x388): 
undefi
ned reference to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_rollingfileappender.cxx.obj):moc_rollingfileappender.cxx:(.text+0x3a3): 
undefi
ned reference to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_rollingfileappender.cxx.obj):moc_rollingfileappender.cxx:(.text+0x3f0): 
undefi
ned reference to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_rollingfileappender.cxx.obj):moc_rollingfileappender.cxx:(.text+0x40d): 
undefi
ned reference to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_rollingfileappender.cxx.obj):moc_rollingfileappender.cxx:(.text+0x428): 
undefi
ned reference to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_fileappender.cxx.obj):moc_fileappender.cxx:(.text+0x1f6): undefined 
reference
to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_fileappender.cxx.obj):moc_fileappender.cxx:(.text+0x323): undefined 
reference
to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_fileappender.cxx.obj):moc_fileappender.cxx:(.text+0x347): undefined 
reference
to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_fileappender.cxx.obj):moc_fileappender.cxx:(.text+0x35b): undefined 
reference
to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_fileappender.cxx.obj):moc_fileappender.cxx:(.text+0x379): undefined 
reference
to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_dailyrollingfileappender.cxx.obj):moc_dailyrollingfileappender.cxx:(.text+0x24
8): undefined reference to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_dailyrollingfileappender.cxx.obj):moc_dailyrollingfileappender.cxx:(.text+0x26
8): undefined reference to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_dailyrollingfileappender.cxx.obj):moc_dailyrollingfileappender.cxx:(.text+0x29
2): undefined reference to `_imp___ZN6QMutex6unlockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_dailyrollingfileappender.cxx.obj):moc_dailyrollingfileappender.cxx:(.text+0x2e
f): undefined reference to `_imp___ZN6QMutex4lockEv'
D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Install\lib\libLog4Qt.a(mo
c_dailyrollingfileappender.cxx.obj):moc_dailyrollingfileappender.cxx:(.text+0x31
1): undefined reference to `_imp___ZN6QMutex6unlockEv'
collect2: ld returned 1 exit status
mingw32-make[5]: *** [bin/libCTKCore.dll] Error 1
mingw32-make[4]: *** [Libs/Core/CMakeFiles/CTKCore.dir/all] Error 2
mingw32-make[3]: *** [all] Error 2
mingw32-make[2]: *** [CMakeExternals/Stamp/CTK-build/CTK-build-build] Error 
2
mingw32-make[1]: *** [CMakeFiles/CTK-build.dir/all] Error 2
mingw32-make: *** [all] Error 2

Also, what is the correct fix/workaround  for getting QtMobility to properly
compile without modifying cmake's generated build.make?

thanks,
Dean

> Hi Dean, glad to hear you're giving a shot with CTK.
>
> The flags the compiler is complaining about are supported from gcc 4.0. 
> You
> might want to update your gcc compiler.
>
> However, there are some other workarounds, you can remove them when
> configuring CTK (check the options CTK_CXX_FLAGS and VISIBILITY_CXX_FLAGS)
> All these flags are automatically set in CTK/CMakeLists.txt, if we want to
> support "old" gcc compilers, then we should probably make sure they are
> supported using  ctkFunctionCheckCompilerFlags()
>
> Let us know if you have more feedbacks. Feel free to post a patch with all
> the changes you needed to add to have it working.
>
> Thanks,
> Julien.
>
> On Fri, Aug 20, 2010 at 11:42 AM, Dean Inglis <dean.inglis at camris.ca> 
> wrote:
>
>> Hi,
>>
>> I'm new to CTK and have been trying to get things going on Win32 Vista
>> with MinGW and CMake 2.8.1.  Ive compiled Qt 4.6.3 shared release and 
>> debug
>> (because
>> QtMobility would not compile with just a release build of Qt) and VTK 5.7
>> shared release
>> but Im running into a snag with QtMobility:
>>
>> D:\Developer\Releases\MinGW\SHARED\ctk>mingw32-make
>> Scanning dependencies of target QtMobility
>> [  0%] Creating directories for 'QtMobility'
>> [  0%] Performing download step (extract) for 'QtMobility'
>> -- extracting...
>>
>> 
>> src='D:/Developer/Sources/CTK/Utilities/QtMobility/qt-mobility-servicefw-op
>> ensource-src-1.0.0.tar.gz'
>>
>> 
>> dst='D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobilit
>> y'
>> -- extracting... [tar xfz]
>> -- extracting... [analysis]
>> -- extracting... [copy]
>> -- extracting... [clean up]
>> -- extracting... done
>> [  0%] Performing patch step for 'QtMobility'
>> [  0%] No update step for 'QtMobility'
>> [  0%] Performing configure step for 'QtMobility'
>> Checking selected modules:
>>   ServiceFramework selected
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMobility
>> Checking available Qt
>> 4.6.3
>> Checking make
>> ... mingw32-make found.
>>
>> Start of compile tests
>> End of compile tests
>>
>>
>> The file cannot be copied onto itself.
>>       0 file(s) copied.
>> Generating Mobility Headers...
>> The system cannot find the file specified.
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QAbstractSecuritySession
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QServiceContext
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QServiceFilter
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QServiceInterfaceDescriptor
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QServiceManager
>> Create header
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMob
>> ility\include/QServicePluginInterface
>>
>> Running qmake...
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility/
>> src/src.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility
>> /src/global/global.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility
>> /src/serviceframework/serviceframework.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility/
>> tools/tools.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility
>> /tools/servicefw/servicefw.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility
>> /tools/servicexmlgen/servicexmlgen.pro
>> Reading
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Source/QtMobility
>> /tools/icheck/icheck.pro
>>
>> configure has finished. You may run mingw32-make to build the project 
>> now.
>> [  0%] Performing build step for 'QtMobility'
>> 'make' is not recognized as an internal or external command,
>> operable program or batch file.
>> mingw32-make[2]: *** [CMakeExternals/Stamp/QtMobility/QtMobility-build]
>> Error 1
>> mingw32-make[1]: *** [CMakeFiles/QtMobility.dir/all] Error 2
>> mingw32-make: *** [all] Error 2
>>
>>
>> I have in my ctk build directory ctk/CMakeFiles/QtMobility.dir a 
>> build.make
>> file with
>> "make" instead of "mingw32-make":
>>
>> CMakeExternals/Stamp/QtMobility/QtMobility-build:
>> CMakeExternals/Stamp/QtMobility/QtMobility-configure
>> $(CMAKE_COMMAND) -E cmake_progress_report
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeFiles $(CMAKE_PROGRESS_8)
>> @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold
>> "Performing build step for 'QtMobility'"
>> cd 
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMobility
>> && make <----------------------------*
>> cd 
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMobility
>> && "C:\Program Files\CMake 2.8\bin\cmake.exe" -E touch
>>
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Stamp/QtMobility/QtMobility-build
>>
>> and "make install" instead of "mingw32-make install":
>>
>> CMakeExternals/Stamp/QtMobility/QtMobility-install:
>> CMakeExternals/Stamp/QtMobility/QtMobility-build
>> $(CMAKE_COMMAND) -E cmake_progress_report
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeFiles $(CMAKE_PROGRESS_2)
>> @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --blue --bold
>> "Performing install step for 'QtMobility'"
>> cd 
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMobility
>> && make install <-----------------------*
>> cd 
>> D:\Developer\Releases\MinGW\SHARED\ctk\CMakeExternals\Source\QtMobility
>> && "C:\Program Files\CMake 2.8\bin\cmake.exe" -E touch
>>
>> D:/Developer/Releases/MinGW/SHARED/ctk/CMakeExternals/Stamp/QtMobility/QtMobility-install
>>
>>
>> I manually edited build.make and QtMobility proceeded to build.  Log4Qt
>> built without problems, but then I run into
>>
>> Scanning dependencies of target CTKCore
>> [  6%] Building CXX object
>> Libs/Core/CMakeFiles/CTKCore.dir/ctkCommandLineParser
>> .cpp.obj
>> cc1plus.exe: error: unrecognized command line option
>> "-Wstrict-null-sentinel"
>> cc1plus.exe: error: unrecognized command line option 
>> "-fvisibility=hidden"
>> cc1plus.exe: error: unrecognized command line option
>> "-fvisibility-inlines-hidde
>> n"
>> mingw32-make[5]: ***
>> [Libs/Core/CMakeFiles/CTKCore.dir/ctkCommandLineParser.cpp.
>> obj] Error 1
>> mingw32-make[4]: *** [Libs/Core/CMakeFiles/CTKCore.dir/all] Error 2
>> mingw32-make[3]: *** [all] Error 2
>> mingw32-make[2]: *** [CMakeExternals/Stamp/CTK-build/CTK-build-build] 
>> Error
>> 2
>> mingw32-make[1]: *** [CMakeFiles/CTK-build.dir/all] Error 2
>> mingw32-make: *** [all] Error 2
>>
>> the command line options appear in a number of flags.make files which
>> cannot
>> be edited since cmake
>> overwrites them with every call to mingw32-make.
>>
>> Id really like to try out CTK and hopefully contribute as our company 
>> would
>> like to switch
>> from KWWidgets to Qt.
>>
>> regards,
>> Dean
>>
>> _______________________________________________
>> Ctk-developers mailing list
>> Ctk-developers at commontk.org
>> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers
>>
> 




More information about the Ctk-developers mailing list