Could not locate OIS using CMake and Makefiles - makefile

So I'm trying to compile a simple Ogre3D project:
C:\OgreSDK\Projects\Physics> cmake -G "MinGW Makefiles" ./
-- Looking for OGRE...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found Ogre Ghadamon (1.9.0)
-- Found OGRE: optimized;C:/OgreSDK/lib/Release/OgreMain.lib;debug;C:/OgreSDK/lib/Debug/OgreMain_d.lib
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;C:/OgreSDK/lib/Release/OgrePaging.lib;debug;C:/OgreSDK/lib/debug/OgrePaging_d.lib
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;C:/OgreSDK/lib/Release/OgreTerrain.lib;debug;C:/OgreSDK/lib/debug/OgreTerrain_d.lib
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;C:/OgreSDK/lib/Release/OgreProperty.lib;debug;C:/OgreSDK/lib/debug/OgreProperty_d.lib
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;C:/OgreSDK/lib/Release/OgreRTShaderSystem.lib;debug;C:/OgreSDK/lib/debug/OgreRTShaderSystem_d.lib
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;C:/OgreSDK/lib/Release/OgreVolume.lib;debug;C:/OgreSDK/lib/debug/OgreVolume_d.lib
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;C:/OgreSDK/lib/Release/OgreOverlay.lib;debug;C:/OgreSDK/lib/debug/OgreOverlay_d.lib
-- Looking for OIS...
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could not locate OIS
CMake Error at C:/OgreSDK/CMake/FindPkgMacros.cmake:120 (message):
Required library OIS not found! Install the library (including dev
packages) and try again. If the library is already installed, set the
missing variables manually in cmake.
Call Stack (most recent call first):
C:/OgreSDK/CMake/FindOIS.cmake:82 (findpkg_finish)
CMakeLists.txt:60 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/OgreSDK/Projects/Physics/CMakeFiles/CMakeOutput.log".
I checked, in the OgreSDK/bin folder I can see a OIS(_d).dll. If I try to setup a var OIS_HOME which point to a folder with dll folder within the ois.dll, it doesn't work either.
EDIT
Here is a gist with all env vars listed https://gist.github.com/vinz243/0eea7dd96db785d6a4e3
EDIT 2
After some attempts I edited the findOIS.cmake like this:
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
# - Try to find OIS
# Once done, this will define
#
# OIS_FOUND - system has OIS
# OIS_INCLUDE_DIRS - the OIS include directories
# OIS_LIBRARIES - link these to use OIS
# OIS_BINARY_REL / OIS_BINARY_DBG - DLL names (windows only)
include(FindPkgMacros)
findpkg_begin(OIS)
# Get path, convert backslashes as ${ENV_${var}}
getenv_path(OIS_HOME)
getenv_path(OGRE_SDK)
getenv_path(OGRE_HOME)
getenv_path(OGRE_SOURCE)
getenv_path(OGRE_DEPENDENCIES_DIR)
# construct search paths
# set(OIS_PREFIX_PATH "C:\\OgreSDK\\bin")
# create_search_paths(OIS)
# redo search if prefix path changed
message(STATUS OIS_PREFIX_PATH ": " ${OIS_PREFIX_PATH})
clear_if_changed(OIS_PREFIX_PATH
OIS_LIBRARY_FWK
OIS_LIBRARY_REL
OIS_LIBRARY_DBG
OIS_INCLUDE_DIR
)
set(OIS_LIBRARY_NAMES OIS)
get_debug_names(OIS_LIBRARY_NAMES)
use_pkgconfig(OIS_PKGC OIS)
# For OIS, prefer static library over framework (important when referencing OIS source build)
set(CMAKE_FIND_FRAMEWORK "LAST")
findpkg_framework(OIS)
if (OIS_HOME)
# OIS uses the 'includes' path for its headers in the source release, not 'include'
set(OIS_INC_SEARCH_PATH ${OIS_INC_SEARCH_PATH} ${OIS_HOME}/includes)
endif()
if (APPLE AND OIS_HOME)
# OIS source build on Mac stores libs in a different location
# Also this is for static build
set(OIS_LIB_SEARCH_PATH ${OIS_LIB_SEARCH_PATH} ${OIS_HOME}/Mac/XCode-2.2/build)
endif()
find_path(OIS_INCLUDE_DIR NAMES OIS.h HINTS "C:\\OgreSDK\\include\\OIS" PATH_SUFFIXES OIS)
find_library(OIS_LIBRARY_REL NAMES ${OIS_LIBRARY_NAMES} HINTS "C:\\OgreSDK\\lib\\Release" PATH_SUFFIXES Release RelWithDebInfo MinSizeRel)
find_library(OIS_LIBRARY_DBG NAMES ${OIS_LIBRARY_NAMES_DBG} HINTS "C:\\OgreSDK\\lib\\debug" PATH_SUFFIXES Debug)
make_library_set(OIS_LIBRARY)
if (WIN32)
set(OIS_BIN_SEARCH_PATH "C:\\OgreSDK\\bin")
find_file(OIS_BINARY_REL NAMES "OIS.dll" HINTS ${OIS_BIN_SEARCH_PATH}
PATH_SUFFIXES "" Release RelWithDebInfo MinSizeRel)
find_file(OIS_BINARY_DBG NAMES "OIS_d.dll" HINTS ${OIS_BIN_SEARCH_PATH}
PATH_SUFFIXES "" Debug )
endif()
mark_as_advanced(OIS_BINARY_REL OIS_BINARY_DBG)
findpkg_finish(OIS)
# add parent of OIS folder to support OIS/OIS.h
add_parent_dir(OIS_INCLUDE_DIRS OIS_INCLUDE_DIR)
# Reset framework finding
set(CMAKE_FIND_FRAMEWORK "FIRST")
And this is what is defined in CMakeCache.txt:
//Path to a file.
OIS_BINARY_DBG:FILEPATH=C:/OgreSDK/bin/Debug/OIS_d.dll
//Path to a file.
OIS_BINARY_REL:FILEPATH=C:/OgreSDK/bin/Release/OIS.dll
//x
OIS_INCLUDE_DIR:PATH=C:/OgreSDK/include/OIS
//x
OIS_LIBRARY_DBG:FILEPATH=OIS_LIBRARY_DBG-NOTFOUND
//x
EDIT 3
I edited the CMakeCache like this:
OIS_BINARY_DBG:FILEPATH=C:/OgreSDK/bin/Debug/OIS_d.dll
//Path to a file.
OIS_BINARY_REL:FILEPATH=C:/OgreSDK/bin/Release/OIS.dll
//x
OIS_INCLUDE_DIR:PATH=C:/OgreSDK/include/OIS
//x
OIS_LIBRARY_DBG:FILEPATH=C:/OgreSDK/lib/Debug/OIS_d.lib
//x
OIS_LIBRARY_FWK:STRING=NOTFOUND
//x
OIS_LIBRARY_REL:FILEPATH=C:/OgreSDK/lib/Debug/OIS.lib
And when I run make:
λ make
Scanning dependencies of target OgreApp
[ 50%] Building CXX object CMakeFiles/OgreApp.dir/BaseApplication.cpp.obj
[100%] Building CXX object CMakeFiles/OgreApp.dir/TutorialApplication.cpp.obj
make[2]: *** No rule to make target « C:/OgreSDK/lib/Debug/OIS.lib »,required for « dist/bin/OgreApp.exe ». Stop.
make[1]: *** [CMakeFiles/OgreApp.dir/all] Error 2
make: *** [all] Error2
EDIT 4: OK, i managed to run cmake. But this is what I get when bulding VS 2013 and v100 compiler:
2> TutorialApplication.cpp
2> Génération de code en cours...
2>BaseApplication.obj : error LNK2019: external symbol unresolved "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ) référencé dans la fonction "void __cdecl boost::system::`dynamic initializer for 'posix_category''(void)" (??__Eposix_category#system#boost##YAXXZ)
2>TutorialApplication.obj : error LNK2001: external symbol unresolved "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ)
2>Bas**eApplication.obj : error LNK2019: external symbol unresolved "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ) référencé dans la fonction "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat#system#boost##YAXXZ)
2>TutorialApplication.obj : error LNK2001: external symbol unresolved "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ)
2>C:\OgreSDK\Projects\Physics\build_win32\Debug\OgreApp_d.exe : fatal error LNK1120: 2 unresolved externals
========== Régénération globale : 1 a réussi, 1 a échoué, 0 a été ignoré ==========
EDIT 5
I'm building Ogre w/ VS 2013 and Boost. Successfully built OgreDeps and Ogre itself, but when running the SampleDemo.exe, it said that D3DCOMPILER_47.dll was missing, but finally found it in Steam folder. now I'm trying to recompile my project
EDIT #6
I compiled boost and generated the project. I opened it in VS 2013 and built ALL_BUILD successfully!!!! But how do I run it? The button Debug is named Attach... and when I build INSTALL task it gives me this in both debug and release
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: The command "setlocal
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: "C:\Program Files (x86)\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmEnd
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmErrorLevel
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: exit /b %1
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :cmDone
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
4>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(132,5): error MSB3073: :VCEnd" stopped with code 1.
EDIT #7
OK VS 2013 was generating the OgreApp.exe (or OgreApp_d) in dist. Copied every Ogre dll file in this folder and ran the exe and it worked :) Thank you guys for all your help. To conclude, the solution was rebuilding Ogre with the VS version I wanted to use

Why don't you wish to install pkg-config for Windows first? It would save you from a manual hacking of the CMakefile.txt-s.
The last error you've got is due to missing (proper) linker flags for linking Boost.System library. Likely, one or several of the libraries being linked in also require Boost.System, and this dependency isn't resolved automatically. Typically pkg-config is used to handle the dependecies, but since you're doing-it-yourself, you should manually add the library dependency using imported library target. See this tutorial to get the idea how to properly include external pre-existing libraries to the build chain of your project.
Actually the standard way to define required Boost dependencies in CMakeLists.txt looks like this:
find_package(Boost 1.50 COMPONENTS program_options locale REQUIRED)
with the subsequent
include_directories(${Boost_INCLUDE_DIRS})
add_executable(an_executable ${AN_EXE_SOURCES})
target_link_libraries(an_executable
...
${Boost_LIBRARIES}
)
please note that at least some linkers (e.g. GNU ld) can't re-order a given library list, so if your application demand LibA and LibB, and LibB in turn depends on LibA, than LibB should go first in the linkers library list (if both LibA and LibB depend on each other, than one of these libraries should be included twice). I'm not sure that the problem is actual for Microsoft VC++ Linker, but it's worth mentioning.
Upd: #Vinz243 had to rebuild the OGRE library to get it properly linked against the test application.

Related

error LNK2001: unresolved external symbol with CMake and directories C and C++

I'm new to CMake and also new to compiling mixed source, I have received the following errors while trying to compile using CMake and Visual Studio 14.0
(Link target) ->
main.obj : error LNK2001: unresolved external symbol ethash_get_cachesize
main.obj : error LNK2001: unresolved external symbol ethash_get_datasize
The layout of my project is like this:
I have ethash_get_cachesize and ethash_get_datasize defined in internal.c in a directory ethminer/libethash/ these are C source. im sure that the CMake file that came with this set of sources is ok as the project has compiled before without issue, it has only given me LINK problems after i have added the following:
I have another directory /ethminer/dag/ with a C++ source "dag.cpp" and "dag.h" these are both C++ files. and the CMake file.
set(SOURCES
DAG.h DAG.cpp
)
include_directories(BEFORE ..)
link_directories(BEFORE ..)
the C++ source file "dag.cpp" includes #include <libethash/internal.h>
however I fear that I am missing something to tell CMake or Visual Studio to find the files it needs from the directory containing "internal.c"
any help would be much appreciated

Trying to add Boost libraries to Cmake.txt (Clion Ide)

I see a lot of questions that are similar to this though not the same.
I'm having an issue getting boost recognized/working in Cmake using Clion I've tried a handful of ways including the incboost template included with Clion, moving on.
Cmake version 3.4
Boost version 1.60.0
find_package(Boost)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIR})
endif()
That's the auto generated incboost I mentioned above, This produces no results.
Second attempt is the following
set(Boost_Dir "C:\\Program Files (x86)\\boost_1_60_0\\")
find_package(Boost 1.60.0 COMPONENTS filesystem)
include_directories(${Boost_Dir})
CmakeFiles\Svp.dir/objects.a(main.cpp.obj):
In function`_static_initialization_and_destruction_0':
C:/PROGRA~2/BOOST_~1/boost/system/error_code.hpp:221: undefined reference
to `boost::system::generic_category()'
C:/PROGRA~2/BOOST_~1/boost/system/error_code.hpp:222: undefined
reference to `boost::system::generic_category()'
C:/PROGRA~2/BOOST_~1/boost/system/error_code.hpp:223: undefined
reference to `boost::system::system_category()'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [Svp.exe] Error 1
CMakeFiles\Svp.dir\build.make:96: recipe for target 'Svp.exe' failed
CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/Svp.dir/all' failed
mingw32-make.exe[2]: *** [CMakeFiles/Svp.dir/all] Error 2
CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/Svp.dir/rule' failed
mingw32-make.exe[1]: *** [CMakeFiles/Svp.dir/rule] Error 2
Makefile:117: recipe for target 'Svp' failed
mingw32-make.exe: *** [Svp] Error 2
My Third attempt produces this
set(boost "C:\\Program Files (x86)\\boost_1_60_0\\boost\\")
INCLUDE_DIRECTORIES(${boost})
fatal error: boost/filesystem/config.hpp: No such file or directory
# include <boost/filesystem/config.hpp>
^
compilation terminated.
mingw32-make.exe[3]: *** [CMakeFiles/Svp.dir/main.cpp.obj] Error 1
mingw32-make.exe[2]: *** [CMakeFiles/Svp.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles/Svp.dir/rule] Error 2
And finally the solutions given here How do you add boost libraries in CMakeLists.txt have not changed my error output.
here's how I use it, in a portable way, in my projects:
if (WIN32)
set(BOOST_ROOT "C:/Program Files (x86)/boost_1_60_0/")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREAD ON)
include_directories(${BOOST_ROOT})
link_directories(${BOOST_ROOT}/stage/lib) # add this before add_executable()
endif()
# Here call your add_executable method
# add_executable(TARGET_NAME ... )
if(NOT MSVC)
find_package(Boost REQUIRED COMPONENTS date_time filesystem wserialization system serialization thread regex)
if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(TARGET_NAME ${Boost_LIBRARIES})
endif()
endif()
You sometime need to specify the Boost_USE_STATIC_LIBS and Boost_USE_MULTITHREAD variables to help find_package find boost.
Also please specify the correct path to boost library with set(BOOST_ROOT, $path). Moreover, specify the boost packages you need in find_package. For instance
find_package(Boost REQUIRED COMPONENTS date_time filesystem thread regex)
if you only need the date_time filesystem thread regex packages
let me know if it works or not for you.

How to compile (and link) a python module using PyQt (and sip) under windows

I have a C++ project using Qt5 (also compiles with Qt4) which I want to make available in python (preferable 3.4). In order to do this I use PyQt4 (because of the QtXml module which is, as far as I know, not available in PyQt5 anymore) and sip. This all works perfectly on my linux machine. But unfortunately I need it for windows and can't get it run. What I have done so far:
A very small example without Qt or other dependencies (one function which returns an integer) works. Even with gcc. But after an "bad reloc" error in my project I switched to the MSVC
My python 3.4 was build with "MSC v.1600 32 bit (Intel)" "on win32" so according to What version of Visual Studio is Python on my computer compiled with? I downloaded Qt 5.2.1 MSVC2010 and Microsoft Visual Studio Express 2010 SP1
I assume that the precompiled PyQt4-4.11.2-gpl-Py3.4-Qt5.3.1-x32 should fit
In order to get the sip.h and sipconfig.py file I compiled sip (4.16.3).
From now on I am unsure what to do. I have to admit that I have no knowledge about libraries.
The C++/Qt project is compiled with QtCreator with CONFIG += staticlib and TEMPLATE = lib. The resulting *.lib (here: xml2db.lib) is been copied to the folder where my sip files are (e.g. sipxml2dbcmodule.cpp)
So via the "VS Command Prompt" nmake throws fatal (link) errors. I'm unsure what the needed compiler flags should be or if the staticlib is wrong. My flags are:
LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:$(TARGET).manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /NODEFAULTLIB:library /LIBPATH:/LIBPATH:C:\Qt\5.2.1\msvc2010\lib
LIBS = /LIBPATH:C:\Python34\libs python34.lib xml2db.lib /LIBPATH:C:\Qt\5.2.1\msvc2010\lib\Qt5Xmld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Sqld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Cored.lib
$(TARGET): $(OFILES)
$(LINK) $(LFLAGS) /OUT:$(TARGET) $(OFILES) $(LIBS)
Where target is "myTools.pyd". It results in
sipmyToolscmodule.cpp
sipmyToolsxml2db.cpp
Generating Code...
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DLL /MANIFEST /MANIFESTFILE:myTools
.pyd.manifest /SUBSYSTEM:WINDOWS /INCREMENTAL:NO /NODEFAULTLIB:library /LIBPATH:
C:\Qt\5.2.1\msvc2010\lib /OUT:myTools.pyd sipmyToolscmodule.obj sipmyToolsxml2db
.obj /LIBPATH:C:\Python34\libs python34.lib xml2db.lib /LIBPATH:C:\Qt\5.2.1\msvc
2010\lib\Qt5Xmld.lib C:\Qt\5.2.1\msvc2010\lib\Qt5Sqld.lib C:\Qt\5.2.1\msvc2010\l
ib\Qt5Cored.lib
xml2db.lib(xml2db.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_L
EVEL': value '2' doesn't match value '0' in sipmyToolscmodule.obj
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_i
nfo(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIB
CMT.lib(typinfo.obj)
MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall
type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z)
already defined in LIBCMT.lib(typinfo.obj)
Creating library myTools.lib and object myTools.exp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
myTools.pyd : fatal error LNK1169: one or more multiply defined symbols found
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\link.EXE"' : return code '0x491'
Stop.
I would be pleased for an answer or fresh idea. Thanks in advance.
EDIT
I don't know exactly how I solved it but here are a few more hints that helped me to solve it.
Since sip 5 won't have the build system I tried to create a qmake project. To do so I downloaded the pyqt source package and looked at the project files and adjusted it to my needs.
Especially when you are changing the qmake project file it might be usefull to delete the make, object and/or moc files.
The qt version should perfectly match to the pyqt version (actually I don't mean the version itself but the qt version it was compiled for)
Good luck for those who have similiar problems

How to get boost.python tutorial example to link with Python3?

I want to use boost.python with python 3.2+ (preferably 3.4) and Visual Studio 2010.
When I try to make the libs\python\example\tutorial example against any Python3 (I have tested 3.0, 3.2 and 3.4) it doesn't link (see below). When I link it against 2.7 it works.
The only change I make between attempts is updating user-config.jam in my home directory.
So it works when user-config.jam is:
# MSVC configuration
using msvc : 10.0 ;
# Python configuration:
using python : 2.7 : C:\\Python27 : C:\\Python27\\include : C:\\Python27\\libs ;
When I run bjam I get:
C:\Boost\boost_1_55_0\libs\python\example\tutorial>bjam
link.jam: No such file or directory
...patience...
...patience...
...found 1678 targets...
...updating 8 targets...
compile-c-c++ bin\msvc-10.0\debug\hello.obj
hello.cpp
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
Creating library bin\msvc-10.0\debug\hello_ext.lib and object bin\msvc-10.0\debug\hello_ext.exp
msvc.manifest.dll bin\msvc-10.0\debug\hello_ext.pyd
common.copy boost_python-vc100-gd-1_55.dll
..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_55.dll
1 file(s) copied.
common.copy hello_ext.pyd
bin\msvc-10.0\debug\hello_ext.pyd
1 file(s) copied.
capture-output bin\hello.test\msvc-10.0\debug\hello
1 file(s) copied.
**passed** bin\hello.test\msvc-10.0\debug\hello.test
...updated 8 targets...
If I change user-config.jam to:
# MSVC configuration
using msvc : 10.0 ;
# Python configuration:
using python : 3.4 : C:\\Python34 : C:\\Python34\\include : C:\\Python34\\libs ;
and to bjam clean and then bjam I get:
C:\Boost\boost_1_55_0\libs\python\example\tutorial>bjam
link.jam: No such file or directory
...patience...
...patience...
...found 1685 targets...
...updating 9 targets...
compile-c-c++ bin\msvc-10.0\debug\hello.obj
hello.cpp
msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd
Creating library bin\msvc-10.0\debug\hello_ext.lib and object bin\msvc-10.0\debug\hello_ext.exp
hello.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct _object * __cdecl boost::python::detail::init_module(struct PyModuleDef &,void (__cdecl*)(void))" (__imp_?init_module#detail#python#boost##YAPAU_object##AAUPyModuleDef##P6AXXZ#Z) referenced in function _PyInit_hello_ext
bin\msvc-10.0\debug\hello_ext.pyd : fatal error LNK1120: 1 unresolved externals
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 >nul
link /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console /out:"bin\msvc-10.0\debug\hello_ext.pyd" /IMPLIB:"bin\msvc-10.0\debug\hello_ext.lib" /LIBPATH:"C:\Python34\libs" #"bin\msvc-10.0\debug\hello_ext.pyd.rsp"
if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%
...failed msvc.link.dll bin\msvc-10.0\debug\hello_ext.pyd bin\msvc-10.0\debug\hello_ext.lib bin\msvc-10.0\debug\hello_ext.pdb bin\msvc-10.0\debug\hello_ext.pdb...
...removing bin\msvc-10.0\debug\hello_ext.lib
...removing bin\msvc-10.0\debug\hello_ext.pdb
common.copy boost_python-vc100-gd-1_55.dll
..\..\..\..\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_55.dll
1 file(s) copied.
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 1 target...
...updated 2 targets...
Looking online I find a couple of references to this error but no solutions...
Here is the best link:
http://lists.boost.org/boost-build/2011/06/25147.php
I have seen many people talking about using Python3 and boost.python so I must be missing something... Do I need to compile boost specifically for Python 3 somehow?
Help?
/Robert
So through trial and error I found a way that works.
I am not able to recompile a boost library from Python27 to Python34 but if I start from a clean area (i.e freshly 7zipped) and do the following it works (all in a Visual Studio 2010 command prompt):
Make sure you have a user-config.jam file in your home directory with the following content:
# MSVC configuration
using msvc : 10.0 ;
# Python configuration:
using python : 3.4 : C:\\Python34 : C:\\Python34\\include : C:\\Python34\\libs ;
cd C:\Boost\boost_1_55_0
bootstrap
b2 toolset=msvc-10.0 --build-type=complete --with-python --libdir=C:\Boost\lib\i386 install
cd C:\Boost\boost_1_55_0\libs\python\example\tutorial
set lib=c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib;C:\Boost\lib\i386;C:\Python34\libs (i.e add Boost Lib to path)
bjam
Modify hello.py to att () around print:
import hello_ext
print(hello_ext.greet())
python hello.py prints hello, world (Note that python here is python 3.4.1 my default install)
So what I still don't know how to solve is how to recompile boost and/or how to support two python version at the same time. Ideas and suggestions are welcomed but at the moment I only need Python3 so I will not investigate that.
Another thing to note is that the pre-compiled headers found online all seem to be 2.7 only. I hope these steps helps someone else!

CMake for CodeBlocks under windows

I'm trying to use CMake to code with CodeBlocks under Windows.
Inside Cygwin console I do :
cmake .. -G"CodeBlocks - Unix Makefiles"
and output is :
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:D:/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
I tried to set those problematic variables, but result is the same :
set CMAKE_MAKE_PROGRAM=C:/Progra~2/CodeBlocks/MinGW/bin/mingw32-make.exe
set CMAKE_C_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe
set CMAKE_CXX_COMPILER=C:/Progra~2/Microsoft Visual Studio 10.0/VC/bin/cl.exe
Any ideas how to make it work ?
Edit : adding the path to the compiler helps, but there's still an error :
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/cl.exe -- broken
CMake Error at /usr/share/cmake-2.8.9/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /cygdrive/d/sources/tests/testOSG/build_CodeBlocks/CMakeFiles/CMakeTmp
Run Build Command:C:/Program\ Files\
(x86)/CodeBlocks/MinGW/bin/mingw32-make.exe
"cmTryCompileExec437970983/fast"
C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make -f
CMakeFiles/cmTryCompileExec437970983.dir/build.make
CMakeFiles/cmTryCompileExec437970983.dir/build
/usr/bin/sh: -c: line 0: Erreur de syntaxe près du symbole inattendu « (
»
/usr/bin/sh: -c: line 0: `C:/Program Files
(x86)/CodeBlocks/MinGW/bin/mingw32-make -f
CMakeFiles/cmTryCompileExec437970983.dir/build.make
CMakeFiles/cmTryCompileExec437970983.dir/build'
mingw32-make: *** [cmTryCompileExec437970983/fast] Error 1
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
Maybe you installed the 'basic setup' from 'MinGW Installation Manager'. As it does not install the GNU C++ compiler with package name- 'mingw-gcc-g++'you should select its 'bin' and 'dev' and install manually. This worked for me.
for me following worked:
downloaded codeblocks-17.12mingw-setup.
added path to /MinGW/bin
hint: DONT INSTALL TO PATH WITH SPACES IN IT
in my case C:\Program Files (x86)\CodeBlocks\MinGW\bin dont worked for some projects.
when using c:\codeblocks... they work
in cmake use "CodeBlocks - MinGW Makefiles"
then open project.cbp
Make sure the directory with compilers(MinGw-gcc.exe or something similar) is in the PATH, after that start console one more time and try to run cmake again.

Resources