Cmake on Windows: the revisit

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
Post Reply
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Cmake on Windows: the revisit

Post by shenle »

Since maintaining my previous build system is becoming an exercise in futility, I am trying to make Cmake work on Windows.

I am still far from getting Cmake generate a viable project, much less compiling.

My setup:
Cmake 2.8.2
Visual C++ Express 10 (yes I have abandoned the VC++ 2003 toolkit), hopefully will stay available for a while
PSDK for Windows Server 2003 R2
and of course fresh checkout of vegastrike svn.

Here are my notes so far.

glut-3.7.6; put all files where they belong in the compiler include, lib and system dll

openal: need to install both the binary, and the sdk from Creative; modify cmake 2.8/Modules/FindOpenAL.cmake to include:
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\3.05;InstallDir]
in 2 locations, under the old registry key (Creative changed the version in the current download)

sdl 1.2.14:
vorbis 1.3.1:
ogg 1.2.0:
all override paths with downloaded binaries

jpeg8b - built new then overridden cmake path manually
libpng 1.4.1 - built then path overridden manually
zlib - built then path overridden manually
expat: d/l binary and then path overridden manually
ffmpeg: downloaded nightly build from http://ffmpeg.arrozcru.org/autobuilds/ then paths overridden manually
FindMath.cmake is stupid. Doesn't even try. Set manually. The math.h and mscvrt.lib are in the compiler includes and lib directories respectively. Here's an idea, for example, on how to find where VC++ 10 is installed:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC]
"ProductDir"="E:\\Program Files\\Microsoft Visual Studio 10.0\\VC\\"

Which brings me to the point where I am stumped.

Now cmake wants libdl and libutil. I know of none on Windows.

Here is the current output

Code: Select all

Could NOT find Boost
Could NOT find Boost
++ Using Internal Boost !
++ OpenGL found : glu32;opengl32
!! I can't build this, missing GLUT
++ Found OpenAL
++ SDL Found
Found Vorbis: M:/vegastrike/work/vorbis-tools-win32-bin/libvorbis.dll;M:/vegastrike/work/vorbis-tools-win32-bin/libvorbisfile.dll;M:/vegastrike/work/vorbis-tools-win32-bin/libogg.dll
CMake Error at E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:25 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


CMake Error at E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:72 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


CMake Error at E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  E:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:120 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


Found FFmpeg: M:/vegastrike/work/ffmpeg-latest-mingw32-static/lib/avcodec.lib;M:/vegastrike/work/ffmpeg-latest-mingw32-static/lib/avformat.lib;M:/vegastrike/work/ffmpeg-latest-mingw32-static/lib/avutil.lib
-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.
Ogre not found
-- Ogre Not Found: compiling without
Cant get GTK2 found
-- Compiling mesh_tool without OgreMesh support: Ogre not found
Default build type is Release, no cpu opts enabled. 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DL_LIB (ADVANCED)
    linked by target "vegaserver" in directory M:/vegastrike/svn/vegastrike
    linked by target "vegastrike" in directory M:/vegastrike/svn/vegastrike
UTIL_LIB (ADVANCED)
    linked by target "vegaserver" in directory M:/vegastrike/svn/vegastrike
    linked by target "vegastrike" in directory M:/vegastrike/svn/vegastrike

Configuring incomplete, errors occurred!
I'm attaching the current cmake cache
You do not have the required permissions to view the files attached to this post.
Last edited by shenle on Thu Aug 26, 2010 2:54 am, edited 1 time in total.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Cmake on Windows: the revisit

Post by klauss »

Many of the custom scripts (to look for ffmpeg and whatnot) use pkg-config.

Not sure what to do about it, but CMake must have an alternative I guess... perhaps an "if windows try this path?"
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

Here's a snippet from FindOpenAL.cmake; it works.

Code: Select all

FIND_PATH(OPENAL_INCLUDE_DIR al.h
  HINTS
  $ENV{OPENALDIR}
  PATH_SUFFIXES include/AL include/OpenAL include
  PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /sw # Fink
  /opt/local # DarwinPorts
  /opt/csw # Blastwave
  /opt
  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\3.05;InstallDir]
)

FIND_LIBRARY(OPENAL_LIBRARY 
  NAMES OpenAL al openal OpenAL32
  HINTS
  $ENV{OPENALDIR}
  PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
  PATHS
  ~/Library/Frameworks
  /Library/Frameworks
  /usr/local
  /usr
  /sw
  /opt/local
  /opt/csw
  /opt
  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\3.05;InstallDir]
)
Notice how I modified it so it works with the current OpenAL as it is installed by the current installation package from Creative.

Should be able to make packages that set registry keys diswcoverable.

Other packages, you might install by default, say at a preset relative path from the main directory in a Unix-like tree ( bin, include, lib etc)

Kinda like it is shown in part5 here: http://playcontrol.net/ewing/screencast ... make_.html
make me a sandwich
make: *** No rule to make target 'me'. Stop.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Cmake on Windows: the revisit

Post by klauss »

I think there's an ffmpeg build (libs, dlls, includes) in the vega-vc7 directory on svn.

Yep: look

You could try with adding that path, in relative form?

Thing is, the FindFFMPEG script would have to search for paths if in windows, search with pkg-config if not.

(pkg-config is a lot more adaptable on the *nix)
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

