Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking issue on Windows when building examples with clang-cl #93

Open
clement-troesch opened this issue Mar 18, 2024 · 2 comments
Open

Comments

@clement-troesch
Copy link
Contributor

clement-troesch commented Mar 18, 2024

Hi there,

I'm currently trying to build a small test app with Odil on Windows 10 using clang-cl (VS 2022) but I get linking issue due to unresolved external symbols.

The issue also appears when building the examples, this is how I configure Odil with the examples:

cmake `
 -DWITH_DCMTK=OFF `
 -DBUILD_TESTING=OFF `
 -DBUILD_PYTHON_WRAPPERS=OFF `
 -DBUILD_JAVASCRIPT_WRAPPERS=OFF `
 -DBUILD_EXAMPLES=ON `
 -DICU_ROOT="<path_to_icu>"" `
 -DICU_UC_LIBRARY_RELEASE="<path_to_icu>"\lib\icuuc.lib" `
 -DJsonCpp_LIBRARY="<path_to_jsoncpp>\lib\jsoncpp.lib" `
 -DJsonCpp_INCLUDE_DIR="<path_to_jsoncpp>\include" `
 -DCMAKE_INSTALL_PREFIX="../install" `
 -DCMAKE_CXX_COMPILER="clang-cl.exe" `
 -DCMAKE_C_COMPILER="clang-cl.exe" `
 -DCMAKE_RC_COMPILER="llvm-rc.exe" `
 -DCMAKE_LINKER="link.exe" `
 -DCMAKE_C_FLAGS="-m64" `
 -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -m64 /EHa" `
 ../odil -G "NMake Makefiles JOM"

(Note: Boost, ICU and JsonCpp have all been built with clang-cl as well)

Here are the linking issues displayed in the compilation log:

When listing the symbols of the library using DUMPBIN /EXPORTS odil.lib it looks like the symbols are not available:

Do you have any idea on what I might be doing wrong?

Thanks a lot,

Clément

@clement-troesch
Copy link
Contributor Author

Ok so I have continued my tests and it seems to work with cl. The issue seems to come from the compilation with clang-cl. I am not quite sure what could be the issue here...

@clement-troesch
Copy link
Contributor Author

I managed to export the expected symbols using the -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE cmake parameter. I guess clang-cl does not export all symbols using the ODIL_API macro. I'm not sure why as some of the symbols are still exported as expected...

I'm leaving the issue open as I would expect the ODIL_API macro to be sufficient.
If you are not planning to support clang-cl feel free to close the issue :)

Thanks,
Clément

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant