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

OpenCV与Protobuf冲突 #4413

Open
jielyu opened this issue Jun 20, 2024 · 4 comments
Open

OpenCV与Protobuf冲突 #4413

jielyu opened this issue Jun 20, 2024 · 4 comments
Labels

Comments

@jielyu
Copy link

jielyu commented Jun 20, 2024

Xmake Version

v2.9.2+HEAD.6b6557c

Operating System Version and Architecture

Ubuntu22.04

Describe Bug

同时依赖OpenCV 4.10.0 和 Protobuf 27.0的二进制目标,在链接时报错protobuf中的内容与opencv4/3rdpart/liblibprotobuf.a中定义重复。

奇怪的是 静态库和动态库都可以正常生成,只有二进制目标报错。

Expected Behavior

预期正常链接

Project Configuration

add_rules("mode.debug", "mode.release")

add_requires("gflags", "glog", "protobuf-cpp", "opencv")
add_requires("grpc", {system = false})

target("my_proto")
set_kind("static")
set_languages("c++17")
add_packages("protobuf-cpp", {public = true})
add_packages("grpc")
add_rules("protobuf.cpp")
add_files("protos/*.proto", {proto_public = true, proto_grpc_cpp_plugin = true})

target("test_proj")
set_kind("binary")
add_packages("gflags", "glog", "protobuf-cpp", "opencv")
add_deps("my_proto")
add_files("src/**.cpp")
add_includedirs("./")

Additional Information and Error Logs

/usr/bin/ld: /home//.xmake/packages/p/protobuf-cpp/27.0/3a6ae090d364400a86d45d58d50c750c/lib/libprotobuf.a(zero_copy_stream.cc.o): in function google::protobuf::io::ZeroCopyOutputStream::WriteAliasedRaw(void const*, int)': zero_copy_stream.cc:(.text.unlikely+0x0): multiple definition of google::protobuf::io::ZeroCopyOutputStream::WriteAliasedRaw(void const, int)'; /home/*/.xmake/packages/o/opencv/4.10.0/07fff2ddbc8647d392e888cc2a12d4a4/lib/opencv4/3rdparty/liblibprotobuf.a(zero_copy_stream.cc.o):zero_copy_stream.cc:(.text._ZN6google8protobuf2io20ZeroCopyOutputStream15WriteAliasedRawEPKvi+0x0): first defined here
collect2: error: ld returned 1 exit status

@jielyu jielyu added the bug label Jun 20, 2024
@star-hengxing
Copy link
Contributor

这是因为 opencv 包没有拆依赖,等我有时间来解决

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This is because the opencv package has not removed its dependencies. I will solve it when I have time.

@jielyu
Copy link
Author

jielyu commented Jun 20, 2024

这是因为 opencv 包没有拆依赖,等我有时间来解决

好的,感谢

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


This is because the opencv package has not removed its dependencies. I will solve it when I have time.

OK, thanks

@waruqi waruqi transferred this issue from xmake-io/xmake Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants