Building Cryptonote source with Boost on Windows 10 - c++

I'm trying to build Cryptonote source from GitHub - https://github.com/cryptonotefoundation/cryptonote
I've already successful complete building on Unix, but on Windows I have some problems with that.
I've install on my Windows 10 x64:
Microsoft Visual Studio 2013
Git
CMake 3.10.1
Python 2.7.9
Then I'm trying build and install
Boost 1.55.0
Downloaded "boost_1_55_0.zip" from here https://sourceforge.net/projects/boost/files/boost/1.55.0/
After unpacking I run from cmd
bootstrap.bat
Next I enter
.\b2
When build is done let's do install
.\b2 --toolset=msvc-12.0 --build-type=complete --prefix=D:\Boost install
Ok next is build Cryptonote sources, going to C:\cryptonote, create dir "build" and enter to "build" dir.
Now I trying to build Cryptonote by entering this
cmake -DBOOST_ROOT:PATHNAME=D:\Boost -g "Visual Studio 2012 Win64" ..
Here is output:
-- Building for: Visual Studio 12 2013
-- The C compiler identification is MSVC 18.0.31101.0
-- The CXX compiler identification is MSVC 18.0.31101.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1928 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: D:/Boost/include/boost-1_55
Could not find the following static Boost libraries:
boost_serialization
Some (but not all) of the required Boost libraries were found. You may
need to install these additional Boost libraries. Alternatively, 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:112 (find_package)
-- Found Git: C:/Program Files/Git/cmd/git.exe
-- Found PythonInterp: C:/Python27/python.exe (found version "2.7.9")
CMake Warning in CMakeLists.txt:
CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
been specified
-- Configuring incomplete, errors occurred!
See also "C:/cryptonote/build/CMakeFiles/CMakeOutput.log".
See also "C:/cryptonote/build/CMakeFiles/CMakeError.log".
Where I can find that library? Or what I need to do for complete build? Thank you!

Related

Use 64 bit python3 interpreter when building x86 (32 bit) project with cmake on Windows

