conda-forge / boost-cpp-feedstock

A conda-smithy repository for boost-cpp.
BSD 3-Clause "New" or "Revised" License
6 stars 39 forks source link

Symbols' exposure in Windows' shared library as distributed by boost-cpp #142

Closed jjerphan closed 1 year ago

jjerphan commented 1 year ago

Comment:

Hello,

First, thank you for maintaining this feedstock and distributing this major dependency! :handshake:

I am proposing updating folly's feedstock to package a shared library for Windows with https://github.com/conda-forge/folly-feedstock/pull/115.

I am currently meeting this error when folly's DLL is being linked against boost (backed here by boost-cpp):

[300/307] Linking CXX shared library folly.dll
FAILED: folly.dll folly.lib 
cmd.exe /C "cmd.exe /C "%BUILD_PREFIX%\Library\bin\cmake.exe -E __create_def %SRC_DIR%\CMakeFiles\folly.dir\.\exports.def %SRC_DIR%\CMakeFiles\folly.dir\.\exports.def.objs && cd %SRC_DIR%" && %BUILD_PREFIX%\Library\bin\cmake.exe -E vs_link_dll --intdir=CMakeFiles\folly.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\folly.rsp  /out:folly.dll /implib:folly.lib /pdb:folly.pdb /dll /version:0.58 /machine:x64 /debug /INCREMENTAL  /DEF:CMakeFiles\folly.dir\.\exports.def  && cd ."
LINK Pass 1: command "C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1429~1.301\bin\HostX64\x64\link.exe /nologo @CMakeFiles\folly.rsp /out:folly.dll /implib:folly.lib /pdb:folly.pdb /dll /version:0.58 /machine:x64 /debug /INCREMENTAL /DEF:CMakeFiles\folly.dir\.\exports.def /MANIFEST /MANIFESTFILE:CMakeFiles\folly.dir/intermediate.manifest CMakeFiles\folly.dir/manifest.res" failed (exit code 1120) with the following output:
   Creating library folly.lib and object folly.exp
NestedCommandLineApp.cpp.obj : error LNK2001: unresolved external symbol "public: static unsigned int const boost::program_options::options_description::m_default_line_length" (?m_default_line_length@options_description@program_options@boost@@2IB)

ProgramOptions.cpp.obj : error LNK2001: unresolved external symbol "public: static unsigned int const boost::program_options::options_description::m_default_line_length" (?m_default_line_length@options_description@program_options@boost@@2IB)

I guess those symbol need to be exposed (since they are qualified as public).

What do you think? Must these symbols be exposed? If so, are there some options to set for the bootstrapping scripts or some patches to apply to boost on this feedstock?

Thank you for your help!

isuruf commented 1 year ago

This is not an issue with boost-cpp. You need to tell boost that your application is being linked to a boost DLL. See docs on __declspec(dllimport)