AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb

[BUILD] Can't statically link TBB libraries

Open
#1,362 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.4k
Forks
774
Avg merge
3d 9h
Merged PRs (30d)
34

Description

### Environment
**Operating System:** Windows Pro 10
**Version / Commit SHA:** (e.g VDB 7.2, SHA: 1a2b3c4d5e...)
**CMake Version:** 3.8
**Compiler:** msvc 2019

### Describe the problem
I cannot include openvdb as a library in an application.
Here's the cmake:
```
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.8)

project ("OpenVDBTest")

list(APPEND CMAKE_MODULE_PATH "C:\\Program Files\\OpenVDB\\lib\\cmake\\OpenVDB")
set(OpenVDB_INCLUDE_DIR "C:\\Program Files\\OpenVDB\\include")
#set(TBB_ROOT "C:\\Program Files (x86)\\TBB")
set(BOOST_INCLUDEDIR "\\vcpkg\\installed\\x64-windows\\include")
set(BOOST_LIBRARYDIR "\\vcpkg\\installed\\x64-windows\\lib")
set(TBB_INCLUDEDIR "\\vcpkg\\installed\\x64-windows\\include")
set(TBB_LIBRARYDIR "\\vcpkg\\installed\\x64-windows\\lib")
set(Boost_USE_STATIC_LIB=OFF)
set(CMAKE_BUILD_TYPE Release)

find_package(OpenVDB REQUIRED)

add_executable (OpenVDBTest OpenVDBTest/OpenVDBTest.cpp)

target_link_libraries(OpenVDBTest OpenVDB::openvdb)

```

Here's the error:
```
Severity Code Description Project File Line Suppression State
Error LNK1104 cannot open file 'tbb12.lib' C:\Users\lduran\source\repos\OpenVDBTest\out\build\x64-Debug\OpenVDBTest C:\Users\lduran\source\repos\OpenVDBTest\out\build\x64-Debug\OpenVDBTest\LINK 1
```

I used vcpkg to install the TBB and Boost libraries, but they weren't found without the options in there.

### To Reproduce
Steps to reproduce the behavior:
1. Checkout [repo](https://dev.azure.com/lucaduran/_git/OpenVDB%20Windows%20Interface)
2. Run CMake within Visual Studio
3. Build with with Visual Studio
4. See error

Contributor guide

Open the contributing guide

Research direction

Start with the top-level CMakeLists.txt and the OpenVDB::openvdb target, then reproduce the Visual Studio build from the linked repository using the reported CMake, MSVC, vcpkg, Boost, and TBB settings. Check how the OpenVDB package exposes its TBB library dependency; done means the OpenVDBTest executable configures and links without the missing tbb12.lib error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.