fedden / RenderMan

Command line C++ and Python VSTi Host library with MFCC, FFT, RMS and audio extraction and .wav writing.
The Unlicense
355 stars 44 forks source link

Couldn't build on Windows #23

Open inhahe opened 2 years ago

inhahe commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

Centauria commented 2 years ago

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 commented 2 years ago

ERROR C1189 can be solved by adding -DBOOST_PYTHON_STATIC_LIB

inhahe commented 2 years ago

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

nyckmaia commented 2 years ago

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:

Ma5onic commented 4 months ago

@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%
inhahe commented 3 weeks ago

Thanks for the help, but I'm still running into problems. I get 1>LINK : fatal error LNK1104: cannot open file 'libboost_python37-vc140-mt-sgd-x64-1_79.lib' I see that libboost_python311-vc140-mt-sgd-x64-1_79.lib exists in boost\lib, so boost is obviously using the latest installation of Python by default. So, I looked up how to override that, and I found bootstrap --with-python and bootstrap --with-python-version. I tried bootstrap vc143 --with-python=c:\python37 and re-ran b2, and it seemed to have no effect. It still creates libboost_python311.lib. So I tried bootstrap vc143 --with-python-version=3.7 and it also had no effect. So I found out about bootstrap --with-python-root and did bootstrap vc143 --with-python-root=c:\python37 and it still makes libboost_python311. Then I tried editing D:\boost_1_79_0\tools\build\example\user-config.jam and added the line using python : 3.7 : c:\python37 : c:\python37\include : c:\python37\libs ; and copied user-config.jam to d:\boost_1_79_0 and ran bootstrap and b2 again. Still makes libboost_python311*. This is frustrating.

inhahe commented 3 weeks ago

Okay, I solved that problem. No idea why the command-line parameters didn't work, but the user-config.jam worked when I set BOOST_BUILD_PATH=d:\boost_1_79_0\tools\build and put user-config.jam there and changed the \'s in the 'using' line to \\'s.

inhahe commented 3 weeks ago

@Centauria @nyckmaia In case you're reading this, I've stumbled across another problem here: https://github.com/fedden/RenderMan/issues/30 Thx for any help.