AcademySoftwareFoundation / AcademySoftwareFoundation/Imath

Linker error on building Imath python with Boost Python

Open
#271 5 comments 0 reactions 0 assignees View on GitHub
bug build windows
Dominant language
C++
Stars
488
Forks
161
Avg merge
1d 3h
Merged PRs (30d)
3

Description

Hello I'm trying to build python bindings of Imath with Boost.Python. My OS is Windows 10.
I built the Boost 1.81 like this
```batch
call bootstrap.bat vc143

b2 install -j4 variant=release toolset=msvc ^
--with-python ^
--prefix=dist\boost_config_release ^
--address-model=64 ^
-d0
```

The above commands get me include/lib folders which have Boost headers and libraries. For example I get this
`libboost_python310-vc143-mt-x64-1_81.lib`, `libboost_numpy310-vc143-mt-x64-1_81.lib`.

And then, I build Imath python with cmake commands.
```cmake
cmake ^
-S dependency\Imath ^
-B dependency\Imath\build ^
-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF ^
-DCMAKE_INSTALL_PREFIX="dependency\Imath\build\Imath_config_release" ^
-DCMAKE_BUILD_TYPE=Release ^
-DPYTHON=ON ^
-DBoost_ROOT="%cd%\dependency\boost\dist\boost_config_release\lib\cmake\Boost-1.81.0" ^
-DBoost_NO_BOOST_CMAKE=OFF

cmake --build dependency\Imath\build ^
--target install ^
--config Release
```

However, I get a lot of boost linker errors from PyImath_Python3_10 project. If I give you one error:
```
PyImathVec4fd.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) prote
cted: __cdecl boost::python::detail::dict_base::dict_base(struct boost::python::detail::bo
rrowed_reference_t *)" (__imp_??0dict_base@detail@python@boost@@IEAA@PEAUborrowed_referenc
e_t@123@@Z) [D:\VisualStudioProject\Project\dependency\Imath\build\src\python\PyIma
th\PyImath_Python3_10.vcxproj]
```

I don't know what this log is, but I also get this one
```
Hint on symbols that are defined and could potentially match:
"__declspec(dllimport) protected: __cdecl boost::python::detail::tuple_base::tuple_b
ase(class boost::python::api::object const &)" (__imp_??0tuple_base@detail@python@boost@
@IEAA@AEBVobject@api@23@@Z)
"__declspec(dllimport) protected: __cdecl boost::python::detail::tuple_base::tuple_b
ase(void)" (__imp_??0tuple_base@detail@python@boost@@IEAA@XZ)
```

Can I get any helps for solving this problem? it's very hard for me to figure out what's going on.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Windows 10 build with the provided Boost 1.81 and CMake commands, then inspect the PyImath_Python3_10 linker output. Compare the configured Boost Python libraries with the unresolved symbols; done means the Imath Python target builds and installs without these linker errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.