[AD] [A4.4.1.1] Windows profile build fails |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Using
/cmake -DWANT_ALLEGROGL=on -DWANT_LOADPNG=on -DWANT_LOGG=on
-DWANT_JPGALLEG=on -DCMAKE_BUILD_TYPE=Profile -DSHARED=on -G "MinGW
Makefiles" ../
and running make gives these errors :
/Linking C shared library lib\alleg44-profile.dll
Creating library file: lib\liballeg44-profile.dll.a
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0x7):
undefined reference to `mcount'
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0x74):
undefined reference to `mcount'
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0xdd):
undefined reference to `mcount'
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0xfe):
undefined reference to `mcount'
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0x3f9):
undefined reference to `mcount'
CMakeFiles/allegro.dir/src/allegro.c.obj:allegro.c:(.text+0x4d9): more
undefined references to `mcount' follow
mingw32-make[2]: *** [lib/alleg44-profile.dll] Error 1
mingw32-make[1]: *** [CMakeFiles/allegro.dir/all] Error 2
mingw32-make: *** [all] Error 2/
From running 'make -B -n' and examining the output, here is the command
that builds the Allegro profile library :
/"C:\Tools\CMake\CMake 2.8\bin\cmake.exe" -E cmake_link_script
CMakeFiles\allegro.dir\link.txt --verbose=/
The contents of allegro/build/CMakeFiles/allegro.dir/link.txt are :
/C:\mingw\bin\gcc.exe -shared -o lib\alleg44-profile.dll
-Wl,--out-implib,lib\liballeg44-profile.dll.a
-Wl,--major-image-version,4,--minor-image-version,4
-Wl,@CMakeFiles\allegro.dir\objects1.rsp -lkernel32 -luser32 -lgdi32
-lcomdlg32 -lole32 -Wl,-Bstatic -ldinput -Wl,-Bdynamic -lddraw
-Wl,-Bstatic -ldxguid -Wl,-Bdynamic -lwinmm -Wl,-Bstatic -ldsound
-Wl,-Bdynamic -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32
-loleaut32 -luuid -lcomdlg32 -ladvapi32/
If I guess correctly, the undefined references to 'mcount' are because
the '-pg' flag was missing during the profiling library build.
I looked at allegro/CMakeLists.txt and on lines 314-321 it sets
CMAKE_EXE_LINKER_FLAGS_PROFILE to "-pg" if COMPILER_GCC is set :
/if(COMPILER_GCC)
set(CMAKE_C_FLAGS_PROFILE "-pg"
CACHE STRING "profiling flags")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE}"
CACHE STRING "profiling flags")
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "-pg"
CACHE STRING "profiling flags")
endif(COMPILER_GCC)/
So, shouldn't it be linking with the '-pg' flag then? Or is there some
COMPILER_MINGW variable that needs to be checked.
How do you set a libraries linking flags with cmake?
Any ideas how to fix this? The profiling build works fine on openSUSE 11.3.
(Using MinGW 3.4.5 on Vista with CMake 2.8)
Thanks, Edgar.