Background
I have mutiplatform C++ project. Python is used only to download some dependencies from strange places and generate some C++ code. Python is NOT linked to any target, so I do not care what kind of platform it uses.
Problem
When configuring project for Windows 64 bit platform, python is found(find_package) without any problems. On my machine only Python 3.10.0 for Win64 is installed.
Now when I'm trying build same project for x86 (win32) it fails to configure since can't find 32 bit python.
Here is MCVE:
CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(findPythonToGenerate CXX)
find_package(Python3 REQUIRED)
configure_file(test.h.in test.h)
add_executable(foo main.cpp ${CMAKE_CURRENT_BINARY_DIR}/test.h)
target_include_directories(foo PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
main.cpp
#include <iostream>
#include "test.h"
int main()
{
std::cout << PYTHON_EXE << '\n';
return 0;
}
test.h.in
#pragma once
#define PYTHON_EXE "#Python3_EXECUTABLE#"
Now when building this for Windows 64 is just fine:
f:\mcve>cmake --version
cmake version 3.20.21032501-MSVC_2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
f:\mcve>rmdir /Q /S build32 build64
The system cannot find the file specified.
f:\mcve>cmake -S . -B build64 -A x64 -Thost=x64 -G "Visual Studio 16 2019"
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19044.
-- The CXX compiler identification is MSVC 19.29.30145.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: C:/Python310/python.exe (found version "3.10.0") found components: Interpreter
-- Configuring done
-- Generating done
-- Build files have been written to: F:/mcve/build64
f:\mcve>cmake -S . -B build32 -A Win32 -Thost=x86 -G "Visual Studio 16 2019"
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19044.
-- The CXX compiler identification is MSVC 19.29.30145.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx86/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python3 (missing: Python3_EXECUTABLE Interpreter)
Call Stack (most recent call first):
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/FindPython/Support.cmake:3165 (find_package_handle_standard_args)
C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.20/Modules/FindPython3.cmake:485 (include)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
See also "F:/mcve/build32/CMakeFiles/CMakeOutput.log".
Question
Can I configure cmake in some way that it give me access to python interpreter ignoring what is the current platform I'm building for? I do not want to install extra python - I do not need it.
I'm building 32 bit platform only to resolve build issues specific for that platform.
Here is similar question, but it is a different flavor, since I do not link anything with python.
Side Note
I think it was OK with older version of cmake. Recently I've updated my Visual Studio 2019 and as a result cmake too. Sadly I can't tell it for sure.
I just checked logs on build machine (which builds all platforms everyday) and on both platforms cmake 3.19 is used and same version of python and I'm sure it is 64 bit version. So looks like regression in cmake 3.20, so I raised issue.
Ok turns out that problem was type of python installation.
Some time ago I installed python 3.10 for "current user" instead for "local machine".
Apparently i didn't had to build for Win32 since that time and when I had to it happen just after MSVC upgrade.
So make sure you install python for "LOCAL MACHINE".

Why does CMake default to Program Files x86 when compiling 64 bit program?

I am trying to build and install a basic program with CMake 3.17.2 for 64 bit windows with Visual Studio 16 2019.
CMakeLists.txt:
cmake_minimum_required(VERSION 3.13.5)
project(Test)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "/EHsc")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message("IS DEFAULT: ${CMAKE_INSTALL_PREFIX}")
else()
message("NOT DEFAULT: ${CMAKE_INSTALL_PREFIX}")
endif()
message("PLATFORM = ${CMAKE_VS_PLATFORM_NAME_DEFAULT}")
add_executable(main main.cpp)
install(TARGETS main DESTINATION bin)
However, when running the following commands:
$ mkdir build
$ cd build
$ cmake ..
I get the following output:
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.27.29111.0
-- The CXX compiler identification is MSVC 19.27.29111.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
IS DEFAULT: C:/Program Files (x86)/Test
PLATFORM = x64
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/.../cmake-test/build
Why is the CMAKE_INSTALL_PREFIX defaulting to Program Files x86?
The CMake docs for CMAKE_INSTALL_PREFIX suggest it should be otherwise:
This variable defaults to /usr/local on UNIX and c:/Program Files/${PROJECT_NAME} on Windows.
Building confirms that the exe is really 64 bits:
$ cmake --build .
$ file Debug/main.exe
Debug/main.exe: PE32+ executable (console) x86-64, for MS Windows
Confirming that CMake itself is 64 bits, and explicitly running with that, gives the same output:
$ file /c/Program\ Files/CMake/bin/cmake.exe
/c/Program Files/CMake/bin/cmake.exe: PE32+ executable (console) x86-64, for MS Windows
# in CMD to remove git bash from the equation...
$ echo %PROGRAMFILES%
C:\Program Files
$ "C:\Program Files\CMake\bin\cmake.exe" ..
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19042.
...
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe
...
IS DEFAULT: C:/Program Files (x86)/Test
PLATFORM = x64
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/.../cmake-test/build
I believe this was happening because, while CMake was assuming VS 2019 as the generator, it was not assuming x64 as the architecture.
The architecture can be set with the -A flag:
cmake -G "Visual Studio 17 2022" -A x64
Explicitly setting the generator may or may not be necessary. Regardless, that seems to do the trick for the install.

cmake: LIBCLANG_PATH not found on windows

I am trying to write a simple clang AST cursor traveler.
https://github.com/dyhe83/clang-AST-cursor-traveler
This following cmake code works fine on Linux.
PROJECT(traveler)
FIND_LIBRARY(LIBCLANG_PATH
clang HINTS /usr/local/lib/
)
ADD_EXECUTABLE(traveler
traveler.cpp
)
TARGET_LINK_LIBRARIES(traveler
${LIBCLANG_PATH}
)
I also want to run this example on windows.
My LLVM is build in "C:\Program Files (x86)\LLVM"
But after I changed the FIND_LIBRARY part of CMakeLists.txt.
FIND_LIBRARY(LIBCLANG_PATH
clang HINTS "C:\\Program Files (x86)\\LLVM\\lib"
)
Some error occurs:
D:\WorkSpace\C\clang-AST-cursor-traveler\build>cmake ..
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27025.1
-- The CXX compiler identification is MSVC 19.16.27025.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
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:
LIBCLANG_PATH
linked by target "traveler" in directory D:/WorkSpace/C/clang-AST-cursor-traveler/src
-- Configuring incomplete, errors occurred!
See also "D:/WorkSpace/C/clang-AST-cursor-traveler/build/CMakeFiles/CMakeOutput.log".
And "C:\Program Files (x86)\LLVM\lib" have the libraries.
Does anyone know where is the correct clang library path on windows??
Try to set env virable in windows.
I mean the place where you add/edit PATH env virables
LIBCLANG_PATH=C:\Program Files (x86)\LLVM\lib

