-
Notifications
You must be signed in to change notification settings - Fork 9
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
FIX: fix link error when LIVE555_MONOLITH_BUILD is ON #11
Conversation
Fix link error in windows when option LIVE555_MONOLITH_BUILD is ON. - EpollTaskScheduler object was duplicated in live555 SHARED and INTERFACE - delete EpollTaskScheduler in live555 INTERFACE (lgpl issue)
It doesn't seem to be reproducible, so I will close this for now and verify the reproduction steps before reopening it. |
제가 지금 2월 18일부터 26일까지 해외출장 중이라 귀국하면 확인 후 올리겠습니다.
2025년 2월 20일 (목) 오후 6:23, Cho HyeonJong ***@***.***>님이 작성:
… KO
cmake 프로젝트로 관리 해주시고 계셔서 감사합니다.
윈도우즈 에서 LIVE555_MONOLITH_BUILD을 ON으로 설정시 링크 에러가 발생하여 수정후 풀리퀘스트 드립니다.
현재 LIVE555_MONOLITH_BUILD을 ON으로 설정하면 live555를 의존성으로 추가한 cmake 프로젝트에
EpollTaskScheduler.obj와 live555.dll가 동시에 링크 됩니다. 이로 인해 정의가 중복되어 링크 에러가
발생하였습니다.
EpollTaskScheduler 정의가 중복되므로 target_link_libraries 구문을 제거하고 if (Target
EpollTaskScheduler) 구문을 이용해 add_library에 EpollTaskScheduler가 포함되거나 포함되지 않도록
변경하였습니다.
아래 코드로 새 cmake 프로젝트를 만들고 재현해 볼 수 있습니다.
EN (translated by ChatGPT)
Thank you for managing the project with CMake.
When the LIVE555_MONOLITH_BUILD option is set to ON on Windows, a linking
error occurs. I have fixed this and am submitting a pull request.
Currently, when LIVE555_MONOLITH_BUILD is set to ON, both
EpollTaskScheduler.obj and live555.dll are linked simultaneously in a CMake
project that depends on live555. This causes a linking error due to
duplicate definitions.
To resolve this, I removed the target_link_libraries statement for
EpollTaskScheduler and modified the code to use the if (Target
EpollTaskScheduler) statement. This ensures that EpollTaskScheduler is
included or excluded from add_library accordingly.
You can reproduce the issue with make new cmake project and use following
code:
reproducible code
use cpm
CPMAddPackage(
NAME live555
GITHUB_REPOSITORY melchi45/live555
GIT_TAG master
OPTIONS "LIVE555_MONOLITH_BUILD ON" "LIVE555_BUILD_EXAMPLES OFF"
)
add_library(foo STATIC main.cpp)target_link_libraries(foo PUBLIC live555::live555)
or use fetch content
include(FetchContent)
FetchContent_Declare(
live555
GIT_REPOSITORY https://github.com/melchi45/live555.git
GIT_TAG master
)set(LIVE555_MONOLITH_BUILD ON CACHE INTERNAL "Build SHARED libraries")
FetchContent_MakeAvailable(live555)
add_library(foo STATIC main.cpp)target_link_libraries(foo PUBLIC live555::live555)
------------------------------
You can view, comment on, or merge this pull request online at:
#11
Commit Summary
- 63fba40
<63fba40>
FIX: fix link error windows shared build
File Changes
(1 file <https://github.com/melchi45/live555/pull/11/files>)
- *M* CMakeLists.txt
<https://github.com/melchi45/live555/pull/11/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a>
(53)
Patch Links:
- https://github.com/melchi45/live555/pull/11.patch
- https://github.com/melchi45/live555/pull/11.diff
—
Reply to this email directly, view it on GitHub
<#11>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC3P77JU42L4UJSXW4LC42T2QWUKVAVCNFSM6AAAAABXQMEOUGVHI2DSMVQWIX3LMV43ASLTON2WKOZSHA3DKNZSGY2TMNA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
nonbanana/live555_test 링크에 재현 가능한 프로젝트 레포를 올려두었습니다. configure 전 vcpkg로 openssl 를 설치하신 뒤 아래처럼 configure 하시면 됩니다. cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="{VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" 프로젝트 CMakeLists.txt 파일 CPMAddPackage 구문에 pull request 날린 레포를 주석으로 추가해두었으니 configure 된 프로젝트 파일을 지워가면서 테스트 해보시면 됩니다. 제가 테스트한 환경은 다음과 같습니다.
problemLIVE555_MONOLITH_BUILD=ON 일때 EpollTaskScheduler의 처리가 이상합니다. When use option "LIVE555_MONOLITH_BUILD ON" and "LIVE555_EPOLL_SUPPORT OFF"if use live555 project in other cmake project CPMAddPackage(
NAME live555
GITHUB_REPOSITORY melchi45/live555 #nonbanana/live555
GIT_TAG master#fix/win-monolith-build
OPTIONS "LIVE555_MONOLITH_BUILD ON" "LIVE555_BUILD_EXAMPLES OFF" "LIVE555_EPOLL_SUPPORT OFF"
) or build directly cmake -S . -B build -DLIVE555_MONOLITH_BUILD=ON -DLIVE555_EPOLL_SUPPORT=OFF then, configure error ocure like this CMake Error at {VCPKG_PATH}/scripts/buildsystems/vcpkg.cmake:618 (_add_library):
Error evaluating generator expression:
$<TARGET_OBJECTS:EpollTaskScheduler>
Objects of target "EpollTaskScheduler" referenced but no such target
exists.
Call Stack (most recent call first):
CMakeLists.txt:286 (add_library) When use option "LIVE555_MONOLITH_BUILD ON" and "LIVE555_EPOLL_SUPPORT ON"import live555 project in other cmake project CPMAddPackage(
NAME live555
GITHUB_REPOSITORY melchi45/live555 #nonbanana/live555
GIT_TAG master#fix/win-monolith-build
OPTIONS "LIVE555_MONOLITH_BUILD ON" "LIVE555_BUILD_EXAMPLES OFF" "LIVE555_EPOLL_SUPPORT ON"
) and link library to other project in cmake target_link_libraries(RTSPTest live555::live555) then, build error (linker error) ocure like this live555.lib(live555.dll) : error LNK2005: "public: class TaskScheduler & __cdecl UsageEnvironment::taskScheduler(void)const " (?taskScheduler@UsageEnvironment@@QEBAAE
AVTaskScheduler@@XZ)이(가) EpollTaskScheduler.obj에 이미 정의되어 있습니다. [C:\workspace\live555_test\build\RTSPTest.vcxproj]
C:/workspace/live555_test/build/Debug/RTSPTest.lib 라이브러리 및 C:/workspace/live555_test/build/Debug/RTSPTest.exp 개체를 생성하고 있습니다.
C:\workspace\live555_test\build\Debug\RTSPTest.exe : fatal error LNK1169: 여러 번 정의된 기호가 있습니다. [C:\workspace\live555_test\build\RTSPTest.vcxproj] |
KO
cmake 프로젝트로 관리 해주시고 계셔서 감사합니다.
윈도우즈 에서 LIVE555_MONOLITH_BUILD을 ON으로 설정시 링크 에러가 발생하여 수정후 풀리퀘스트 드립니다.
현재 LIVE555_MONOLITH_BUILD을 ON으로 설정하면 live555를 의존성으로 추가한 cmake 프로젝트에 EpollTaskScheduler.obj와 live555.dll가 동시에 링크 됩니다. 이로 인해 정의가 중복되어 링크 에러가 발생하였습니다.
EpollTaskScheduler 정의가 중복되므로 target_link_libraries 구문을 제거하고 if (Target EpollTaskScheduler) 구문을 이용해 add_library에 EpollTaskScheduler가 포함되거나 포함되지 않도록 변경하였습니다.
아래 코드로 새 cmake 프로젝트를 만들고 재현해 볼 수 있습니다.
EN (translated by ChatGPT)
Thank you for managing the project with CMake.
When the LIVE555_MONOLITH_BUILD option is set to ON on Windows, a linking error occurs. I have fixed this and am submitting a pull request.
Currently, when LIVE555_MONOLITH_BUILD is set to ON, both EpollTaskScheduler.obj and live555.dll are linked simultaneously in a CMake project that depends on live555. This causes a linking error due to duplicate definitions.
To resolve this, I removed the target_link_libraries statement for EpollTaskScheduler and modified the code to use the if (Target EpollTaskScheduler) statement. This ensures that EpollTaskScheduler is included or excluded from add_library accordingly.
You can reproduce the issue with make new cmake project and use following code:
reproducible code
use cpm
or use fetch content