Could not find a boost installation
Added by Rob Farmelo about 14 years ago
Hi,
I've been struggling to cross compile. I've studied the old thread on this and got through finding boost and had cmake almost succeed but for some reason it's again not finding my boost installation. Been staring at this for too long and was hoping someone might see an error.
Here's how I'm calling cmake:
rm -rf build
mkdir build
cd build
cmake -DBOOST_DIR=/work/robf/winst-0.2/deps/ppc/boost_1_44_0 -DBOOST_VERSION=1.44.0 -DBOOST_COMPILER=gcc345 -DBOOST_PREFIX=/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root -DCMAKE_TOOLCHAIN_FILE=/work/robf/winst-0.2/ppc/wt-3.1.7/ppc_toolchain.cmake /work/robf/winst-0.2/ppc/wt-3.1.7/
Error message is:
CMake Error at CMakeLists.txt:267 (MESSAGE):
Could not find a boost installation in
/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root.
This is the correct location for my build. e.g. in that dir are "lib/" and "include/" for my cross compiled boost.
Boost version is 1.44.0. Am I stating the BOOST_VERSION correctly as 1.44.0?
I've attached my CMakeCache.txt. Any ideas would be appreciated...
Thanks,
Rob
CMakeCache.txt (16.5 KB) CMakeCache.txt |
Replies (8)
RE: Could not find a boost installation - Added by Koen Deforche about 14 years ago
Hey Rob,
You should set BOOST_VERSION to 1_44. But usually it is not needed, it depends on how boost was built.
BOOST_DIR is no longer used, it is superseded by BOOST_PREFIX.
It seems that neither the header files or the library is found.
The header files should be in $BOOST_PREFIX/include
e.g. $BOOST_PREFIX/include/boost/version.hpp
The libraries in $BOOST_PREFIX/lib
Regards,
koen
RE: Could not find a boost installation - Added by Rob Farmelo about 14 years ago
Hi Koen,
Thanks for your response...
Koen Deforche wrote:
Hey Rob,
You should set BOOST_VERSION to 1_44. But usually it is not needed, it depends on how boost was built.
BOOST_DIR is no longer used, it is superseded by BOOST_PREFIX.
I removed BOOST_DIR and updated BOOST_VERSION to 1_44 but still no luck.
It seems that neither the header files or the library is found.
The header files should be in $BOOST_PREFIX/include
At this location, I have a "boost" directory containing all my boost .hpp files.
e.g. $BOOST_PREFIX/include/boost/version.hpp
My version.hpp can be found at this location. There must be some other criteria for selecting my .hpp files that is not being met.
Any other thoughts would be great...
Thanks,
Rob
The libraries in $BOOST_PREFIX/lib
Regards,
koen
RE: Could not find a boost installation - Added by Rob Farmelo about 14 years ago
Hi,
I seem to have it working now so will document my process...
I created this script to set some essential cmake parameters and also pass in some cross compiler
tool chain definitions, and ran it from my wt-3.1.7 directory:
#!/bin/ksh
rm -rf build
mkdir build
cd build
cmake -DBOOST_VERSION=1_44 -DBOOST_COMPILER=gcc345 -DBOOST_PREFIX=/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/
-DBoost_ADDITIONAL_VERSIONS=1.44 -DCMAKE_TOOLCHAIN_FILE=/work/robf/winst-0.2/ppc/wt-3.1.7/ppc_toolchain.cmake ..
(removing old build dir is required because variables are cached from earlier builds and
my override the latest ones).
To cross compile, I had created a tool chain file as specified at the cmake web page
(http://www.cmake.org/Wiki/CMake_Cross_Compiling) referenced on the Wt Twiki page for "Wt Embedded".
When I passed this tool chain file to cmake, it messed up cmake's ability to find boost even
though I was giving cmake the correct location. Without the toolchain file, cmake worked
fine, proceeding to build for my build host's architecture.
my original (failing) toolchain file:
***********************************************************************************
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-gcc)
SET(CMAKE_CXX_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/eldk-2007-01-19/ppc_74xx /home/alex/eldk-ppc74xx-inst)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
***********************************************************************************
I had initially set the last 2 variables (MODE_LIBRARY and MODE_INCLUDE) to "ONLY" as
suggested by the cmake web page. I had to switch the following parameters to "BOTH" to
get cmake to work. e.g.:
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
The whole cross compile process was a huge time sink for me...
It would really be nice to have the procedure added to the "Wt Embedded" Wiki link.
Rob
RE: Could not find a boost installation - Added by Koen Deforche about 14 years ago
Hey Rob,
I seem to have it working now so will document my process...
I created this script to set some essential cmake parameters and also pass in some cross compiler
tool chain definitions, and ran it from my wt-3.1.7 directory:>
> #!/bin/ksh
> rm -rf build
> mkdir build
> cd build
>
> cmake -DBOOST_VERSION=1_44 -DBOOST_COMPILER=gcc345 -DBOOST_PREFIX=/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/
> -DBoost_ADDITIONAL_VERSIONS=1.44 -DCMAKE_TOOLCHAIN_FILE=/work/robf/winst-0.2/ppc/wt-3.1.7/ppc_toolchain.cmake ..
>
(removing old build dir is required because variables are cached from earlier builds and
my override the latest ones).
While I'm glad you got it going (and thanks for sharing the process!), I have some doubts about this combination of flags:
The options -DBOOST_VERSION=1_44 and -DBOOST_COMPILER=gcc345 select automatically Wt's own (vintage) boost configuration.
The option -DBoost_ADDITIONAL_VERSIONS=1.44 is used only by the cmake boost configuration, and would in this case not be used. If you have a spare moment, could you verify that?
When I passed this tool chain file to cmake, it messed up cmake's ability to find boost even
though I was giving cmake the correct location. Without the toolchain file, cmake worked
fine, proceeding to build for my build host's architecture.
For your build target architecture ?
my original (failing) toolchain file:
>
> ***********************************************************************************
> # this one is important
> SET(CMAKE_SYSTEM_NAME Linux)
> #this one not so much
> SET(CMAKE_SYSTEM_VERSION 1)
>
> # specify the cross compiler
> SET(CMAKE_C_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-gcc)
> SET(CMAKE_CXX_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-g++)
>
> # where is the target environment
> SET(CMAKE_FIND_ROOT_PATH /opt/eldk-2007-01-19/ppc_74xx /home/alex/eldk-ppc74xx-inst)
>
> # search for programs in the build host directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> # for libraries and headers in the target directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> ***********************************************************************************
>
Strange enough, this kind of toolchain file (with "ONLY" options) just last week worked out of the box to build Wt for an ARM platform. Perhaps this was because I installed my cross-compiled boost inside the CMAKE_FIND_ROOT_PATH and you did not ?
>
> # for libraries and headers in the target directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
>
The whole cross compile process was a huge time sink for me...
It would really be nice to have the procedure added to the "Wt Embedded" Wiki link.
Yes, sorry for the lost time. CMake's support for cross-compilation has improved alot since we started using CMake, but it still has strange twists, especially with locating libraries. We are currently struggling with turning Wt into a proper MacOSX framework (for iPhone and iPad devices, ARM).
Regards,
koen
RE: Could not find a boost installation - Added by Wim Dumon about 14 years ago
Strange enough, this kind of toolchain file (with "ONLY" options) just last week worked out of the box to build Wt for an ARM platform. Perhaps this was because I installed my cross-compiled boost inside the CMAKE_FIND_ROOT_PATH and you did not ?
>
'BOTH' is definitely a weird setting for these options. The problem is probably with the BOOST_PREFIX and CMAKE_FIND_ROOT_PATH:
With a BOOST_PREFIX of /work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/, a CMAKE_FIND_ROOT_PATH of /opt/eldk-2007-01-19/ppc_74xx /home/alex/eldk-ppc74xx-inst, and 'ONLY' settings for those options, cmake will look for boost includes and libraries in the following base directories:
/opt/eldk-2007-01-19/ppc_74xx/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/
/home/alex/eldk-ppc74xx-inst/work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/
and NOT (hence: 'only') in /work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/
I don't know your directory structure, but maybe you need to add /work/robf/winst-0.2/deps/ppc/ to CMAKE_ROOT_PATH?
Best regards,
Wim.
RE: Could not find a boost installation - Added by Rob Farmelo about 14 years ago
Hi Koen,
Koen Deforche wrote:
Hey Rob,
> I seem to have it working now so will document my process...
>
> I created this script to set some essential cmake parameters and also pass in some cross compiler
> tool chain definitions, and ran it from my wt-3.1.7 directory:
>
> [...]
>
> (removing old build dir is required because variables are cached from earlier builds and
> my override the latest ones).While I'm glad you got it going (and thanks for sharing the process!), I have some doubts about this combination of flags:
The options -DBOOST_VERSION=1_44 and -DBOOST_COMPILER=gcc345 select automatically Wt's own (vintage) boost configuration.
The option -DBoost_ADDITIONAL_VERSIONS=1.44 is used only by the cmake boost configuration, and would in this case not be used. If you have a spare moment, could you verify that?
>
I don't know about the cmake boost configuration. My understanding is that I needed to build boost on my own, which I did. I was just adding variables in a mad attempt to get things working...
> When I passed this tool chain file to cmake, it messed up cmake's ability to find boost even
> though I was giving cmake the correct location. Without the toolchain file, cmake worked
> fine, proceeding to build for my build host's architecture.For your build target architecture ?
No, for my host's architecture. I was specifying the toolchain in a file like that specified
by the cmake web site. To simplify my build I tried building for the local(host's) environment
by not passing my toolchain file to cmake. That's how I discovered that something in that file
was causing the boost directories to not be found. Actually I don't know how it could have
succeeded with a make because my Boost libraries were cross compiled but cmake seemed to
complete successfully.
> my original (failing) toolchain file:
> [...]Strange enough, this kind of toolchain file (with "ONLY" options) just last week worked out of the box to build Wt for an ARM platform. Perhaps this was because I installed my cross-compiled boost inside the CMAKE_FIND_ROOT_PATH and you did not ?
>
That seems to explain it. I added my boost path to CMAKE_FIND_ROOT_PATH and switched the mode variables back to ONLY and cmake succeeded but make is having problems linking. I would have expected the BOOST_PREFIX to have provided the needed info but perhaps that is not used in "vintage mode"... Here's my updated tool chain file:
# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER /opt/crosstools/gcc-3.4.5-glibc-2.3.6/powerpc-linux/bin/powerpc-linux-gcc)
SET(CMAKE_CXX_COMPILER /opt/crosstools/gcc-3.4.5-glibc-2.3.6/powerpc-linux/bin/powerpc-linux-g++)
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /opt/crosstools/gcc-3.4.5-glibc-2.3.6/powerpc-linux /work/robf/winst-0.2/deps/ppc/boost_1_44_0/root/ )
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
> [...]
>
>
> The whole cross compile process was a huge time sink for me...
>
> It would really be nice to have the procedure added to the "Wt Embedded" Wiki link.Yes, sorry for the lost time. CMake's support for cross-compilation has improved alot since we started using CMake, but it still has strange twists, especially with locating libraries. We are currently struggling with turning Wt into a proper MacOSX framework (for iPhone and iPad devices, ARM).
We'll I've become more familiar with cmake, so it's not wasted effort...
Regards,
koen
RE: Could not find a boost installation - Added by Koen Deforche about 14 years ago
Hey Rob,
Thanks for further clarifying this. What we learned from this is that we need to indicate that it is important to install boost within the CMAKE_FIND_ROOT_PATH, or vice-versa add your boost location to that path.
As to why BOOST_PREFIX didn't work as expected: cmake will exclude it if CMAKE_FIND_ROOT_PATH_MODE_LIBRARY is set to ONLY, and the BOOST_PREFIX is outside the root path.
Finally, yes, cmake does not check that libraries are of the correct architecture. It only checks whether they exist and whether the include files exist. That explains why cmake would indeed proceed after having found boost libraries of the wrong architecture.
Regards,
koen