Error while building a cpp application by linking with PCL

I built PCL on windows using VCPKG(MS Visual studio 2017). I am trying to build a CPP application with PCL using cmake 3.12 with the following CMakelists.txt.
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(compute)
find_package(PCL 1.5 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (compute compute.cpp)
target_link_libraries (compute ${PCL_LIBRARIES})
I also set the following environment variables.
set PCL_INCLUDE_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\pcl"
SET PCL_LIBRARY_DIRS="C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\lib"
set PCL_LIBRARIES="pcl_common_release.lib;pcl_features_release.lib;pcl_filters_release.lib;pcl_io_ply_release.lib;pcl_io_release.lib"
I initially got an error saying it is unable to find the file FindPCL.cmake and eventually PCLConfig.cmake or PCL-Config.cmake. I set the environment variable
set PCL_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\share\pcl
where the PCLConfig.cmake is installed. It was able to detect the file. However,
it is unable to detect PCL(pcl_report_not_found) with the following error.
c:\PCL-Program>cmake .
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
-- The C compiler identification is MSVC 19.16.27023.1
-- The CXX compiler identification is MSVC 19.16.27023.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find Eigen (missing: EIGEN_INCLUDE_DIR)
CMake Error at C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:56 (message):
common is required but eigen was not found
Call Stack (most recent call first):
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:356 (pcl_report_not_found)
C:/vcpkg-pcl/vcpkg-master/installed/x64-windows/share/pcl/PCLConfig.cmake:526 (find_external_library)
CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/PCL-Program/CMakeFiles/CMakeOutput.log".
c:\PCL-Program>set EIGEN_INCLUDE_DIR
EIGEN_INCLUDE_DIR=C:\vcpkg-pcl\vcpkg-master\installed\x64-windows\include\Eigen
Even after setting the environment variable for EIGEN_INCLUDE_DIR, I am still getting the same error. Please let me know if I am following the right way.
Thanks!

Cmake - Could NOT find Boost windows

Hej, I have a problem running my project with Cmake.
But I am getting an error.
"Could NOT find Boost"
I have the boost folder in
"C:\Program Fileenter code heres\PCL 1.6.0\3rdParty\Boost"
images: http://imgur.com/a/YgtQR
At first I got a error popup:
"error in configuration process, projekt files may be invalid"
Than I get this error.
The C compiler identification is MSVC 19.0.24215.1
The CXX compiler identification is MSVC 19.0.24215.1
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found eigen: C:/Program Files/PCL 1.6.0/3rdParty/Eigen/include
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Could NOT find Boost
CMake Error at
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:39 (message):
common is required but boost was not found
Call Stack (most recent call first):
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:354 (pcl_report_not_found)
C:/Program Files/PCL 1.6.0/cmake/PCLConfig.cmake:500 (find_external_library)
CMakeLists.txt:5 (find_package)
Configuring incomplete, errors occurred!
See also "//mac/Home/Documents/Visual Studio 2015/Projects/openni_range_image_visualization/build/CMakeFiles/CMakeOutput.log".
See also "//mac/Home/Documents/Visual Studio 2015/Projects/openni_range_image_visualization/build/CMakeFiles/CMakeError.log".
my CMakeLists contains:
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(openni_range_image_visualization)
find_package(PCL 1.3 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable (openni_range_image_visualization openni_range_image_visualization.cpp)
target_link_libraries (openni_range_image_visualization ${PCL_LIBRARIES})
This was asked a few years back, but for anybody that is still running into this problem-- the default download instructions on the PCL website help install PCL 1.6.0, which is an old version of PCL that has this little "bug" with regards to boost.
Instead, head over to their Github page and download the latest release here:
https://github.com/PointCloudLibrary/pcl/releases
for this bug has been fixed in the later releases.