Source: mojoshader Version: 0.0~hg1314+dfsg-1 Severity: important Tags: ftbfs bullseye sid patch
I tried building mojoshader in a non-minimal environment to check whether it was broken by the new version of spirv-tools. In particular, I have libsdl2-dev installed. My build failed with this error: [ 80%] Linking C executable finderrors /usr/bin/cmake -E cmake_link_script CMakeFiles/finderrors.dir/link.txt --verbose=1 /usr/lib/ccache/cc -g -O2 -ffile-prefix-map=/srv/tmp/smcv/mojoshader=. -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-z,relro -Wl,-z,now -rdynamic CMakeFiles/finderrors.dir/utils/finderrors.c.o CMakeFiles/mojoshader.dir/mojoshader.c.o CMakeFiles/mojoshader.dir/mojoshader_common.c.o CMakeFiles/mojoshader.dir/mojoshader_opengl.c.o CMakeFiles/mojoshader.dir/mojoshader_metal.c.o CMakeFiles/mojoshader.dir/mojoshader_d3d11.c.o CMakeFiles/mojoshader.dir/mojoshader_vulkan.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_arb1.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_bytecode.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_d3d.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_hlsl.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_glsl.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_metal.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_spirv.c.o CMakeFiles/mojoshader.dir/profiles/mojoshader_profile_common.c.o CMakeFiles/mojoshader.dir/mojoshader_effects.c.o CMakeFiles/mojoshader.dir/mojoshader_compiler.c.o CMakeFiles/mojoshader.dir/mojoshader_preprocessor.c.o CMakeFiles/mojoshader.dir/mojoshader_lexer.c.o CMakeFiles/mojoshader.dir/mojoshader_assembler.c.o -o finderrors -lm /usr/bin/ld: CMakeFiles/finderrors.dir/utils/finderrors.c.o: in function `do_file': ./obj-x86_64-linux-gnu/./utils/finderrors.c:67: undefined reference to `SDL_PollEvent' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:72: undefined reference to `SDL_GL_SwapWindow' /usr/bin/ld: CMakeFiles/finderrors.dir/utils/finderrors.c.o: in function `lookup': ./obj-x86_64-linux-gnu/./utils/finderrors.c:25: undefined reference to `SDL_GL_GetProcAddress' /usr/bin/ld: CMakeFiles/finderrors.dir/utils/finderrors.c.o: in function `main': ./obj-x86_64-linux-gnu/./utils/finderrors.c:238: undefined reference to `SDL_Init' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:240: undefined reference to `SDL_GL_LoadLibrary' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:242: undefined reference to `SDL_CreateWindow' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:244: undefined reference to `SDL_GL_CreateContext' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:268: undefined reference to `SDL_Quit' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:243: undefined reference to `SDL_GetError' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:239: undefined reference to `SDL_GetError' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:241: undefined reference to `SDL_GetError' /usr/bin/ld: ./obj-x86_64-linux-gnu/./utils/finderrors.c:245: undefined reference to `SDL_GetError' collect2: error: ld returned 1 exit status The attached patch fixes this by taking a change from the new upstream git repository <https://github.com/icculus/mojoshader>, and using it to replace part of CMakeLists.patch. smcv
>From 96469b21e1420ca38cdc7d5d332f1c05dd1b4666 Mon Sep 17 00:00:00 2001 From: Simon McVittie <s...@debian.org> Date: Wed, 21 Jul 2021 10:16:50 +0100 Subject: [PATCH] Add patch from upstream to link to SDL if and only if required The previous version of CMakeLists.patch unconditionally disabled linking of finderrors to ${SDL2}, which avoided FTBFS when SDL is not available, but caused FTBFS when SDL *is* available. Now, finderrors is linked to SDL if and only if it was detected, so that the build will succeed in environments with or without SDL. --- debian/patches/CMakeLists.patch | 13 ++------- ...ke-Don-t-fail-if-SDL2-can-t-be-found.patch | 29 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 debian/patches/cmake-Don-t-fail-if-SDL2-can-t-be-found.patch diff --git a/debian/patches/CMakeLists.patch b/debian/patches/CMakeLists.patch index c9b8882..80666ab 100644 --- a/debian/patches/CMakeLists.patch +++ b/debian/patches/CMakeLists.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0d8b4e6..d279707 100644 +index d7a74de..424da2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ @@ -54,16 +54,7 @@ index 0d8b4e6..d279707 100644 IF(EFFECT_SUPPORT) TARGET_SOURCES(mojoshader PRIVATE mojoshader_effects.c -@@ -229,7 +228,7 @@ ENDIF(SDL2) - - IF(COMPILER_SUPPORT) - ADD_EXECUTABLE(finderrors utils/finderrors.c) -- TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) -+ TARGET_LINK_LIBRARIES(finderrors mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) - IF(SDL2) - SET_SOURCE_FILES_PROPERTIES( - utils/finderrors.c -@@ -257,6 +256,30 @@ IF(COMPILER_SUPPORT) +@@ -259,6 +258,30 @@ IF(COMPILER_SUPPORT) TARGET_LINK_LIBRARIES(mojoshader-compiler mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) ENDIF(COMPILER_SUPPORT) diff --git a/debian/patches/cmake-Don-t-fail-if-SDL2-can-t-be-found.patch b/debian/patches/cmake-Don-t-fail-if-SDL2-can-t-be-found.patch new file mode 100644 index 0000000..cb71769 --- /dev/null +++ b/debian/patches/cmake-Don-t-fail-if-SDL2-can-t-be-found.patch @@ -0,0 +1,29 @@ +From: "Ryan C. Gordon" <iccu...@icculus.org> +Date: Mon, 28 Jun 2021 18:08:33 -0400 +Subject: cmake: Don't fail if SDL2 can't be found. + +Origin: upstream, commit:1e1b595dcdd22d65602d94a528f817860a256bf3 +--- + CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d8b4e6..d7a74de 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -229,12 +229,14 @@ ENDIF(SDL2) + + IF(COMPILER_SUPPORT) + ADD_EXECUTABLE(finderrors utils/finderrors.c) +- TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) + IF(SDL2) ++ TARGET_LINK_LIBRARIES(finderrors mojoshader ${SDL2} ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) + SET_SOURCE_FILES_PROPERTIES( + utils/finderrors.c + PROPERTIES COMPILE_FLAGS "-DFINDERRORS_COMPILE_SHADERS=1" + ) ++ ELSE(SDL2) ++ TARGET_LINK_LIBRARIES(finderrors mojoshader ${LIBM} ${LOBJC} ${CARBON_FRAMEWORK}) + ENDIF(SDL2) + ENDIF(COMPILER_SUPPORT) + diff --git a/debian/patches/series b/debian/patches/series index d042827..319683f 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ +cmake-Don-t-fail-if-SDL2-can-t-be-found.patch CMakeLists.patch perl-script.patch -- 2.32.0