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

Import library not installed on mingw64 #348

Closed
kmilos opened this issue Sep 1, 2021 · 6 comments · Fixed by #354
Closed

Import library not installed on mingw64 #348

kmilos opened this issue Sep 1, 2021 · 6 comments · Fixed by #354

Comments

@kmilos
Copy link
Contributor

kmilos commented Sep 1, 2021

Describe the bug
libblosc2.dll.a import library is missing after install so any dynamic linking against -lblosc2 fails (unresolved symbols).

It is indeed built, just not installed.

This is despite the expected ARCHIVE component in CMakeLists.txt.

To Reproduce

mkdir build && cd build
cmake \
  -GNinja \
  -DCMAKE_INSTALL_PREFIX=/opt/blosc2-test \
  -DPREFER_EXTERNAL_LZ4=ON \
  -DPREFER_EXTERNAL_ZLIB=ON \
  -DPREFER_EXTERNAL_ZSTD=ON \
  ../

cmake --build .

cmake --install .

Expected behavior
libblosc2.dll.a should be present in ${CMAKE_INSTALL_LIBDIR}

System information:

  • OS: mingw64
  • Compiler gcc
  • Version 2.0.3
@havardAasen
Copy link
Contributor

I wonder if those variables should be encapsulated with double quotes, like so "${CMAKE_INSTALL_LIBDIR}"
Do you want to test this? I believe it works, but my test setup for mingw64 is rather hacky. I can draft a PR if you prefer.

For the test, lines 292 and 293 in blosc/CMakeLists.txt will suffice.

@kmilos
Copy link
Contributor Author

kmilos commented Sep 5, 2021

Don't thinks so, it works as is for the RUNTIME and LIBRARY artifacts, just not for the ARCHIVE for some reason.

@kmilos
Copy link
Contributor Author

kmilos commented Sep 6, 2021

Ah, might have to w/ stripping - a stripped and empty import library seems to be skipped by CPack?

Might be an idea to have the whole CPack section optional and possibly leave the details to various other packaging and distribution schemes.

@kmilos
Copy link
Contributor Author

kmilos commented Sep 7, 2021

Not it either...

It actually seems to be related to the COMPONENT option. If I remove those from lines 294 and 300 in blosc/CMakeLists.txt then it works out. Incidentally you can also remove all the DESTINATION options as well since GNUInstallDirs is used (should probably include it before add_subdirectory(blosc), not as late as line 412 in top level CMakeLists.txt; also, line 413 can be safely removed).

For regular executables, static libraries and shared libraries, the DESTINATION argument is not required. For these target types, when DESTINATION is omitted, a default destination will be taken from the appropriate variable from GNUInstallDirs, or set to a built-in default value if that variable is not defined.

This also worked for me for line 290 etc.:

    if(BUILD_SHARED)
        install(TARGETS blosc2_shared
                LIBRARY COMPONENT LIB
                ARCHIVE COMPONENT DEV
                RUNTIME COMPONENT LIB)
    endif()
    if(BUILD_STATIC)
        install(TARGETS blosc2_static COMPONENT DEV)
    endif()

@kmilos
Copy link
Contributor Author

kmilos commented Sep 7, 2021

Also, if you prefer not to remove DESTINATION, RUNTIME DESTINATION bin should also become RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}.

@kmilos
Copy link
Contributor Author

kmilos commented Sep 7, 2021

Similarly, DESTINATION include should also be replaced w/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} everywhere (and same w/ include/blosc2 -> ${CMAKE_INSTALL_INCLUDEDIR}/blosc2)

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

Successfully merging a pull request may close this issue.

2 participants