Created attachment 203799 [details] make log when running "make" for the second time in ports/net/kitinerary Scenario: - FreeBSD 12.0 pl 3 i386 running under VirtualBox (host FreeBSD 12.0 pl 3 amd64) - x11/kde5 and many other ports installed - updating from 18.12.3 to 19.04.0 using portmaster Result: - linking fails with the following error: FAILED: bin/kitinerary-extractor : && /usr/bin/c++ -O2 -pipe -fstack-protector -fno-strict-aliasing -std=c++0x - fno-operator-names -fno-exceptions -Wno-gnu-zero-variadic-macro-arguments -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -fdiagnostics-color=always -pedantic -Wzero-as-null-pointer-constant -O2 -pipe -fstack-protector -fno-strict-aliasing -Wl,--enable-new-dtags -fstack-protector src/cli/CMakeFiles/kitinerary-extractor.dir/kitinerary-extractor_autogen/mocs_compilation.cpp.o src/cli/CMakeFiles/kitinerary-extractor.dir/main.cpp.o -o bin/kitinerary-extractor -Wl,-rpath,/usr/tmp/a/SRC/FreeBSD-ports/head/net/kitinerary/work/.build/bin:/usr/local/lib:/usr/local/lib/qt5: bin/libKPimItinerary.so.5.11.0 /usr/local/lib/libKPimPkPass.so.5.11.0 /usr/local/lib/libKF5Mime.so.5.11.0 /usr/local/lib/libKF5CalendarCore.so.5.11.0 /usr/local/lib/qt5/libQt5Gui.so.5.12.2 /usr/local/lib/qt5/libQt5Core.so.5.12.2 -Wl,-rpath-link,/usr/local/lib:/usr/local/lib/qt5 && : /usr/local/lib/libzxing.so: undefined reference to `cv::fastFree(void*)' /usr/local/lib/libzxing.so: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const' /usr/local/lib/libzxing.so: undefined reference to `cv::Mat::deallocate()' c++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed. ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make[1]: stopped in /a/SRC/FreeBSD-ports/head/net/kitinerary *** Error code 1 Stop. make: stopped in /a/SRC/FreeBSD-ports/head/net/kitinerary Note: - There was no such issue when upgrading the amd64 variant (in a VirtualBox VM running FreeBSD 12 pl 3 amd64) -- Martin
Thank you for the report Martin Looks related to libzxing.so (via textproc/zxing-cpp, maintainer CC'd)
textproc/zxing-cpp links with and has dependency on OpenCV: > LIB_DEPENDS= libopencv_core.so:graphics/opencv-core \ > libopencv_photo.so:graphics/opencv Is is known what change triggered the problem? I just updated textproc/zxing-cpp to the latest revision.
For me the trigger was the update of KDE applications from 18.12.3 to 19.04.0. The patch in zxing, textproc/zxing-cpp/files/patch-CMakeLists.txt, looks suspicious - why is it necessary if zxing support linking to opencv? -- Martin
Without this patch it fails to link with OpenCV: > libzxing.so: undefined reference to `cv::Mat::deallocate()' https://github.com/glassechidna/zxing-cpp/issues/84
Maybe more is necessary for specifying the dependency on opencv so that zxing consumers can pick it up, too? I found https://docs.opencv.org/3.4.1/db/df5/tutorial_linux_gcc_cmake.html. Alas, I don't know cmake to be able to judge... -- Martin
Using the following patch I got it to work: --- ./src/cli/CMakeLists.txt.ORIG 2019-04-08 13:52:31.000000000 +0200 +++ ./src/cli/CMakeLists.txt 2019-04-20 12:28:40.091467000 +0200 @@ -2,10 +2,12 @@ return() endif() +find_package( OpenCV REQUIRED ) add_executable(kitinerary-extractor main.cpp) target_include_directories(kitinerary-extractor PRIVATE ${CMAKE_BINARY_DIR}) target_link_libraries(kitinerary-extractor KPimItinerary KPim::PkPass + ${OpenCV_LIBS} ) install(TARGETS kitinerary-extractor DESTINATION ${KF5_LIBEXEC_INSTALL_DIR})
No, this fix is wrong. The bug is in libzxing.so - it doesn't link with opencv.
A commit references this bug: Author: yuri Date: Sat Apr 20 14:38:20 UTC 2019 New revision: 499444 URL: https://svnweb.freebsd.org/changeset/ports/499444 Log: textproc/zxing-cpp: Link OpenCV libs to the library Add the patch from the upstream pull request PR: 237388 Reported by: Martin Birgmeier <d8zNeCFG@aon.at> Changes: head/textproc/zxing-cpp/Makefile head/textproc/zxing-cpp/distinfo head/textproc/zxing-cpp/files/patch-CMakeLists.txt
Fix committed. Thanks for reporting this problem!
Thank you Yuri! -- Martin
(In reply to Martin Birgmeier from comment #10) You are welcome! Yuri
There is still something problematic... now building kitinerary fails with /usr/bin/ld: cannot find -lopencv_aruco c++: error: linker command failed with exit code 1 (use -v to see invocation)
On amd64 it now fails as well: /usr/bin/ld: error: unable to find library -lopencv_aruco /usr/bin/ld: error: unable to find library -lopencv_bgsegm /usr/bin/ld: error: unable to find library -lopencv_bioinspired /usr/bin/ld: error: unable to find library -lopencv_calib3d /usr/bin/ld: error: unable to find library -lopencv_ccalib /usr/bin/ld: error: unable to find library -lopencv_core /usr/bin/ld: error: unable to find library -lopencv_datasets /usr/bin/ld: error: unable to find library -lopencv_dnn /usr/bin/ld: error: unable to find library -lopencv_dnn_modern /usr/bin/ld: error: unable to find library -lopencv_dnn_objdetect /usr/bin/ld: error: unable to find library -lopencv_dpm /usr/bin/ld: error: unable to find library -lopencv_face /usr/bin/ld: error: unable to find library -lopencv_features2d /usr/bin/ld: error: unable to find library -lopencv_flann /usr/bin/ld: error: unable to find library -lopencv_freetype /usr/bin/ld: error: unable to find library -lopencv_fuzzy /usr/bin/ld: error: unable to find library -lopencv_hdf /usr/bin/ld: error: unable to find library -lopencv_hfs /usr/bin/ld: error: unable to find library -lopencv_highgui /usr/bin/ld: error: unable to find library -lopencv_img_hash /usr/bin/ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors) c++: error: linker command failed with exit code 1 (use -v to see invocation)
reopening
(In reply to Martin Birgmeier from comment #13) Could you include the commands that cause this failure?
As a first step, I ran "portmaster -a". Because I had updated recently, this resulted only in zxing being upgraded. From /var/log/messages: Apr 20 18:11:00 v909 pkg-static[7195]: zxing-cpp-0.20190320 deinstalled Apr 20 18:11:01 v909 pkg-static[7295]: zxing-cpp-0.20190320_1 installed Then, knowing that kitinerary was a consumer of zxing, I ran "portmaster kitinerary-19.04.0". This started the recompilation of kitinerary, leading to errors on both i386 and amd64 (2 different VMs). -- Martin
I meant what is the command that fails with: > /usr/bin/ld: error: unable to find library -lopencv_aruco
Created attachment 203834 [details] result of running "portmaster kitinerary-19.04.0 |& tee /tmp/portmaster.log" Hi Yuri, Please find the log file attached. -- Martin
This was from the run on amd64 btw.
Created attachment 203835 [details] Add USES=localbase:ldflags Martin, Could you please try and see if the attached patch fixes the problem? Thanks, Yuri
Build failure in net/kitinerary should be handled by kde@. The error happens to look much like the original error reported by Martin Birgmeier that I've fixed in textproc/zxing-cpp, but the cause now seemd to be different.
Yes, this patch works (tested on both i386 and amd64). It is strange however that this directory path is not recorded by the opencv dependency in zxing. Thank you for the help! -- Martin
(In reply to Martin Birgmeier from comment #22) This is something for kde@ to investigate: why don't cmake scripts get proper link paths from OpenCV. They can either investigate this, or just apply the attached patch. Thank you for reporting the issue, Martin! Yuri
I think the real problem is still in zxing-cpp - due to wrong cmake scripts.
(In reply to Yuri Victorovich from comment #17) opencv_aruco is a extra module in opencv_contrib. You need to enable EXTRA_MODULES option when building graphics/opencv.
(In reply to Hiroo Ono from comment #25) Sorry. EXTRA_MODULES was default enabled. libopencv_aruco.so should exist.
ldd /usr/local/bin/zxing shows many opencv libraries, but from opencv-cli/src/main.cpp only core, imgproc, highgui is needed. Also, ldd /usr/local/lib/libzxing.so shows no opencv libraries. It should link libopencv_core.so. Apparently, the fix in upstream is not correct.
Created attachment 203850 [details] patch-CMakeLists.txt How about if you replaced textproc/zxing-cpp/files/patch-CMakeLists.txt with this file?
(In reply to Hiroo Ono from comment #28) Hi Hiroo, The fix looks correct to me. The problem is that zxing-cpp links to OpenCV improperly. It is causing user code to link to OpenCV when this is not necessary. I will commit a fix later today. I've already updated the upstream pull request: https://github.com/glassechidna/zxing-cpp/pull/86 Yuri
(In reply to Hiroo Ono from comment #28) I looked at the patch. This line: > target_link_libraries(libzxing ${OpenCV_LIBS}) causes OpenCV libs to propagate into the installed cmake files. This causes all clients that link with libzxing to also link with OpenCV, which isn't necessary. It needs the word PRIVATE in it. But I already have this in the updated pull request. Thank you for your help, Yuri
A commit references this bug: Author: yuri Date: Sun Apr 21 21:11:36 UTC 2019 New revision: 499595 URL: https://svnweb.freebsd.org/changeset/ports/499595 Log: textproc/zxing-cpp: Patch to remove OpenCV libs from the installed cmake files net/kitinerary was broken because OpenCV libs were unnecessarily supplied to its build by cmake files from textproc/zxing-cpp. These OpenCV libs were missing -L/usr/local/lib for some reason, possiblt because OpenCV's cmake files provide LIBS without -L/usr/local/lib. PR: 237388 Reported by: Martin Birgmeier <d8zNeCFG@aon.at> Changes: head/textproc/zxing-cpp/Makefile head/textproc/zxing-cpp/distinfo
(In reply to commit-hook from comment #31) Thanks for fixing this.
(In reply to Tobias C. Berner from comment #32) You're welcome.