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

sdl2[core]:x64-linux build failure #13187

Closed
BrianPeek opened this issue Aug 27, 2020 · 6 comments
Closed

sdl2[core]:x64-linux build failure #13187

BrianPeek opened this issue Aug 27, 2020 · 6 comments
Assignees
Labels
requires:repro The issue is not currently repro-able

Comments

@BrianPeek
Copy link
Contributor

BrianPeek commented Aug 27, 2020

Host Environment

  • OS: Linux (WSL) Ubuntu [2.0.04.1 LTS] (seems to install and work just fine on Windows and OS X)
  • Compiler: N/A (doesn't get that far)

To Reproduce
Steps to reproduce the behavior:
./vcpkg install sdl2

Failure logs

Computing installation plan...
The following packages will be built and installed:
    sdl2[core]:x64-linux
Detecting compiler hash for triplet x64-linux...
Starting package 1/1: sdl2:x64-linux
Building package sdl2[core]:x64-linux...
Could not locate cached archive: /home/brian/.cache/vcpkg/archives/5f/5fc3a434f92da0414edb660695528208c02bc507.zip
-- Using cached /home/brian/vcpkg/downloads/SDL2-2.0.12.tar.gz
-- Cleaning sources at /home/brian/vcpkg/buildtrees/sdl2/src/SDL2-2-ac07e8117e.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/brian/vcpkg/downloads/SDL2-2.0.12.tar.gz
-- Applying patch export-symbols-only-in-shared-build.patch
-- Applying patch enable-winrt-cmake.patch
-- Applying patch disable-hidapi-for-uwp.patch
-- Applying patch fix-space-in-path.patch
-- Applying patch disable-wcslcpy-and-wcslcat-for-windows.patch
-- Applying patch fix-EventToken-header-reference.patch
-- Applying patch 0006-sdl2-Enable-creation-of-pkg-cfg-file-on-windows.patch
-- Using source at /home/brian/vcpkg/buildtrees/sdl2/src/SDL2-2-ac07e8117e.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Fixing pkgconfig file: /home/brian/vcpkg/packages/sdl2_x64-linux/lib/pkgconfig/sdl2.pc
-- CHECK_LIB_glib-2.0_RELEASE:CHECK_LIB_glib-2.0_RELEASE-NOTFOUND
CMake Error at scripts/cmake/vcpkg_fixup_pkgconfig.cmake:232 (message):
  Library "glib-2.0" was not found! If it is a system library use the
  SYSTEM_LIBRARIES parameter for the vcpkg_fixup_pkgconfig call! Otherwise,
  correct the *.pc file
Call Stack (most recent call first):
  scripts/cmake/vcpkg_fixup_pkgconfig.cmake:298 (vcpkg_fixup_pkgconfig_check_files)
  ports/sdl2/portfile.cmake:97 (vcpkg_fixup_pkgconfig)
  scripts/ports.cmake:79 (include)


Error: Building package sdl2:x64-linux failed with: BUILD_FAILED
Please ensure you're using the latest portfiles with `./vcpkg update`, then
submit an issue at https://github.com/Microsoft/vcpkg/issues including:
  Package: sdl2:x64-linux
  Vcpkg version: 2020.06.15-unknownhash

Additional context
This started happening after updating vcpkg from git. If I manually install "glib" via vcpkg, I then get an error on not finding ibus-1.0. This isn't available in vcpkg. I have installed via apt-get, but the error persists.

@BrianPeek BrianPeek changed the title [<port name>] build failure sdl2 build failure Aug 27, 2020
@BrianPeek BrianPeek changed the title sdl2 build failure sdl2[core]:x64-linux build failure Aug 27, 2020
@NancyLi1013 NancyLi1013 self-assigned this Aug 28, 2020
@NancyLi1013
Copy link
Contributor

Hi @BrianPeek
Thanks for posting this issue.
I try to reproduce this on my local with WSL Ubuntu 18.04 and I can build successfully.

vruil@ruiltest01:~/vcpkg$ ./vcpkg install sdl2
Your feedback is important to improve Vcpkg! Please take 3 minutes to complete our survey by running: vcpkg contact --survey
Computing installation plan...
The following packages will be built and installed:
    sdl2[core]:x64-linux
Detecting compiler hash for triplet x64-linux...
Starting package 1/1: sdl2:x64-linux
Building package sdl2[core]:x64-linux...
Could not locate cached archive: /home/vruil/.cache/vcpkg/archives/35/356fd5b229f62e68a182a0aefbbe1a6562133566.zip
-- Using cached /home/vruil/vcpkg/downloads/SDL2-2.0.12.tar.gz
-- Cleaning sources at /home/vruil/vcpkg/buildtrees/sdl2/src/SDL2-2-ac07e8117e.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source /home/vruil/vcpkg/downloads/SDL2-2.0.12.tar.gz
-- Applying patch export-symbols-only-in-shared-build.patch
-- Applying patch enable-winrt-cmake.patch
-- Applying patch disable-hidapi-for-uwp.patch
-- Applying patch fix-space-in-path.patch
-- Applying patch disable-wcslcpy-and-wcslcat-for-windows.patch
-- Applying patch fix-EventToken-header-reference.patch
-- Applying patch 0006-sdl2-Enable-creation-of-pkg-cfg-file-on-windows.patch
-- Using source at /home/vruil/vcpkg/buildtrees/sdl2/src/SDL2-2-ac07e8117e.clean
-- Configuring x64-linux-dbg
-- Configuring x64-linux-rel
-- Building x64-linux-dbg
-- Building x64-linux-rel
-- Fixing pkgconfig file: /home/vruil/vcpkg/packages/sdl2_x64-linux/lib/pkgconfig/sdl2.pc
-- Fixing pkgconfig file: /home/vruil/vcpkg/packages/sdl2_x64-linux/debug/lib/pkgconfig/sdl2.pc
-- Performing post-build validation
-- Performing post-build validation done
sh: 1: zip: not found
Failed to store binary cache /home/vruil/.cache/vcpkg/archives/35/356fd5b229f62e68a182a0aefbbe1a6562133566.zip: No such file or directory
Building package sdl2[core]:x64-linux... done
Installing package sdl2[core]:x64-linux...
Installing package sdl2[core]:x64-linux... done
Elapsed time for package sdl2:x64-linux: 4.87 min

Total elapsed time: 4.988 min

The package sdl2:x64-linux provides CMake targets:

    find_package(SDL2 CONFIG REQUIRED)
    target_link_libraries(main PRIVATE SDL2::SDL2main SDL2::SDL2-static)

@NancyLi1013 NancyLi1013 added the requires:repro The issue is not currently repro-able label Aug 28, 2020
@NancyLi1013
Copy link
Contributor

I also checked sdl2.pc, there is no glib in this file. So I don't know why this posts glib-2.0 not found.

@BrianPeek
Copy link
Contributor Author

BrianPeek commented Aug 28, 2020

I just blew away my vcpkg directory and re-cloned from github, bootstrapped, and tried again fresh. Still getting the same error. :( That said, my sdl2.pc file is showing glib (and ibus, my 2nd error):

# sdl pkg-config source file

prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: 2.0.12
Requires:
Conflicts:
Libs: -L${libdir} -Wl,-rpath,${libdir} -Wl,--enable-new-dtags -pthread -lSDL2
Libs.private: -lglib-2.0 -lgobject-2.0 -lgio-2.0 -libus-1.0 -ldbus-1 -l/usr/lib/x86_64-linux-gnu/libsndio.so -ldl -lm  -Wl,--no-undefined -pthread -lSDL2
Cflags: -I${includedir}/SDL2  -D_REENTRANT

@BrianPeek
Copy link
Contributor Author

BrianPeek commented Aug 28, 2020

Upon further research, it appears the recent addition of this to sdl2\portfile.cmake has broken the build for me:

set(DYLIB_COMPATIBILITY_VERSION_REGEX "set\\(DYLIB_COMPATIBILITY_VERSION (.+)\\)")
set(DYLIB_CURRENT_VERSION_REGEX "set\\(DYLIB_CURRENT_VERSION (.+)\\)")
file(STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_COMPATIBILITY_VERSION REGEX ${DYLIB_COMPATIBILITY_VERSION_REGEX})
file(STRINGS "${SOURCE_PATH}/CMakeLists.txt" DYLIB_CURRENT_VERSION REGEX ${DYLIB_CURRENT_VERSION_REGEX})
string(REGEX REPLACE ${DYLIB_COMPATIBILITY_VERSION_REGEX} "\\1" DYLIB_COMPATIBILITY_VERSION "${DYLIB_COMPATIBILITY_VERSION}")
string(REGEX REPLACE ${DYLIB_CURRENT_VERSION_REGEX} "\\1" DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION}")

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/sdl2.pc" "-lSDL2" "-lSDL2d")

vcpkg_fixup_pkgconfig(IGNORE_FLAGS "-Wl,-rpath,${CURRENT_PACKAGES_DIR}/lib/pkgconfig/../../lib" "-Wl,-rpath,${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/../../lib" "-Wl,--enable-new-dtags" "-Wl,--no-undefined" "-Wl,-undefined,error" "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}" "-Wl,-current_version,${DYLIB_CURRENT_VERSION}" "-Wl,-weak_framework,Metal" "-Wl,-weak_framework,QuartzCore")

Commenting out this addition allows sdl2 to build/install correctly. @Sibras, it appears you made this update, any idea why this might break for me?

Thanks for any insight!

@Sibras
Copy link
Contributor

Sibras commented Aug 29, 2020

SDLs cmake script is automatically detecting additional non vcpkg libraries that you have optionally installed in your wsl instance and is linking against them. Based on your pkgconfig file these appear to be 'dbus ibus libsndio'. Since these libs are not installed by default others are not able to reproduce it and vcpkg_fixup_pkgconfig has not been made aware of them.

Looking at the cmake script for sdl it doesnt appear there is an option to disable the automatic detection and inclusion of dbus/ibus. Short term just uninstalling these will stop sdl from detecting them. Otherwise they will need to be added to the known system lib list in scripts/cmake/vcpkg_common_definitions.cmake.

The sndio issue should be fixable though (although I havnt tested it) by updating the sdl portfile to

vcpkg_configure_cmake(
    SOURCE_PATH ${SOURCE_PATH}
    PREFER_NINJA
    OPTIONS ${FEATURE_OPTIONS}
        -DSDL_STATIC=${SDL_STATIC}
        -DSDL_SHARED=${SDL_SHARED}
        -DFORCE_STATIC_VCRT=${FORCE_STATIC_VCRT}
        -DLIBC=ON
        -DSNDIO_SHARED=ON
)

Try those and see of they work

@BrianPeek
Copy link
Contributor Author

Got it. Uninstalling libs for dbus, ibus, and libsndio fixed everything. That said, I'm not entirely sure how they got there. I truly appreciate the help and explanation of the issue, I learned something new.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able
Projects
None yet
Development

No branches or pull requests

3 participants