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

[magnum-plugins] cmake configure failure #17520

Closed
sbrkopac opened this issue Apr 26, 2021 · 10 comments
Closed

[magnum-plugins] cmake configure failure #17520

sbrkopac opened this issue Apr 26, 2021 · 10 comments
Assignees
Labels
category:question This issue is a question

Comments

@sbrkopac
Copy link

sbrkopac commented Apr 26, 2021

Host Environment

  • OS: Windows 10
  • Compiler: Visual Studio 2019 Community - Version 16.9.4

To Reproduce
Steps to reproduce the behavior:
./vcpkg install --head magnum-plugins[pngimporter]:x64-windows

Failure logs

PS C:\Programming\projects\personal\vcpkg-issue\build> cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\Programming\vcpkg\scripts\buildsystems\vcpkg.cmake
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- Found Corrade: C:/Programming/vcpkg/installed/x64-windows/include
-- Found Corrade: C:/Programming/vcpkg/installed/x64-windows/include  found components: Containers rc Utility
-- Found Magnum: C:/Programming/vcpkg/installed/x64-windows/include  found components: GL Sdl2Application
-- Found Corrade: C:/Programming/vcpkg/installed/x64-windows/include  found components: Containers rc Utility PluginManager
-- Found Magnum: C:/Programming/vcpkg/installed/x64-windows/include  found components: Trade
-- Found ZLIB: optimized;C:/Programming/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/Programming/vcpkg/installed/x64-windows/debug/lib/zlibd.lib (found version "1.2.11")
-- Found PNG: optimized;C:/Programming/vcpkg/installed/x64-windows/lib/libpng16.lib;debug;C:/Programming/vcpkg/installed/x64-windows/debug/lib/libpng16d.lib (found version "1.6.37")
CMake Error at C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MagnumPlugins (missing: PngImporter)

      Reason given by package: PngImporter is not built by default. Make sure you enabled WITH_PNGIMPORTER when building Magnum Plugins.

Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Programming/vcpkg/installed/x64-windows/share/cmake/MagnumPlugins/FindMagnumPlugins.cmake:523 (find_package_handle_standard_args)
  C:/Programming/vcpkg/installed/x64-windows/share/cmake/MagnumPlugins/MagnumPluginsConfig.cmake:26 (include)
  C:/Programming/vcpkg/scripts/buildsystems/vcpkg.cmake:861 (_find_package)
  CMakeLists.txt:7 (find_package)


-- Configuring incomplete, errors occurred!

Additional context
CMakeLists.txt

@NancyLi1013 NancyLi1013 added the category:question This issue is a question label Apr 27, 2021
@NancyLi1013
Copy link
Contributor

Hi @sbrkopac

Thanks for posting this issue.

There are several questions that need to make it clear:

  • I noticed you used --head to build the port, I'm not sure how you build it successfully with this option.

    Since I failed to build it on my local with --head.

  • You used find_package(MagnumPlugins REQUIRED PngImporter) in your CMakeLists.txt. The usage seems not correct.

    I checked there are no usage for magnum-plugins in vcpkg. Where do you get the usage info?

@sbrkopac
Copy link
Author

sbrkopac commented Apr 27, 2021

Hi @NancyLi1013

You might need corrade and magnum as head installs as well:

.\vcpkg install --head corrade[*]:x64-windows
.\vcpkg install --head magnum[*]:x64-windows

I followed the documentation outlined in two places:

Building Plugins
Loading and using plugins

@NancyLi1013
Copy link
Contributor

Thanks for your information. I will try this again later.

@NancyLi1013 NancyLi1013 added category:port-bug The issue is with a library, which is something the port should already support and removed category:question This issue is a question labels May 21, 2021
@NancyLi1013
Copy link
Contributor

Sorry for the long delay. Confirmed this is a bug, I will look into it and try to fix this soon.

@NancyLi1013
Copy link
Contributor

This is due to PngImporter.lib is removed from /lib/magnum/importers and debug/lib/magnum-d/importers. We can see the related codes here:

https://github.com/microsoft/vcpkg/blob/master/ports/magnum-plugins/portfile.cmake

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
    # On windows, plugins are "Modules" that cannot be linked as shared
    # libraries, but are meant to be loaded at runtime.
    # While this is handled adequately through the CMake project, the auto-magic
    # linking with visual studio might try to link the import libs anyway.
    #
    # We delete the import libraries here to avoid the auto-magic linking
    # for plugins which are loaded at runtime.
    if(WIN32)
        file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/magnum)
        file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/magnum-d)
    endif()

@Squareys can you help take a look?

Thanks.

@Squareys
Copy link
Contributor

Squareys commented Aug 7, 2021

@NancyLi1013 Hey, sorry, somehow I missed the @ there.

The plugins are not meant to be used statically through vcpkg. Instead the .dll files are copied during the DLL dependency search after CMake configure with the magnum_deploy.ps script. (This means rather than going through linking and find_package, you load the plugin at runtime).

Head builds should be fine, but I'm currently experiencing some issues here aswell (a patch on the magnum port is not applying, but the affected code hasn't changed for 6+ months). Currently looking into that.

@Squareys
Copy link
Contributor

Squareys commented Aug 7, 2021

I fixed the build of magnum/magnum-plugins in #19435

@PhoebeHui PhoebeHui assigned LilyWangLL and unassigned NancyLi1013 Nov 22, 2021
@LilyWangLL LilyWangLL added category:question This issue is a question and removed category:port-bug The issue is with a library, which is something the port should already support labels Dec 31, 2021
@LilyWangLL
Copy link
Contributor

LilyWangLL commented Dec 31, 2021

Thanks for Squareys' reply and fix. @sbrkopac According to the comment in magnum-plugins's portfile.cmake and Squareys' reply, plugins are "Modules" that cannot be linked as libraries, but are meant to be [loaded at runtime]. (https://doc.magnum.graphics/magnum/plugins.html#plugins-loading).

    # On windows, plugins are "Modules" that cannot be linked as shared
    # libraries, but are meant to be loaded at runtime.
    # While this is handled adequately through the CMake project, the auto-magic
    # linking with visual studio might try to link the import libs anyway.
    #
    # We delete the import libraries here to avoid the auto-magic linking
    # for plugins which are loaded at runtime.

The plugins are not meant to be used statically through vcpkg. Instead the .dll files are copied during the DLL dependency search after CMake configure with the magnum_deploy.ps script. (This means rather than going through linking and find_package, you load the plugin at runtime).

You can also see discussion of magnum-plugins in #2687

@LilyWangLL
Copy link
Contributor

@Squareys Does this issue resolved?

@LilyWangLL
Copy link
Contributor

Thanks for posting this issue. Please reopen this issue if this is still a problem for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

4 participants