Hi Greg,

 

It would be great to have a tutorial/ walkthrough on the PostgreSQL :: RDKit 
implementation.  

Paolo supplied me with this in the past – awesome extremely helpful thanks, 
which worked up to a point…  I haven’t had time to revisit this.

 

Hope this is useful !

 

Best,

mike

 

 

Pre-requisites: install Python 3.5.2 in C:\Python35. Install CMake and make 
sure the CMake bin folder is in your PATH. Install Gohlke's numpy and Pillow 
into your Python 3.5.2. Install Eigen3 into C:\build. Install PostgreSQL.

1) Create a rdkit35.bat file which defines the following variables:

@echo off
set RDBASE=c:\build\rdkit
set PATH=C:\Python35;C:\Program Files\Git\bin;C:\Program 
Files\Git\usr\bin;C:\Program Files\Java\jdk1.8.0_31\bin;%PATH%
set PATH=C:\boost\boost_1_62_0_py35\lib64-msvc-14.0;%RDBASE%\lib;%PATH%
set PYTHONPATH=%RDBASE%

The above assumes that you installed Python 3 in C:\Python35, that you have the 
Microsoft Git in C:\Program Files\Git, and Java in C:\Program 
Files\Java\jdk1.8.0_31, and that you are going to install boost in C:\boost, 
and rdkit in C:\build. Adjust paths as needed.

2) Open a CMD window, source the above bat file:

rdkit35.bat

Make sure that the Python version in your path (the one which starts issuing 
the python command) is the one you wish to build the boost-python library 
against.

3) Build Boost.

Create C:\64\boost_1_62_0_py35_build and C:\64\boost_1_62_0_py35_build\source.
Download zlib128.zip, bzip2-1.0.6.tar.gz and boost_1_62_0.7z, and put them into 
C:\64\boost_1_62_0_py35_build\source folder
Copy/paste the attached build.cmd (see below, I haven't attached it as most 
e-mail servers would strip it) into C:\64\boost_1_62_0_py35_build\build.cmd and 
make sure the following variables at the beginning of the file are correctly 
set and match your compiler version, your 7-Zip installation location, and your 
zlib, bz2lib and Boost versions:

set BOOST_TOOLSET=msvc-14.0
set BOOST_VERSION=1_62_0
set ZIP7=%PROGRAMFILES(X86)%\7-zip\7z.exe
:: The following are all optional; comment out if not needed.
set BZIP_VERSION=1.0.6
set ZLIB_FILE_VERSION=128
set ZLIB_VERSION=1.2.8

In the same CMD window that you opened above, cd to 
C:\64\boost_1_62_0_py35_build and run:

build.cmd

When the build is completed, copy 
C:\64\boost_1_62_0_py35_build\build\boost_1_62_0-x64\boost_1_59_0\stage\lib
to C:\boost\boost_1_62_0_py35. Rename lib to lib64-msvc-14.0 (or whatever MSVC 
version you used to build Boost).
Create a C:\boost\boost_1_62_0 directory and copy 
C:\64\boost_1_62_0_py35_build\build\boost_1_62_0-x64\boost_1_62_0\boost into 
C:\boost\boost_1_62_0.

4) Get the latest RDKit master from GitHub:

cd c:\build
git clone https://github.com/rdkit/rdkit.git

5) Build the RDKit:

cd c:\build\rdkit
mkdir build
cd build
cmake -DEIGEN3_INCLUDE_DIR=C:\build\include\eigen3 
-DPYTHON_LIBRARY=C:\Python35\libs\python35.lib 
-DPYTHON_INCLUDE_DIR=C:\Python35\include 
-DBOOST_LIBRARYDIR=C:\boost\boost_1_62_0_py35\lib64-msvc-14.0 
-DBOOST_ROOT=C:\boost\boost_1_62_0 -DRDK_BUILD_AVALON_SUPPORT=ON 
-DRDK_BUILD_INCHI_SUPPORT=ON -DRDK_BUILD_PGSQL=ON -DPostgreSQL_ROOT="C:\Program 
Files\PostgreSQL\9.5" -DRDK_BUILD_SWIG_WRAPPERS=ON 
-DRDK_BUILD_SWIG_JAVA_WRAPPER=ON -DSWIG_DIR=C:\msys64\usr\share\swig\3.0.7 
-DSWIG_EXECUTABLE=C:\msys64\usr\bin\swig.exe -G"Visual Studio 14 2015 Win64" ..
c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m:4 
/p:Configuration=Release INSTALL.vcxproj

Follow the instructions in Code/PgSQL/rdkit/README to install the RDKit 
PostgreSQL cartridge DLL into your PostgreSQL installation.

I used the MSYS2 SWIG version packaged into MSYS2, but you can also get 
pre-built SWIG for Windows; change the above path accordingly.

If the above looks too scary, I'll provide you with my RDKit tree built against 
Boost 1.62, Python 3.5.1 (I think it should work also against Python 3.5.2) and 
PostgreSQL 9.5.

