2

I am trying to build OpenMVS with Visual Studio 2017. I have installed boost 1.74, which is found as well. But when I try to build, I get the following error:

Error   LNK2001 unresolved external symbol "unsigned int const boost::iostreams::zstd::best_speed" (?best_speed@zstd@iostreams@boost@@3IB)  RefineMesh  [...]

I downloaded a precompiled boost binary here. A dumpbin tells me that the file libboost_iostreams-vc141-mt-x64-1_74.lib does not export the symbols VS searches. But I cannot find any instructions to build boost with zstd enabled. The zlib namespace is available.

When building boost with b2 I tried this in my project-config.jam:

using zstd ;

but it seems this does not make any difference. Can someone help me how to build boost with zstd?

brandbenni
  • 23
  • 4
  • zlib would be in a different library. I would guess its not in the binaries you downloaded. You may want to use vcpkg to build boost using your compiler. Edit: boost-iostreams in vcpkg seems to have enabled zlib by default: [https://github.com/microsoft/vcpkg/blob/master/ports/boost-iostreams/vcpkg.json](https://github.com/microsoft/vcpkg/blob/master/ports/boost-iostreams/vcpkg.json) – drescherjm Apr 19 '22 at 17:24
  • My `project-config.jam` has the line `using zlib : 1.2.8 : C:/dev/zlib/zlib-1.2.8 ;` which should enable zlib. The zlib targets are available in the lib file, just no zstd – brandbenni Apr 19 '22 at 17:25
  • @drescherjm I could not get boost to work with vcpkg unfortunately, as the vcpkg.cmake toolchain file did not work – brandbenni Apr 19 '22 at 17:27
  • I have had problems with other lesser used ports (especially ones in my field of medical imaging) when using vcpkg however boost has worked every time I have tried it. You may want to open a different question that focuses on your problem using boost from vcpkg. – drescherjm Apr 19 '22 at 17:28
  • The problem was that when supplying the toolchain file with `-DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake`, cmake defaulted to my local installation of boost and not the vcpkg one. But maybe I can link all of the libraries manually in VS. – brandbenni Apr 19 '22 at 17:30
  • You could rename the folder of your local boost to get it out of the way. – drescherjm Apr 19 '22 at 17:31
  • I tried that, then cmake does not find a boost installation at all. In fact, none of the vcpkg installations are found. I supplied every dependency in the cmake file manually – brandbenni Apr 19 '22 at 17:39
  • Are you sure that you set the `%VCPKG_ROOT%` environment variable in your OS or in the console you are running CMake from? – drescherjm Apr 19 '22 at 17:42
  • Yes, I even tried with absolute paths. Still not working – brandbenni Apr 19 '22 at 17:43
  • I still recommend you ask a new question about this showing output and a [mcve] and someone could possibly help with your vcpkg configuration problem. Perhaps you are mixing 32 and 64 bit?? – drescherjm Apr 19 '22 at 17:44
  • Wow, I think that was the solution! The default install was 32 bit, but I needed the 64 bit libraries. I hope this solves my problem, thank you! – brandbenni Apr 19 '22 at 18:01
  • I was thinking about that a minute or so ago. vcpkg defaults to build 32 bit binaries. People have complained about the default but so far no change to the default has been made. You can set the default triplet to x64 by setting this environment variable: `VCPKG_DEFAULT_TRIPLET=x64-windows` – drescherjm Apr 19 '22 at 18:05
  • Does this answer your question? [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Lala5th Apr 19 '22 at 18:17
  • Unfortunately not, as I already know that the boost libraries need to be compiled with zstd and zlib enabled. The real question was how to enable these options when building boost. But after the recomenndations by @drescherjm, I use vcpkg instead – brandbenni Apr 19 '22 at 18:18

0 Answers0