ffmpeg is not the problem, I have added it. Not sure why it complains about swscale, it never asks for it, and it's there together with the other libs.

No, the problem now is that it can't find libdl and libutil, and I cannot supply them. They are a very Unix-y thing, and apart from cygwin I know of nothing on Windows that uses them.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Cmake on Windows: the revisit

Post by klauss »

I don't think VS uses them directly. I believe they're required by Python, so you should be OK ignoring those dependencies for windows builds.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I don't even know where they are requested from so I can "ignore" them at the source, because cmake won't let me continue until I fix those dependencies.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
segfault
Merchant
Merchant
Posts: 39
Joined: Tue Aug 17, 2010 3:50 am
Location: Ottawa, Canada

Re: Cmake on Windows: the revisit

Post by segfault »

On FreeBSD I had some similar issues: There is no libdl!
Turns out that it is part of the Unix base libc, and the perscribed fix was to trick the system by making a symbolic link to libc:

Code: Select all

boarder# ln -s /usr/compat/linux/lib/libc.so.2 /usr/lib/libdl.so.2
boarder# ln -s /usr/compat/linux/lib/libc.so.6 /usr/lib/libc.so.6
weird... but it seems to work.
Perhaps you can do something similar?
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I did do something similar with the mathlib (see OP) which on Windows is contained within the VC runtime; however I had a header there to feed the detection script. I have no headers for these 2 libs. Plus there are of course no symlinks. :)
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I've gathered all the dependencies I could find in a single directory structure (except for those that install by default elsewhere, and which can be found correctly by cmake there) and launched cmake with a preset CMAKE_PREFIX_PATH pointing to that directory. It found everything fine, with the exception of swscale.lib (?why).

This simplifies keeping everything organized a bit, however it doesn't bring me any closer to getting rid of the libdl and libutil dependencies which prevent me from generating makefiles.

Code: Select all

Could NOT find Boost
Could NOT find Boost
++ Using Internal Boost !
++ OpenGL found : glu32;opengl32
++ GLUT found : D:/vegasvn/deps/lib/glut32.lib
++ Found OpenAL
++ SDL Found
Found Vorbis: D:/vegasvn/deps/lib/vorbis.lib;D:/vegasvn/deps/lib/vorbisfile.lib;D:/vegasvn/deps/lib/ogg.lib
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:25 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:72 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:306 (message):
  pkg-config tool not found
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:120 (pkg_check_modules)
  CMakeLists.txt:817 (find_package)


Found FFmpeg: D:/vegasvn/deps/lib/avcodec.lib;D:/vegasvn/deps/lib/avformat.lib;D:/vegasvn/deps/lib/avutil.lib
-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.
Ogre not found
-- Ogre Not Found: compiling without
Cant get GTK2 found
-- Compiling mesh_tool without OgreMesh support: Ogre not found
Default build type is Release, no cpu opts enabled. 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
DL_LIB (ADVANCED)
    linked by target "vegaserver" in directory D:/vegasvn/vegastrike
    linked by target "vegastrike" in directory D:/vegasvn/vegastrike
UTIL_LIB (ADVANCED)
    linked by target "vegaserver" in directory D:/vegasvn/vegastrike
    linked by target "vegastrike" in directory D:/vegasvn/vegastrike

Configuring incomplete, errors occurred!
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Cmake on Windows: the revisit

Post by klauss »

swscale is part of ffmpeg, a part the took apart at some point.

Different versions have different swscale locations and interfaces, so FindFFMPEG sets a few defines that pick between them.

If you know where swscale.h is, you could point the script to that place.

About libdl and libutil, again, I don't think you need them in Windows. Try to find out where it's requested.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I have pointed it to where swscale is, it still complains it can't find it. I have redirected libdl and libutil to msvcrt.lib, keeping fingers crossed hoping it'll work.

But now cmake chokes on pkg-config and won't go forward without it. Also complains a lot about not finding various parts of boost, even though it does find others (Boost_INCLUDE_DIR-NOTFOUND, Boost_PYTHON_LIBRARY_DEBUG-NOTFOUND, Boost_PYTHON_LIBRARY_RELEASE-NOTFOUND, etc).

I think pkg-config is the big obstacle now, it complains about it in 3 different places.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I'm still stuck at pkg-config. Cmake won't go past it.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Cmake on Windows: the revisit

Post by klauss »

I wish I could help, but I have no clue how cmake works on Windows.

I do know, however, that pkg-config is likely not going to work on Windows. So an alternative detection method will probably have to be coded in those macros that use pkg-config.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shenle
Confed Special Operative
Confed Special Operative
Posts: 381
Joined: Thu Jan 31, 2008 3:25 am
Location: hiding in a dark corner

Re: Cmake on Windows: the revisit

Post by shenle »

I've added binaries for pkgconfig and glib to my dependencies collection, but cmake just won't work with it.

I'll try to attach the libraries and headers I have collected so far as dependencies to this thread, so they're available for anyone else who wants to try and crack this issue. You should rename the files as deps.zip.0001, deps.zip.0002 etc then use 7zip to extract. I had to rename them like this because the board does not allow 0001, 0002 etc as extensions for attached files.
You do not have the required permissions to view the files attached to this post.
make me a sandwich
make: *** No rule to make target 'me'. Stop.
Post Reply