[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
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

.Net package is failed to build due to SWIG compilation error #8022

Open
dmtregrv opened this issue Nov 20, 2024 · 0 comments
Open

.Net package is failed to build due to SWIG compilation error #8022

dmtregrv opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@dmtregrv
Copy link

RDKit.DotNetWrap package didn't receive updates for a few years and probably won't. So, I attempt to reproduce build instructions from here in my fork.

I bumped all versions and ran the build without results because of the missing boost library. After I built the exact version from the instructions and after a successful build, I noticed the difference between these two versions. In a late version, the CONFIG option was added to the find_package command. After patching all CMakeLists.txt that contains this command and proper renaming of Boost flags, I successfully built the .sln file with this cmake command.

cmake D:/repos/build-rdkit-2024/rdkit-Release_2024_09_2 -Wdev -G"Visual Studio 17 2022" -AWin32 -DRDK_BUILD_SWIG_WRAPPERS=ON -DRDK_BUILD_SWIG_CSHARP_WRAPPER=ON -DRDK_BUILD_SWIG_JAVA_WRAPPER=OFF -DRDK_BUILD_PYTHON_WRAPPERS=OFF -DBOOST_ROOT=D:/repos/build-rdkit-2024/boost_1_86_0 -DBOOST_INCLUDEDIR=D:/repos/build-rdkit-2024/boost_1_86_0 -DBoost_INCLUDE_DIR=D:/repos/build-rdkit-2024/boost_1_86_0 -DBOOST_LIBRARY_DIRS=D:/repos/build-rdkit-2024/boost_1_86_0/lib32-msvc-14.3 -DEIGEN3_INCLUDE_DIR=D:/repos/build-rdkit-2024/eigen-3.4.0 -DZLIB_LIBRARY="D:/repos/build-rdkit-2024/zlib-1.3.1/buildx86/Release/zlib.lib" -DZLIB_INCLUDE_DIR="D:/repos/build-rdkit-2024/zlib-1.3.1" -DZLIB_LIBRARIES="D:/repos/build-rdkit-2024/zlib-1.3.1/buildx86/Release/zlib.lib" -DZLIB_INCLUDE_DIRS="D:/repos/build-rdkit-2024/zlib-1.3.1" -DCAIRO_INCLUDE_DIRS=D:/repos/build-rdkit-2024/cairo-1.16.0/src -DCAIRO_LIBRARIES=D:/repos/build-rdkit-2024/cairo-1.16.0/vc2017/Win32/Release/cairo.lib -DRDK_INSTALL_INTREE=ON -DRDK_BUILD_CPP_TESTS=OFF -DRDK_USE_BOOST_SERIALIZATION=ON -DRDK_USE_BOOST_IOSTREAMS=ON -DRDK_USE_BOOST_REGEX=ON -DBoost_NO_BOOST_CMAKE=ON -DRDK_BUILD_COORDGEN_SUPPORT=ON -DRDK_BUILD_MAEPARSER_SUPPORT=ON -DRDK_OPTIMIZE_POPCNT=ON -DRDK_BUILD_FREESASA_SUPPORT=ON -DRDK_BUILD_CAIRO_SUPPORT=ON -DRDK_BUILD_FREETYPE_SUPPORT=ON -DRDK_BUILD_THREADSAFE_SSS=ON -DRDK_BUILD_INCHI_SUPPORT=ON -DRDK_BUILD_AVALON_SUPPORT=ON -DRDK_INSTALL_COMIC_FONTS=OFF -DRDK_BUILD_TEST_GZIP=OFF -DRDK_USE_URF=ON -DRDK_SWIG_STATIC=OFF -DRDK_INSTALL_STATIC_LIBS=OFF -DRDK_INSTALL_DLLS_MSVC=ON -DFREETYPE_LIBRARY=D:/repos/build-rdkit-2024/freetype-2.10.4/objs/Win32/Release/freetype.lib -DFREETYPE_INCLUDE_DIRS=D:/repos/build-rdkit-2024/freetype-2.10.4/include

But on the sln file build stage, I got another error.

MSBuild RDKit.sln /p:Configuration=Release,Platform=Win32 /maxcpucount

Error

154>D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\Code\JavaWrappers\csharp_wrapper..\MolSupplier.i(73): error : Extraneous #endif. [D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\Code\JavaWrappers\csharp_wrapper\RDKFuncs.vcxproj] The system cannot find the batch label specified - VCEnd 154>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(237,5): error MSB8066: Custom build for 'D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\Code\JavaWrappers\csharp_wrapper\GraphMolCSharp.i' exited with code 1. [D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\Code\JavaWrappers\csharp_wrapper\RDKFuncs.vcxproj] 154>Done Building Project "D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\Code\JavaWrappers\csharp_wrapper\RDKFuncs.vcxproj" (default targets) -- FAILED. 65>Done Building Project "D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\Code\JavaWrappers\csharp_wrapper\RDKFuncs.vcxproj.metaproj" (default targets) -- FAILED. 2>Done Building Project "D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\ALL_BUILD.vcxproj.metaproj" (default targets) -- FAILED. 1>Done Building Project "D:\repos\build-rdkit-2024\rdkit-Release_2024_09_2\buildwinx86CSharp\RDKit.sln" (default targets) -- FAILED.

As described in traceback SWIG interface MolSupplier.i has two #endif lines.

#ifdef RDK_USE_BOOST_IOSTREAMS
%extend RDKit::v1::ForwardSDMolSupplier {
    ForwardSDMolSupplier(RDKit::gzstream *strm, bool sanitize=true, bool removeHs = true,
                  bool strictParsing = true) {
    const bool takeOwnership = false;
    RDKit::ForwardSDMolSupplier*foo = new RDKit::ForwardSDMolSupplier(
                                     (std::istream*)strm,
                                     takeOwnership,
                                     sanitize, removeHs, strictParsing);
    PRECONDITION(!foo->atEnd(), "LDJKLJF");
    return foo;
  }
};
#endif
#endif

I'm not a pro in C++ and especially SWIG-builds, so I don't know why I have such behavior. I don't understand why ForwardSDMolSupplier.cpp on this stage (or another header of the cpp file) generates breaking #endif construction, but I think it could affect Java wrapper as well.

Also, it reproduces in Ubuntu (WSL).

Configuration:

  • RDKit version: 2024.09.2
  • Swig 4.2.1
  • OS: Windows/ Ubuntu (WSL)
  • Python version (if relevant): 3.12
  • Are you using conda? no
@dmtregrv dmtregrv added the bug label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant