Skip to content

Build error on windows using mingw environment #1222

Open
@prashant-saxena

Description

@prashant-saxena

Hello,
Windows 10
msys2 build system

I have downloaded files from these links:

https://github.com/tpaviot/pythonocc-core/archive/refs/tags/7.7.0.zip
https://dev.opencascade.org/system/files/occt/OCC_7.7.0_release/opencascade-7.7.0.tgz

OpenCASCADE was compiled using the flag -D BUILD_RELEASE_DISABLE_EXCEPTIONS=OFF
No 3rdparty stuff.
Here are the cmake settings for pythonocc-core

Capture

I have to make some changes in CMakeLists.txt otherwise it's not even generating the files

cmake_minimum_required(VERSION 3.18)

Because I'm using PYTHONOCC_MESHDS_NUMPY flag

## update the environment with VIRTUAL_ENV variable (mimic the activate script)
set (ENV{VIRTUAL_ENV} "venv")
## change the context of the search
set (Python3_FIND_VIRTUALENV FIRST)
## unset Python3_EXECUTABLE because it is also an input variable (see documentation, Artifacts Specification section)
unset (Python3_EXECUTABLE)

############
# Python 3 #
############
if(PYTHONOCC_MESHDS_NUMPY)
    find_package(Python3 COMPONENTS Interpreter Development NumPy REQUIRED)
    include_directories(${Python3_NumPy_INCLUDE_DIRS})
    message(STATUS "Numpy include directory: ${Python3_NumPy_INCLUDE_DIRS}")
    set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DBUILD_MESHDS_NUMPY)
else(PYTHONOCC_MESHDS_NUMPY)
    find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
endif(PYTHONOCC_MESHDS_NUMPY)
message(STATUS "Python3 interpreter:" ${Python3_EXECUTABLE})
message(STATUS "Python include directory: ${Python3_INCLUDE_DIRS}")
message(STATUS "Python library release: ${Python3_LIBRARY_RELEASE}")

and some changes in swig

########
# SWIG #
########
#find_package(SWIG 4.1.1 REQUIRED PATHS E:/swigwin-4.1.1 NO_DEFAULT_PATH)
set(SWIG_EXECUTABLE C:/msys64/usr/bin/swig.exe)
find_package(SWIG REQUIRED)
#find_package(SWIG 4.1.1 REQUIRED)
include(UseSWIG)
message(STATUS "SWIG Found:" ${SWIG_FOUND})
message(STATUS "SWIG_EXECUTABLE: ${SWIG_EXECUTABLE}")
message(STATUS "SWIG_VERSION: ${SWIG_VERSION}")
message(STATUS "SWIG_USE_FILE: ${SWIG_USE_FILE}")
#include(${SWIG_USE_FILE})
set(SWIG_FILES_PATH src/SWIG_files/wrapper)
set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -fvirtual)
if(SWIG_HIDE_WARNINGS)
  message(STATUS "Disabled SWIG warnings")
  set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -w302,401,402,412,314,509,512,504,325,503,520,350,351,383,389,394,395,404)
endif()

Build errors:
...
...
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:97: Error: Template 'NCollection_UtfIterator' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:98: Error: Template 'NCollection_UtfString' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:99: Error: Template 'NCollection_UtfIterator' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:100: Error: Template 'NCollection_UtfString' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:101: Error: Template 'NCollection_UtfIterator' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:102: Error: Template 'NCollection_UtfString' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:103: Error: Template 'NCollection_UtfIterator' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/NCollection.i:104: Error: Template 'NCollection_UtfString' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/Resource.i:174: Error: Template 'NCollection_DataMap' undefined.
E:/opencascade-7.7.0/pythonocc-core-7.7.0/src/SWIG_files/wrapper/Resource.i:175: Error: Template 'NCollection_DataMap' undefined.
mingw32-make[2]: *** [CMakeFiles\Resource_swig_compilation.dir\build.make:75: CMakeFiles/Resource.dir/ResourcePYTHON.stamp] Error 10
mingw32-make[2]: *** Deleting file 'CMakeFiles/Resource.dir/ResourcePYTHON.stamp'
mingw32-make[1]: *** [CMakeFiles\Makefile2:1325: CMakeFiles/Resource_swig_compilation.dir/all] Error 2
mingw32-make[1]: *** Waiting for unfinished jobs....
...
...
I have also tried building from the master branch of both packages but failed.
Could anybody point out the mistake?

Cheers
Prashant

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions