conda-forge / occt-feedstock

A conda-smithy repository for occt.
BSD 3-Clause "New" or "Revised" License
4 stars 21 forks source link

problem with VTK (OCCT 7.4.0 hd267c4f_8) #56

Closed albator82 closed 3 years ago

albator82 commented 3 years ago

Issue:

I work on an C++ application using OCCT. I've updated OCCT to 7.4.0 (hd267c4f_8) with conda and rebuild the project with CMake. It seems there are no errors in the CMakeLists.txt but when I compile I got the error : "LINK : fatal error LNK1181: cannot open input file 'vtkCommonCore-9.0.lib" It is strange because I don't use vtk...

So I thought it was due to a vtk dependencies and I decided to change my OCCT build version to a version without vtk and finally install OCCT 7.4.0 h823b557_3 and everything works fine.

For me it seems the vtk dependency is the problem, is there a way to use the last build of OCCT (hd267c4f_8) or to fix the problem with a CMake command ?


Environment (conda list):

``` $ conda list # Name Version Build Channel alabaster 0.7.12 py_0 conda-proxy-forge astroid 2.4.2 py38h32f6830_1 conda-proxy-forge babel 2.8.0 py_0 conda-proxy-forge brotlipy 0.7.0 py38hab1e662_1001 conda-proxy-forge bzip2 1.0.8 he774522_3 conda-proxy-forge ca-certificates 2020.6.20 hecda079_0 conda-proxy-forge certifi 2020.6.20 py38h9bdc248_2 conda-proxy-forge cffi 1.14.3 py38h0e640b1_1 conda-proxy-forge chardet 3.0.4 py38h9bdc248_1008 conda-proxy-forge cmake 3.18.2 h001a745_0 conda-proxy-forge colorama 0.4.4 pyh9f0ad1d_0 conda-proxy-forge cryptography 3.2 py38h0e640b1_0 conda-proxy-forge curl 7.71.1 h4b64cdc_8 conda-proxy-forge cycler 0.10.0 py_2 conda-proxy-forge docutils 0.16 py38h9bdc248_2 conda-proxy-forge double-conversion 3.1.5 h6538335_2 conda-proxy-forge doxygen 1.8.20 0 conda-proxy-forge eigen 3.3.8 h74a9793_0 conda-proxy-forge expat 2.2.9 h33f27b4_2 conda-proxy-forge ffmpeg 4.3.1 ha925a31_0 conda-proxy-forge fontconfig 2.13.1 hdcb13c4_1002 conda-proxy-forge freeimage 3.18.0 h33f27b4_0 conda-proxy-forge freetype 2.10.4 hd328e21_0 conda-proxy-forge gl2ps 1.4.2 h2c487a6_0 conda-proxy-forge glew 2.1.0 he025d50_0 conda-proxy-forge gsl 2.6 h86b8168_0 conda-proxy-forge gtest 1.10.0 h7ef1ec2_4 conda-proxy-forge hdf4 4.2.13 hf8e6fe8_1003 conda-proxy-forge hdf5 1.10.6 nompi_h89124ea_1110 conda-proxy-forge icu 67.1 h33f27b4_0 conda-proxy-forge idna 2.10 pyh9f0ad1d_0 conda-proxy-forge imagesize 1.2.0 py_0 conda-proxy-forge intel-openmp 2020.2 254 isort 5.6.4 py_0 conda-proxy-forge jinja2 2.11.2 pyh9f0ad1d_0 conda-proxy-forge jpeg 9d he774522_0 conda-proxy-forge jsoncpp 1.8.4 h1ad3211_1002 conda-proxy-forge kiwisolver 1.2.0 py38h95a2b95_1 conda-proxy-forge krb5 1.17.1 hc04afaa_3 conda-proxy-forge lazy-object-proxy 1.4.3 py38h1e8a9f7_2 conda-proxy-forge libblas 3.8.0 20_mkl conda-proxy-forge libcblas 3.8.0 20_mkl conda-proxy-forge libclang 10.0.1 default_hf44288c_1 conda-proxy-forge libcurl 7.71.1 h4b64cdc_8 conda-proxy-forge libiconv 1.16 he774522_0 conda-proxy-forge liblapack 3.8.0 20_mkl conda-proxy-forge libnetcdf 4.7.4 nompi_h2ee746f_106 conda-proxy-forge libogg 1.3.2 hfa6e2cd_1002 conda-proxy-forge libpng 1.6.37 ha81a0f5_2 conda-proxy-forge libssh2 1.9.0 hb06d900_5 conda-proxy-forge libtheora 1.1.1 h62dcd97_1004 conda-proxy-forge libtiff 4.1.0 h885aae3_6 conda-proxy-forge libxml2 2.9.10 h1006b36_2 conda-proxy-forge loguru 0.5.3 py38h32f6830_2 conda-proxy-forge lz4-c 1.9.2 h62dcd97_2 conda-proxy-forge markupsafe 1.1.1 py38hab1e662_2 conda-proxy-forge matplotlib 3.2.2 1 conda-proxy-forge matplotlib-base 3.2.2 py38hbe5506b_1 conda-proxy-forge mccabe 0.6.1 py_1 conda-proxy-forge mkl 2020.2 256 nlohmann_json 3.9.1 h33f27b4_0 conda-proxy-forge numpy 1.19.2 py38hdf1ac2f_1 conda-proxy-forge occt 7.4.0 hd267c4f_8 conda-proxy-forge openssl 1.1.1h he774522_0 conda-proxy-forge packaging 20.4 pyh9f0ad1d_0 conda-proxy-forge pip 20.2.4 py_0 conda-proxy-forge proj 7.1.1 h7d85306_3 conda-proxy-forge pugixml 1.10 ha925a31_1 conda-proxy-forge pybind11 2.6.0 py38hd044231_0 conda-proxy-forge pybind11-global 2.6.0 pypi_0 pypi pycparser 2.20 pyh9f0ad1d_2 conda-proxy-forge pygments 2.7.2 py_0 conda-proxy-forge pylint 2.6.0 py38h32f6830_1 conda-proxy-forge pyopenssl 19.1.0 py_1 conda-proxy-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-proxy-forge pyqt 5.12.3 py38h7ae7562_4 conda-proxy-forge pyqt5-sip 4.19.18 pypi_0 pypi pyqtchart 5.12 pypi_0 pypi pyqtwebengine 5.12.1 pypi_0 pypi pysocks 1.7.1 py38h9bdc248_2 conda-proxy-forge python 3.8.6 h60c2a47_0_cpython conda-proxy-forge python-dateutil 2.8.1 py_0 conda-proxy-forge python_abi 3.8 1_cp38 conda-proxy-forge pytz 2020.1 pyh9f0ad1d_0 conda-proxy-forge qt 5.12.9 hb2cf2c5_0 conda-proxy-forge requests 2.24.0 pyh9f0ad1d_0 conda-proxy-forge setuptools 49.6.0 py38h9bdc248_2 conda-proxy-forge six 1.15.0 pyh9f0ad1d_0 conda-proxy-forge snowballstemmer 2.0.0 py_0 conda-proxy-forge sphinx 3.2.1 py_0 conda-proxy-forge sphinxcontrib-applehelp 1.0.2 py_0 conda-proxy-forge sphinxcontrib-devhelp 1.0.2 py_0 conda-proxy-forge sphinxcontrib-htmlhelp 1.0.3 py_0 conda-proxy-forge sphinxcontrib-jsmath 1.0.1 py_0 conda-proxy-forge sphinxcontrib-qthelp 1.0.3 py_0 conda-proxy-forge sphinxcontrib-serializinghtml 1.1.4 py_0 conda-proxy-forge sqlite 3.33.0 he774522_1 conda-proxy-forge tbb 2019.9 he980bc4_1 conda-proxy-forge tbb-devel 2019.9 he980bc4_1 conda-proxy-forge tk 8.6.10 he774522_1 conda-proxy-forge toml 0.10.1 pyh9f0ad1d_0 conda-proxy-forge tornado 6.0.4 py38h1e8a9f7_2 conda-proxy-forge urllib3 1.25.11 py_0 conda-proxy-forge utfcpp 3.1.2 0 conda-proxy-forge vc 14.1 h869be7e_1 conda-proxy-forge vs2015_runtime 14.16.27012 h30e32a0_2 conda-proxy-forge vs2017_win-64 19.16.27032.1 hb8d98e7_1 vswhere 2.7.1 h21ff451_0 vtk 9.0.1 no_osmesa_py38h9e4b14e_102 conda-proxy-forge wheel 0.35.1 pyh9f0ad1d_0 conda-proxy-forge win32_setctime 1.0.3 py_0 conda-proxy-forge win_inet_pton 1.1.0 py38h32f6830_1 conda-proxy-forge wincertstore 0.2 py38h32f6830_1005 conda-proxy-forge wrapt 1.11.2 py38h1e8a9f7_1 conda-proxy-forge xz 5.2.5 h62dcd97_1 conda-proxy-forge zlib 1.2.11 h62dcd97_1010 conda-proxy-forge zstd ```


