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
cmake: fix duplicate symbols when linking tests #11926
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The linker resolves this automatically in non-unity builds. In unity builds the linker cannot drop a single object with the duplicates, resulting in these errors. The root issue is that we started including certain objects both via both libcurlu and libcurltool libs. Regression from 39e7c22 Windows errors: ``` [ 3%] Linking C executable unit1303.exe [ 3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_multibyte.c.obj ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wchar': C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_convert_UTF8_to_wchar' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:44: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UTF8': C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_convert_wchar_to_UTF8' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:66: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open': C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32_open' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:92: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen': C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win32_fopen' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:120: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat': [...] ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247 macOS errors: ``` [ 56%] Linking C executable unit1302 duplicate symbol '_curlx_sotouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_sitouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_uztosz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) [...] ``` with config: ``` -DCMAKE_UNITY_BUILD=ON \ -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_STATIC_LIBS=OFF ``` Closes #xxxxx
vszakats
added a commit
to vszakats/curl
that referenced
this pull request
Sep 24, 2023
The linker resolves this automatically in non-unity builds. In unity builds the linker cannot drop a single object with the duplicates, resulting in these errors. The root issue is that we started including certain objects both via both libcurlu and libcurltool libs. Regression from 39e7c22 Windows errors: ``` [ 3%] Linking C executable unit1303.exe [ 3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_multibyte.c.obj ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wchar': C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_convert_UTF8_to_wchar' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:44: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UTF8': C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_convert_wchar_to_UTF8' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:66: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open': C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32_open' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:92: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen': C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win32_fopen' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:120: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat': [...] ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247 macOS errors: ``` [ 56%] Linking C executable unit1302 duplicate symbol '_curlx_sotouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_sitouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_uztosz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) [...] ``` with config: ``` -DCMAKE_UNITY_BUILD=ON \ -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_STATIC_LIBS=OFF ``` Closes curl#11926
zuoxiaofeng
pushed a commit
to zuoxiaofeng/curl
that referenced
this pull request
Nov 28, 2023
The linker resolves this automatically in non-unity builds. In unity builds the linker cannot drop a single object with the duplicates, resulting in these errors. The root issue is that we started including certain objects both via both libcurlu and libcurltool libs. Regression from 39e7c22 Windows errors: ``` [ 3%] Linking C executable unit1303.exe [ 3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_multibyte.c.obj ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wchar': C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_convert_UTF8_to_wchar' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:44: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UTF8': C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_convert_wchar_to_UTF8' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:66: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open': C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32_open' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:92: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen': C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win32_fopen' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte.c:120: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat': [...] ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247 macOS errors: ``` [ 56%] Linking C executable unit1302 duplicate symbol '_curlx_sotouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_sitouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_uztosz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) [...] ``` with config: ``` -DCMAKE_UNITY_BUILD=ON \ -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_STATIC_LIBS=OFF ``` Closes curl#11926
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The linker resolves this automatically in non-unity builds. In unity builds the linker cannot drop a single object with the duplicates, resulting in these errors. The root issue is that we started including certain objects both via both libcurlu and libcurltool libs.
Regression from 39e7c22
Windows errors:
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9aa4ehny5q#L247
macOS errors:
with config:
Closes #11926