For Eigen 3:
- you won't need make.exe as you will use the native Microsoft toolchain to 
build Eigen3, you will only need cmake
- Install Visual Studio 2015 (14.0) Community Edition (Microsoft C and C++ 
compilers)
- Open a CMD window
- unzip the Eigen3 archive (I have just downloaded Eigen 3.3.1)
- cd to the eigen folder
- mkdir build
- cd build
- "C:\Program Files (x86)\Microsoft Visual Studio 
14.0\VC\bin\amd64\vcvars64.bat" (this will set the environment variables 
appropriate for the 64-bit version of the compiler)
- cmake -DCMAKE_INSTALL_PREFIX=C:\build .. (this will install Eigen 3 under 
C:\build\include\Eigen3; change the C:\build path if you wish to install Eigen3 
somewhere else)
- c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /m:4 
/p:Configuration=Release INSTALL.vcxproj (this will install Eigen3 headers into 
C:\build\include\Eigen3, or elsewhere depending on the CMAKE_INSTALL_PREFIX you 
chose.

For Boost 1.62:
- is Microsoft Visual Studio 14.0 Community Edition installed? If so, do the 
paths in build.cmd refer to the correct installation sources?
Check in particular

set BOOST_TOOLSET=msvc-14.0
set BOOST_VERSION=1_62_0
set ZIP7=%PROGRAMFILES(X86)%\7-zip\7z.exe
set BZIP_VERSION=1.0.6
set ZLIB_FILE_VERSION=128
set ZLIB_VERSION=1.2.8 



build.cmd

Copy-paste the text between *** below in a text editor and save it as 
C:\64\boost_1_62_0_py35_build\build.cmd

***
rem @echo off
:: Script for building Boost C++ Libraries on Windows.
:: Writen by Paul Colby (http://colby.id.au), no rights reserved ;)
:: See http://colby.id.au/building-boost-on-windows
:: The following are all required; adjust to match your setup.
set BOOST_TOOLSET=msvc-14.0
set BOOST_VERSION=1_62_0
set ZIP7=%PROGRAMFILES(X86)%\7-zip\7z.exe
:: The following are all optional; comment out if not needed.
set BZIP_VERSION=1.0.6
set ZLIB_FILE_VERSION=128
set ZLIB_VERSION=1.2.8
:: Only define the Windows SDK version if standalone, ie for Express versions 
prior to 2012.
rem set WIN_SDK_VERSION=7.1
if "%WIN_SDK_VERSION%" NEQ "" set WIN_SDK=%PROGRAMFILES%\Microsoft 
SDKs\Windows\v%WIN_SDK_VERSION%
if "%WIN_SDK%" NEQ "" (
if exist "%WIN_SDK%\Bin\SetEnv.cmd" set SET_ENV=%WIN_SDK%\Bin\SetEnv.cmd
rem I like to copy %WIN_SDK%\Bin\SetEnv.cmd to %WIN_SDK%\Bin\SetEnvNc.cmd to
rem remove the two "COLOR 0x" calls and the CLS call - just for nicer output.
if exist "%WIN_SDK%\Bin\SetEnvNc.cmd" set SET_ENV=%WIN_SDK%\Bin\SetEnvNc.cmd
)
goto main
:: usage: call:extract input-file output-dir
:extract
@echo Extracting "%~1" to "%~2"
"%ZIP7%" x -o"%~2" "%~1" > nul
if errorlevel 1 (
echo Failed to extract "%~1"
pause
exit errorlevel
)
goto :EOF
:: usage: call:configureWinSDK x86|x64|ia64 debug|release 
[/vista^|/xp^|/2003^|/2008^|/win7]
:configureWinSDK
if "%WIN_SDK%" EQU "" goto :EOF
set TARGET_ARCH=/%1
set MODE=/%2
if "%3" EQU "" ( set TARGET_OS=/xp ) else set TARGET_OS=%3
call "%SET_ENV%" %MODE% %TARGET_ARCH% %TARGET_OS%
goto :EOF
:: usage: call:extractsource build_dir
:extractSource
set SOURCE_DIR=%~dp0source
set SOURCE_FILE=%SOURCE_DIR%\boost_%BOOST_VERSION%.zip
if exist "%SOURCE_DIR%\boost_%BOOST_VERSION%.7z" (
set SOURCE_FILE=%SOURCE_DIR%\boost_%BOOST_VERSION%.7z
)
if not exist "%~1" call:extract %SOURCE_FILE% %~1
goto :EOF
:: usage: call:bootstrap boost_dir
:bootstrap
@echo Bootstrapping %~1
pushd "%~1"
call bootstrap.bat
popd
goto :EOF
:: usage: call:buildBoost boost_dir install_dir x86|x64|ia64 debug|release
:buildBoost
if /I "%~3" EQU "ia64" ( set BOOST_ARCH=ia64 ) else set BOOST_ARCH=x86
if /I "%~3" EQU "x86" ( set BOOST_ADDR=32 ) else set BOOST_ADDR=64
if "%BZIP_VERSION%" NEQ "" set 
sBZIP2=-sBZIP2_SOURCE="%~dp0source\bzip2-%BZIP_VERSION%"
if "%ZLIB_FILE_VERSION%" NEQ "" set 
sZLIB=-sZLIB_SOURCE="%~dp0source\zlib-%ZLIB_VERSION%" 
-sZLIB_INCLUDE="%~dp0source\zlib-%ZLIB_VERSION%"
pushd "%~1"
b2.exe --build-type=complete -j %NUMBER_OF_PROCESSORS% --prefix="%~2" %sZLIB% 
%sBZIP2% architecture=%BOOST_ARCH% address-model=%BOOST_ADDR% 
toolset=%BOOST_TOOLSET% link=shared runtime-link=shared stage
rem b2.exe --debug-configuration --build-type=complete -j 
%NUMBER_OF_PROCESSORS% --prefix="%~2" -sZLIB_BINARY="zlib" 
-sZLIB_LIBPATH="C:\build\zlib-1.2.8" -sZLIB_INCLUDE="C:\build\zlib-1.2.8" 
-sBZIP2_INCLUDE="C:\build\bzip2-1.0.6" -sBZIP2_BINARY="libbz2" 
-sBZIP2_LIBPATH="C:\build\bzip2-1.0.6" -sNO_ZLIB=0 -sNO_BZIP2=0 
-sNO_COMPRESSION=0 architecture=%BOOST_ARCH% address-model=%BOOST_ADDR% 
toolset=%BOOST_TOOLSET% link=shared runtime-link=shared stage
popd
goto :EOF
:: usage: call:build x86|x64|ia64 debug|release
:build
@echo ==== Building %~1 ====
set BUILD_DIR=%~dp0build\boost_%BOOST_VERSION%-%~1
if not exist "%BUILD_DIR%" call:extractSource %BUILD_DIR%
set BOOST_DIR=%BUILD_DIR%\boost_%BOOST_VERSION%
if not exist "%BOOST_DIR%\b2.exe" call:bootstrap %BOOST_DIR%
set INSTALL_DIR=%BUILD_DIR%\install
if not exist "%INSTALL_DIR%" call:buildBoost %BOOST_DIR% %INSTALL_DIR% %~1
goto :EOF
:main
if "%BZIP_VERSION%" NEQ "" (
if not exist "%~dp0source\bzip2-%BZIP_VERSION%.tar" call:extract 
%~dp0source\bzip2-%BZIP_VERSION%.tar.gz %~dp0source
if not exist "%~dp0source\bzip2-%BZIP_VERSION%" call:extract 
%~dp0source\bzip2-%BZIP_VERSION%.tar %~dp0source
)
if "%ZLIB_FILE_VERSION%" NEQ "" (
if not exist "%~dp0source\zlib-%ZLIB_VERSION%" call:extract 
%~dp0source\zlib%ZLIB_FILE_VERSION%.zip %~dp0source
)
if not exist "%~dp0build" md "%~dp0build"
rem call:build x64 debug
rem call:build x64 release
rem call:build x86 debug
rem call:build x86 release
call:build x64
pause
***



 

 



 

Dr Mike Mazanetz, FRSC

Director

 

+44 (0) 1235 531048

+44 (0) 7780 672509

 <mailto:[email protected]> [email protected]

 <http://www.novadatasolutions.co.uk> www.novadatasolutions.co.uk

 

NovaData Solutions Ltd.

PO Box 639

Abingdon-on-Thames

Oxfordshire

OX14 9JD

United Kingdom

 

From: Greg Landrum [mailto:[email protected]] 
Sent: 12 May 2017 12:54
To: Bob Funchess <[email protected]>
Cc: RDKit Discuss <[email protected]>
Subject: Re: [Rdkit-discuss] conda build errors on Windows 10

 

Hi Bob,

 

On Thu, May 11, 2017 at 10:31 PM, Bob Funchess <[email protected] 
<mailto:[email protected]> > wrote:

 

I’m curious as to whether anyone is able to get RDKit to build on Windows 10 
with Visual Studio 2015; I’ve been trying off and on to get this to work for 
some time now with no discernable success.

 

Yeah, I was able to do so both while doing the conda builds and during the 
testing phase (where I do the build manually).

  

PS My ultimate goal is to build the RDKit DLL and the C# wrappers and that’s 
all I fundamentally care about; Java, Python, Postgres et al. are irrelevant to 
me except insofar as they help me get the C# wrappers… the Python version would 
be NICE (for testing), but I don’t actually NEED it. If anyone has actually 
successfully built RDKFuncs.DLL and RDKit2DotNet.DLL using the current version 
of RDKit, I would greatly appreciate any pointers.

 

Yeah, for this I think you really don't need/want to be using the conda stuff.

 

How about this: I'll put together a short tutorial/walk-through on doing a 
build of the C# wrappers with VS2015 under Win10 and we can see if that helps. 
I can try a first pass over the weekend.

 

 

-greg

 

 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to