Details about conda and system ( conda info ):

``` $ conda info ```
looooo commented 3 years ago

I guess some of the occt->vtk linking shouldn't be linked public. Is it possible for you to share a minimal example?

albator82 commented 3 years ago

I guess some of the occt->vtk linking shouldn't be linked public. Is it possible for you to share a minimal example?

Here is my CMakeLists

cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)

set(CMAKE_CXX_STANDARD 14)

#GTest

find_package(GTest REQUIRED)

message(STATUS " GTests library " ${GTEST_BOTH_LIBRARIES})
message(STATUS " GTests libraries " ${GTEST_LIBRARIES})
message(STATUS " GTests include " ${GTEST_INCLUDE_DIRS})

#nlohmann_json

find_package(nlohmann_json REQUIRED)

#OpenCASCADE

find_package(OpenCASCADE REQUIRED)

message(STATUS " OpenCASCADE library " ${OpenCASCADE_LIBRARIES})
message(STATUS " OpenCASCADE include dir " ${OpenCASCADE_INCLUDE_DIR})
message(STATUS "OpenCascade library dir " ${OpenCASCADE_LIBRARY_DIR})

#gsl

find_package(GSL REQUIRED)
message(STATUS "GSL ROOT DIR: " ${GSL_ROOT_DIR})
message(STATUS "gsl include dirs: " ${GSL_INCLUDE_DIRS})
message(STATUS "gsl lib dirs: " ${GSL_LIBRARIES})

#pybind11

find_package(pybind11 CONFIG REQUIRED)

message(STATUS "pybind11 include dirs: " ${pybind11_INCLUDE_DIRS})
message(STATUS "pybind11 lib dir: " ${pybind11_LIBRARIES})

###################################################
add_subdirectory(src)

I never call VTK because I don't need it.

adam-urbanczyk commented 3 years ago

As a workaround try not linking against TKIVtk. Your cmake file does not tell much due to the add_subdriectory call but I assume that you link against all OpenCASCADE_LIBRARIES.

It seems that the fix-private-linking.patch is not applied properly @looooo .

albator82 commented 3 years ago

@adam-urbanczyk you're right I link directly against OpenCASCADE_LIBRARIES (target_link_libraries(Airfoil PUBLIC Utils ${OpenCASCADE_LIBRARIES})). I'm quite new to CMake. So how do you do to not link against TKIVtk ? Could you tell me please the right command ?

albator82 commented 3 years ago

To inform anyone who could be interested, I have found a solution to my problem by adding the following commands to the CMakeLists.txt :

find_package(VTK COMPONENTS CommonCore REQUIRED)

#Freetype
find_package(Freetype REQUIRED)

#GLEW
find_package(GLEW REQUIRED)