RenderMan icon indicating copy to clipboard operation
RenderMan copied to clipboard

Couldn't build on Windows

Open inhahe opened this issue 4 years ago • 10 comments

I already had c:\Boost, so I renamed it to c:\boost.2 and attempted to follow the instructions for building Boost. When running bootstrap.bat, I get an error:

C:\boost_1_74_0>bootstrap
Building Boost.Build engine

Failed to build Boost.Build engine.
Please consult bootstrap.log for further diagnostics.

The contents of bootstrap.log are:

LOCALAPPDATA=C:\Users\inhah\AppData\Local
Found with vswhere C:\Program Files\Microsoft Visual Studio\2022\Preview
###
### "Unknown toolset: vcunk"
###
### You can specify the toolset as the argument, i.e.:
###     .\build.bat msvc
###
### Toolsets supported by this script are: borland, como, gcc,
###     gcc-nocygwin, intel-win32, metrowerks, mingw,
###     vc12, vc14, vc141, vc142
###
### If you have Visual Studio 2017 installed you will need to either update
### the Visual Studio 2017 installer or run from VS 2017 Command Prompt
### as we where unable to detect your toolset installation.
###

So, I checked to see if the Boost I already had in c:\boost.2 was version 1.74, and it was, so I just renamed it to c:\Boost

Then I followed the rest of the instructions I got 160 warnings and 6 errors. The 6 errors are:

Error	C2872	'ssize_t': ambiguous symbol (compiling source file ..\..\Source\source.cpp)	RenderMan_DynamicLibrary	c:\program files (x86)\microsoft visual studio\shared\python37_64\include\pyport.h	84	
Error	C2872	'ssize_t': ambiguous symbol (compiling source file ..\..\Source\PatchGenerator.cpp)	RenderMan_DynamicLibrary	c:\program files (x86)\microsoft visual studio\shared\python37_64\include\pyport.h	84	
Error	C2872	'ssize_t': ambiguous symbol (compiling source file ..\..\Source\RenderEngine.cpp)	RenderMan_DynamicLibrary	c:\program files (x86)\microsoft visual studio\shared\python37_64\include\pyport.h	84	
Error	C1189	#error:  "Mixing a dll boost library with a static runtime is a really bad idea..." (compiling source file ..\..\Source\PatchGenerator.cpp)	RenderMan_DynamicLibrary	C:\Boost\include\boost-1_74\boost\config\auto_link.hpp	434	
Error	C1189	#error:  "Mixing a dll boost library with a static runtime is a really bad idea..." (compiling source file ..\..\Source\RenderEngine.cpp)	RenderMan_DynamicLibrary	C:\Boost\include\boost-1_74\boost\config\auto_link.hpp	434	
Error	C1189	#error:  "Mixing a dll boost library with a static runtime is a really bad idea..." (compiling source file ..\..\Source\source.cpp)	RenderMan_DynamicLibrary	C:\Boost\include\boost-1_74\boost\config\auto_link.hpp	434	

The full output with the warnings too is here: renderman errors.txt

One thing that may be important is that the first time I tried running bootstrap.bat, it started working, but I aborted it because it said it couldn't find some tools, so I figured I should install visual studio 14 and then run its vcvarsall.bat and then run bootstrap.bat again. I never got it to work again though. I even deleted the whole c:\boost_1_74_0 and extracted it again and tried again, still wouldn't work.

inhahe avatar Oct 14 '21 10:10 inhahe

I'm trying it on my other computer now, and I got Boost to install, but when I get to the instruction "Additional Include Directories", the directory "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\include" doesn't exist on my computer. The Python installation file I used was python-3.7.9-amd64.exe.

inhahe avatar Oct 22 '21 14:10 inhahe

I copied C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\include over from my other computer and tried compiling the project, and I got 160 warnings and 6 errors just like on the other computer.

inhahe avatar Oct 22 '21 15:10 inhahe

I found that ERROR C2872 can be solved by editing RenderEngine.h

before:

#include <array>
#include <iomanip>
#include <sstream>
#include <string>
#include "Maximilian/maximilian.h"
#include "Maximilian/libs/maxiFFT.h"
#include "Maximilian/libs/maxiMFCC.h"
#include "../JuceLibraryCode/JuceHeader.h"
#include <boost/python.hpp>

after:

#include <random>
#include <array>
#include <iomanip>
#include <sstream>
#include <string>
#include "Maximilian/maximilian.h"
#include "Maximilian/libs/maxiFFT.h"
#include "Maximilian/libs/maxiMFCC.h"
#include <boost/python.hpp>
#include "../JuceLibraryCode/JuceHeader.h"

It is because using namespace juce; will change the definition for ssize_t, and then boost::python will find 2 defs for ssize_t.

Centauria avatar Nov 03 '21 21:11 Centauria

ERROR C1189 can be solved by adding -DBOOST_PYTHON_STATIC_LIB

Centauria avatar Nov 03 '21 21:11 Centauria

@Centauria Forgive my n00bness, but can you tell me where exactly I'd put -DBOOST_PYTHON_STATIC_LIB? Thanks.

inhahe avatar Feb 22 '22 21:02 inhahe

I got the same 6 erros and 160 warnings of @inhahe . You can see in this printscreen below: image

Please, how can I fix it?

@inhahe @Centauria any ideas?

My System:

  • Windows 10 x64
  • Visual Studio 2019

nyckmaia avatar Feb 24 '22 02:02 nyckmaia

@inhahe the syntax of the -DBOOST_PYTHON_STATIC_LIB option seems to be an option for a different compiler.

To solve Error C1189 for RenderMan in Visual Studio, it can be specified from Project > Properties > C/C++ > Preprocessor and adding BOOST_PYTHON_STATIC_LIB (without the -D suffix) to the Preprocessor Definitions list. image

When you apply the changes, the command line options are auto-populated in the Project > Properties > C/C++ > Command Line where you can see that the /D "BOOST_PYTHON_STATIC_LIB" option has been added

@nyckmaia, to solve the Error C2872 'ssize_t' follow the instructions that @Centauria provided: Swap the order of line 22 and 23 in RenderEngine.h so that they look like this:

#include <boost/python.hpp>
#include "../JuceLibraryCode/JuceHeader.h"

Side note: I needed to build boost with the following options for all of the boost dependencies to build successfully:

 .\b2 --toolset=msvc-14.0 --build-type=complete address-model=64 --prefix=C:\Boost install -j%NUMBER_OF_PROCESSORS%

Ma5onic avatar Mar 03 '24 01:03 Ma5onic