[Bug 58881] New: Linux: static link with libvkd3d-utils.a works, but libvkd3d-shader.a - doesn't
http://bugs.winehq.org/show_bug.cgi?id=58881 Bug ID: 58881 Summary: Linux: static link with libvkd3d-utils.a works, but libvkd3d-shader.a - doesn't Product: vkd3d Version: 1.17 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: vkd3d Assignee: wine-bugs(a)winehq.org Reporter: q4arus(a)ya.ru Distribution: --- Created attachment 79543 --> http://bugs.winehq.org/attachment.cgi?id=79543 Full CI log - static link libvkd3d-utils.a works I want to create simple app with static link of vkd3d on Linux. Test app with only 1 call of D3DCreateBlob and static link with libvkd3d-utils.a works fine. Example: ``` #include <iostream> #include <vkd3d_utils.h> int main() { ID3DBlob* codeBufferBlob = nullptr; D3DCreateBlob(5760, &codeBufferBlob); } ``` Full source code and CI here: https://github.com/q4a/vkd3d-test/tree/16ec3647cb403ecd78c1d79e8d7e0a9bfdaab... Build instructions: https://github.com/q4a/vkd3d-test/blob/16ec3647cb403ecd78c1d79e8d7e0a9bfdaab... Log is here: https://github.com/q4a/vkd3d-test/actions/runs/18818259522/job/53689750023 and same in file `libvkd3d-utils-static.txt` If I add 1 call of and add static link with libvkd3d-shader.a I got error: ``` /usr/bin/g++ -g -Wl,--dependency-file=CMakeFiles/dxvk-test.dir/link.d CMakeFiles/dxvk-test.dir/source.cpp.o -o Debug/dxvk-test /home/runner/work/dxvk-test/dxvk-test/build/vkd3d-src/.libs/libvkd3d.a /home/runner/work/dxvk-test/dxvk-test/build/vkd3d-src/.libs/libvkd3d-shader.a /home/runner/work/dxvk-test/dxvk-test/build/vkd3d-src/.libs/libvkd3d-utils.a: /usr/bin/ld: /tmp/cc0FiCe9.ltrans0.ltrans.o: in function `D3DStripShader': /home/runner/work/dxvk-test/dxvk-test/build/Ninja-Debug/../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:921:(.text+0xb88): undefined reference to `vkd3d_shader_parse_dxbc' /usr/bin/ld: /home/runner/work/dxvk-test/dxvk-test/build/Ninja-Debug/../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:945:(.text+0xe05): undefined reference to `vkd3d_shader_serialize_dxbc' /usr/bin/ld: /home/runner/work/dxvk-test/dxvk-test/build/Ninja-Debug/../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:956:(.text+0xe4d): undefined reference to `vkd3d_shader_free_shader_code' /usr/bin/ld: /home/runner/work/dxvk-test/dxvk-test/build/Ninja-Debug/../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:960:(.text+0xe5f): undefined reference to `vkd3d_shader_free_dxbc' /usr/bin/ld: /home/runner/work/dxvk-test/dxvk-test/build/Ninja-Debug/../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:930:(.text+0x127e): undefined reference to `vkd3d_shader_free_dxbc' collect2: error: ld returned 1 exit status ``` Example: ``` #include <iostream> #include <vkd3d_utils.h> int main() { ID3DBlob* codeBufferBlob = nullptr; D3DCreateBlob(5760, &codeBufferBlob); ID3DBlob* stripBuffer = nullptr; D3DStripShader(codeBufferBlob->GetBufferPointer(), codeBufferBlob->GetBufferSize(), D3DCOMPILER_STRIP_PRIVATE_DATA, &stripBuffer); } ``` Full source code and CI here: https://github.com/q4a/vkd3d-test/tree/6f8f6f45b68a0ac21c2c11041bffba0c7641c... Build instructions: https://github.com/q4a/vkd3d-test/blob/6f8f6f45b68a0ac21c2c11041bffba0c7641c... Log is here: https://github.com/q4a/vkd3d-test/actions/runs/18818628712/job/53690638034 and same in file `libvkd3d-shader-static.txt` -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 --- Comment #1 from Aleksey Komarov <q4arus(a)ya.ru> --- Created attachment 79544 --> http://bugs.winehq.org/attachment.cgi?id=79544 Full CI log - static link libvkd3d-shader.a failed -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 Aleksey Komarov <q4arus(a)ya.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #79543|Full CI log - static link |libvkd3d-utils-static.txt - description|libvkd3d-utils.a works |static link | |libvkd3d-utils.a works -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 Aleksey Komarov <q4arus(a)ya.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #79544|Full CI log - static link |libvkd3d-shader-static.txt description|libvkd3d-shader.a failed |- static link | |libvkd3d-shader.a failed -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 --- Comment #2 from Henri Verbeet <hverbeet(a)gmail.com> --- Created attachment 79647 --> http://bugs.winehq.org/attachment.cgi?id=79647 test program I'm not quite able to reproduce the exact issue you reported here, but did find a different issue for which I've submitted https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1821 If you're still able to reproduce your issue with the changes from that merge request applied, could you attempt the build the attached test program and let me know whether that works? It's a slightly modified version of your example, but with a plain Makefile as build system. Note that you may need to set the PKG_CONFIG_PATH environment variable to the location where vkd3d installed its .pc files if that's not a standard location. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 Aleksey Komarov <q4arus(a)ya.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |q4arus(a)ya.ru --- Comment #3 from Aleksey Komarov <q4arus(a)ya.ru> --- Created attachment 79766 --> http://bugs.winehq.org/attachment.cgi?id=79766 test program v2 Hi. Sorry for delay. I tested your example a week ago and it worked, but I didn't have time to check the details. Now you can check my modifications of your example and it gives me same error: ``` $ make g++ -o vkd3d-static vkd3d-static.cpp -static -g -O2 -Wall -Wextra `pkg-config --cflags libvkd3d-utils` `pkg-config --cflags libvkd3d-shader` `pkg-config --libs libvkd3d-shader` `pkg-config --libs libvkd3d-utils` -lpthread /usr/bin/ld: /tmp/ccO8jJla.ltrans0.ltrans.o: in function `D3DStripShader': /home/q/git/dxvk-test-clean/build/vkd3d-static/test-v2/../../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:922:(.text+0xbf6): undefined reference to `vkd3d_shader_parse_dxbc' /usr/bin/ld: /home/q/git/dxvk-test-clean/build/vkd3d-static/test-v2/../../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:946:(.text+0xe6d): undefined reference to `vkd3d_shader_serialize_dxbc' /usr/bin/ld: /home/q/git/dxvk-test-clean/build/vkd3d-static/test-v2/../../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:957:(.text+0xeb4): undefined reference to `vkd3d_shader_free_shader_code' /usr/bin/ld: /home/q/git/dxvk-test-clean/build/vkd3d-static/test-v2/../../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:961:(.text+0xec6): undefined reference to `vkd3d_shader_free_dxbc' /usr/bin/ld: /home/q/git/dxvk-test-clean/build/vkd3d-static/test-v2/../../vkd3d-src/libs/vkd3d-utils/vkd3d_utils_main.c:931:(.text+0x1250): undefined reference to `vkd3d_shader_free_dxbc' collect2: error: ld returned 1 exit status make: *** [Makefile:10: vkd3d-static] Error 1 ``` on vkd3d 1.17 (git 06a5039, full hash 06a503975f7808bcefff8bf2ca4e9605926e1ed9). As you can see, I made 2 small changes: 1. Commented out call vkd3d_shader_get_version 2. Swapped link libs: it was: $(LIBVKD3D_UTILS_LIBS) $(LIBVKD3D_SHADER_LIBS) and now: $(LIBVKD3D_SHADER_LIBS) $(LIBVKD3D_UTILS_LIBS) I'm not sure if it's bug or feature, but now I can just change link order: https://github.com/q4a/vkd3d-test/commit/3dcf9f81f29e86d9fe0e7f07e74595a3829... And build+run my test without error: ``` Debug test result: Size of blob from D3DCreateBlob(5760, &codeBufferBlob)==5760 As expected: failed to call D3DStripShader ``` https://github.com/q4a/vkd3d-test/actions/runs/19591876011/job/56111160602 -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 Vijay Kamuju <infyquest(a)gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |infyquest(a)gmail.com --- Comment #4 from Vijay Kamuju <infyquest(a)gmail.com> --- New vkd3d 1.18 is released -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 --- Comment #5 from Henri Verbeet <hverbeet(a)gmail.com> --- (In reply to Aleksey Komarov from comment #3)
on vkd3d 1.17 (git 06a5039, full hash 06a503975f7808bcefff8bf2ca4e9605926e1ed9). As you can see, I made 2 small changes: 1. Commented out call vkd3d_shader_get_version 2. Swapped link libs: it was: $(LIBVKD3D_UTILS_LIBS) $(LIBVKD3D_SHADER_LIBS) and now: $(LIBVKD3D_SHADER_LIBS) $(LIBVKD3D_UTILS_LIBS)
I'm not sure if it's bug or feature, but now I can just change link order: https://github.com/q4a/vkd3d-test/commit/ 3dcf9f81f29e86d9fe0e7f07e74595a3829668a1 And build+run my test without error:
That's the expected behaviour, I'm afraid. The details of the linking process have been explained by other people much better than I would be able to here, but essentially, when you're statically linking a library "liba" than depends on symbols from a second library "libb", the first library needs to come before the second one in the list of libraries your linking to. I.e., "-la -lb". For vkd3d, that means that if you're statically linking to libvkd3d-utils, the correct order is "-lvkd3d-utils -lvkd3d -lvkd3d-shader". You can get away with dropping "-lvkd3d" if nothing you're using from vkd3d-utils depends on libvkd3d; in practice that means not using any of the D3D12*() functions like D3D12CreateDevice(), nor vkd3d_utils_set_log_callback(). -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=58881 Aleksey Komarov <q4arus(a)ya.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |NOTOURBUG Status|UNCONFIRMED |RESOLVED --- Comment #6 from Aleksey Komarov <q4arus(a)ya.ru> --- (In reply to Henri Verbeet from comment #5)
That's the expected behaviour, I'm afraid.
Thanks, I got it. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla