-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set BOOST_LIBRARYDIR or BOOST_ROOT? #123
Comments
The absolute easiest way to use this on Windows 10 right now is to use the 'Windows Subsystem for Linux'. With the latest Win10 that will give you an install of Ubuntu 16.04, which will work just fine. The only issue you'd hit is if you tried to edit the files using Notepad++ or something, in which case you would need to deal with line-ending issues. I haven't used Cygwin, so I'm not sure what issue that might be (I'd guess that either you don't have a compiler/make installed or it just didn't set the right environment variables for them. You could fix the latter issue by specifying them when you call cmake, eg Unfortunately I haven't set this up on Windows for a while but I'll try to give you some pointers that may help (I don't have time soon, but it does look like people hit several issues with the current setup). As far as I recall, specifying the Boost include directory for cmake was enough to set it up correctly. You also need to make sure the Boost version and MS compiler version that you have match up. VS2017 I don't think is supported yet, so you'll probably need the C++ compiler from 2015 (which you can install from the VS2017 installer). If you have all of that and it's still giving you errors, just go specify the BOOST_LIBRARYDIR variable like any other cmake variable. I assume you can just do it in the gui, but you could also do it on the command line with like so: |
Yes, just wanted to have fun. It's a pain to configure boost! |
@jvillasante It would take a large amount of effort to remove the Boost dependency for very little benefit. Unfortunately there just isn't an extremely simple way to run C++ locally on Windows. Right now, to run the problem on Windows in Visual Studio, all that's required (outside of configuring the exercism-cli) is:
I re-tested that flow today with the latest version of everything (OS, VS, Boost, CMake), and it all worked fine. Issues notwithstanding, removing the Boost dependency would only remove the need to install Boost itself and rename a folder. |
I followed the steps above, but am still getting a cmake warning: New Boost version may have incorrect or missing dependencies... Maybe cmake or the exercism unit tests are not compatible with the latest version of Boost (1.66.0). C:\Users\scott\exercism\cpp\sum-of-multiples\build>cmake -G "Visual Studio 15" -BOOST_ROOT:PATH=C:/Users/scott/Programs/boost_1_66_0 -BOOST_INCLUDEDIR:PATH=C:/Users/scott/Programs/boost_1_66_0/boost -BOOST_LIBRARYDIR:PATH=C:/Users/scott/Programs/boost_1_66_0/lib .. CMake Warning at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:801 (message): CMake Warning at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:801 (message): CMake Error at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1928 (message): Boost version: 1.66.0 Boost include path: C:/Users/scott/Programs/boost_1_66_0 Could not find the following static Boost libraries:
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the CMake Warning (dev) at CMakeLists.txt:17 (if): Quoted variables like "MSVC" will no longer be dereferenced when the policy -- Configuring incomplete, errors occurred! C:\Users\scott\exercism\cpp\sum-of-multiples\build>pause |
After installing Boost 1.59.0 instead of 1.66.0, I get completely different output, but still not test results in the command prompt window: C:\Users\scott\exercism\cpp\sum-of-multiples>cd build C:\Users\scott\exercism\cpp\sum-of-multiples\build>cmake -G "Visual Studio 15" -DBOOST_ROOT:PATH=C:/local/boost_1_59_0 -DBOOST_INCLUDEDIR:PATH=C:/local/boost_1_59_0/boost -DBOOST_LIBRARYDIR:PATH=C:/local/boost_1_59_0/lib .. Quoted variables like "MSVC" will no longer be dereferenced when the policy -- Configuring done -- Generating done C:\Users\scott\exercism\cpp\sum-of-multiples\build>pause |
Visual Studio 2017 builds "..\exercism\cpp\sum-of-multiples\build\Debug\sum-of-multiples.exe" with 0 errors and 0 warnings. But running that executable seems to do nothing. I created a test.bat file as shown below, and then I finally got test results. The instructions got me nowhere near getting test results. Then I intentionally changed my function to return an incorrect result, and viola, I see I get an error message in the Output window: Severity Code Description Project File Line Suppression State call "C:\Users\scott\exercism\cpp\sum-of-multiples\build\Debug\sum-of-multiples.exe" This took me like 3 hours to get this far. I have nearly two years experience with C++ development. It should not be this hard to use Boost Test. And at this point, I still can't make cmake work, but fortunately VS 2017 works. Why is cmake a prerequisite for Windows, if Visual Studio builds and tests without it?? By the way, I love the experience of learning F# on exercism.io; but my initial impression with C++ is just awful, even though I usually enjoy programming in C++. |
Ok I'll just say that at first I renamed the subfolder to lib, and it didn't work. |
Which subfolder ? /libs ? |
@Patafikss He is probably referring to step 2 in #123 (comment)
|
@ScottHutchinson is correct I apologize for not making it clear, but yes that's it. |
I've added a comment to #190 (comment), the short of it is if you are on Windows (using Visual Studio), then you need to make sure you are using the correct CMake generator for the architecture version of Boost you downloaded. See the prior link for info. |
Had the same boost warning, but that was because it was just 32bit, got 64bit boost from https://sourceforge.net/projects/boost/files/boost-binaries/ |
On Win10 this can be done as environment variables.
Here you can create two variables. One called Note that You want to restart any console afterwards to make them pick up the changes to environment variables. You can verify via If CMake is up to date, it should pick up these environment variables as hints when searching for boost.
somewhere at the top of the project's Hope this helps. |
We removed the dependency on Boost, see #233. The setup here is no longer necessary. Closing. |
Cmake and boost combined is a disaster. |
check with -DBOOST_DEBUG=ON, this will tell you names of the libraries it is looking for. For me due to differences in versions of cmake and boost, it could no recognize the required libraries. |
Hi. I'm getting the following error messages in CMake GUI in Windows 10, when pressing configure. I'd much prefer to use cmake in Cygwin, but that's not working either so at this point anything that works would be great since I just want to learn C++ but can't currently run the tests, unfortunately.
The error message states:
"No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost."
How do I set BOOST_LIBRARYDIR or BOOST_ROOT?
CMake GUI error:
`CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/FindBoost.cmake:1842 (message):
Unable to find the requested Boost libraries.
Boost version: 1.63.0
Boost include path: C:/Program Files/boost/boost_1_63_0
Could not find the following static Boost libraries:
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:14 (find_package)
CMake Warning (dev) at CMakeLists.txt:17 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "MSVC" will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
This warning is for project developers. Use -Wno-dev to suppress it.
Configuring incomplete, errors occurred!
See also "C:/Program Files/CMake/bin/CMakeFiles/CMakeOutput.log".`
Cygwin error:
$ cmake -G "Unix Makefiles" .. 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: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!
And so, additionally, how do I set CMAKE_MAKE_PROGRAM and CMAKE_CXX_COMPILER?
Any help is much appreciated, thanks!
The text was updated successfully, but these errors were encountered: