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

building a static binary Lost Quirc #1179

Open
shixiawuheng opened this issue Jun 23, 2024 · 11 comments
Open

building a static binary Lost Quirc #1179

shixiawuheng opened this issue Jun 23, 2024 · 11 comments

Comments

@shixiawuheng
Copy link

command-line-arguments

C:\go\pkg\tool\windows_amd64\link.exe: running g++ failed: exit status 1
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lquirc
collect2.exe: error: ld returned 1 exit status

While attempting static compilation, I encountered an error and don't understand why Quirc is required.

@shixiawuheng shixiawuheng changed the title building a static binary building a static binary Lost Quirc Jun 26, 2024
@shixiawuheng
Copy link
Author

I even tried to compile in the gocv/opencv: 4.10.0 static Docker image, but it didn't work

command-line-arguments

/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: cannot find -lquirc
collect2: error: ld returned 1 exit status

@shixiawuheng
Copy link
Author

It was introduced in cgo_static.go, not the library introduced in my project

@shixiawuheng
Copy link
Author

I don't understand why others haven't experienced this situation

@shixiawuheng
Copy link
Author

After completing the Quirc compilation
/usr/bin/ld: /usr/local/lib/libopencv_highgui.a(window_gtk.cpp.o): in function cvImageWidget_class_init(void*, void*)': window_gtk.cpp:(.text._ZL24cvImageWidget_class_initPvS_+0xa): undefined reference to gtk_widget_get_type'
/usr/bin/ld: window_gtk.cpp:(.text.ZL24cvImageWidget_class_initPvS+0x15): undefined reference to g_type_class_peek' /usr/bin/ld: window_gtk.cpp:(.text._ZL24cvImageWidget_class_initPvS_+0x20): undefined reference to g_type_check_class_cast'
/usr/bin/ld: /usr/local/lib/libopencv_highgui.a(window_gtk.cpp.o): in function icvOnTrackbar(_GtkWidget*, void*)': window_gtk.cpp:(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0xd): undefined reference to gtk_range_get_type'
/usr/bin/ld: window_gtk.cpp:(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0x18): undefined reference to g_type_check_instance_cast' /usr/bin/ld: window_gtk.cpp:(.text._ZL13icvOnTrackbarP10_GtkWidgetPv+0x20): undefined reference to gtk_range_get_value'
/usr/bin/ld: /usr/local/lib/libopencv_highgui.a(window_gtk.cpp.o): in function icvWindowThreadLoop(void*)': window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x1b): undefined reference to gtk_main_iteration_do'
/usr/bin/ld: window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x2d): undefined reference to g_usleep' /usr/bin/ld: window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x32): undefined reference to g_thread_yield'
/usr/bin/ld: window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x63): undefined reference to gtk_main_iteration_do' /usr/bin/ld: window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x6d): undefined reference to g_usleep'
/usr/bin/ld: window_gtk.cpp:(.text._ZL19icvWindowThreadLoopPv+0x72): undefined reference to g_thread_yield' /usr/bin/ld: /usr/local/lib/libopencv_highgui.a(window_gtk.cpp.o): in function cvImageWidgetSetImage(_CvImageWidget*, void const*)':
window_gtk.cpp:(.text._ZL21cvImageWidgetSetImageP14_CvImageWidgetPKv+0x11d): undefined reference to `gtk_widget_get_type'

@shixiawuheng
Copy link
Author

Why do I still have dynamic library links after going through countless hardships and finally compiling them
linux-vdso.so.1 (0x00007ffed1bf2000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x0000745ece701000)
libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x0000745ece67e000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000745ece400000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000745ece317000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000745ece2ea000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000745ece000000)
/lib64/ld-linux-x86-64.so.2 (0x0000745ece72d000)

1 similar comment
@shixiawuheng
Copy link
Author

Why do I still have dynamic library links after going through countless hardships and finally compiling them
linux-vdso.so.1 (0x00007ffed1bf2000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x0000745ece701000)
libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x0000745ece67e000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000745ece400000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000745ece317000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000745ece2ea000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000745ece000000)
/lib64/ld-linux-x86-64.so.2 (0x0000745ece72d000)

@olbb
Copy link

olbb commented Aug 11, 2024

Try adding the CMake option -DWITH_QUIRC=ON when building OpenCV

@shixiawuheng
Copy link
Author

I am using the official Docker image for compilation. I am not familiar with C++myself, and I cannot even cross compile from Windows to Linux. I am truly ashamed

@olbb
Copy link

olbb commented Aug 11, 2024

quirc is used in gocv, but it is disabled in the default rules of opencv, so you need to enable it manually by "-DWITH_QUIRC=ON"

@shixiawuheng
Copy link
Author

我感觉我们都是中国人,可以讲中文吗?英语不太好,我是需要在这边下载的脚本中去修改他的CMake标志就可以了是吧
linux-vdso.so.1 (0x00007ffed1bf2000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x0000745ece701000)
libjpeg.so.8 => /lib/x86_64-linux-gnu/libjpeg.so.8 (0x0000745ece67e000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x0000745ece400000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000745ece317000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000745ece2ea000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000745ece000000)
/lib64/ld-linux-x86-64.so.2 (0x0000745ece72d000) 这些库应该也是opencv链接的吧我通过DWITH_QUIRC=ON” 启用了 应该就一起解决了吧

@shixiawuheng
Copy link
Author

我有时间去研究一下,但是我感觉我需要先研究怎么在Windows环境交叉编译,非常感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants