Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. liniking in macOS to precompiled libraries ERROR

liniking in macOS to precompiled libraries ERROR

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 781 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by Mesrine
    #1

    Hi everyone.

    The thing is I have a Qt library that links to precompiled OpenCV libraries in macOS.

    But the linker returns the error

    FAILED: QrDec/libQrDec.dylib 
    : && /usr/bin/clang++ -O3 -DNDEBUG -isysroot /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=11.0 -dynamiclib -Wl,-headerpad_max_install_names  -o QrDec/libQrDec.dylib -install_name @rpath/libQrDec.dylib QrDec/CMakeFiles/QrDec.dir/qrcodedec.cpp.o  _deps/opencv-src/lib/libopencv_gapi.so.4.8.0  _deps/opencv-src/lib/libopencv_highgui.so.4.8.0  _deps/opencv-src/lib/libopencv_ml.so.4.8.0  _deps/opencv-src/lib/libopencv_objdetect.so.4.8.0  _deps/opencv-src/lib/libopencv_photo.so.4.8.0  _deps/opencv-src/lib/libopencv_stitching.so.4.8.0  _deps/opencv-src/lib/libopencv_video.so.4.8.0  _deps/opencv-src/lib/libopencv_videoio.so.4.8.0  _deps/opencv-src/lib/libopencv_imgcodecs.so.4.8.0  _deps/opencv-src/lib/libopencv_dnn.so.4.8.0  _deps/opencv-src/lib/libopencv_calib3d.so.4.8.0  _deps/opencv-src/lib/libopencv_features2d.so.4.8.0  _deps/opencv-src/lib/libopencv_flann.so.4.8.0  _deps/opencv-src/lib/libopencv_imgproc.so.4.8.0  _deps/opencv-src/lib/libopencv_core.so.4.8.0 && :
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_highgui.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_gapi.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_ml.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_objdetect.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_photo.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_stitching.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_video.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_videoio.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_imgcodecs.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_calib3d.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_features2d.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_dnn.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_flann.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_core.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    ld: warning: ignoring file _deps/opencv-src/lib/libopencv_imgproc.so.4.8.0, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 )
    Undefined symbols for architecture x86_64:
      "cv::QRCodeDetector::QRCodeDetector()", referenced from:
          qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o
      "cv::Mat::Mat(int, int, int, void*, unsigned long)", referenced from:
          qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o
      "cv::Mat::~Mat()", referenced from:
          qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o
      "cv::noArray()", referenced from:
          qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o
      "cv::GraphicalCodeDetector::detectAndDecode(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&) const", referenced from:
          qrcodedec::decode_grey(unsigned char*, int, int) in qrcodedec.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    [64/119] Building CXX object QrGen/CMakeFiles/QrGen.dir/src/qrcodegen.cpp.o
    [65/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/MyDesigns_autogen/mocs_compilation.cpp.o
    [66/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/src/mydesigns.cpp.o
    [67/119] Building CXX object _deps/mydesigns-build/CMakeFiles/MyDesigns.dir/mydesigns_qmltyperegistrations.cpp.o
    ninja: build stopped: subcommand failed.
    Error: Process completed with exit code 1.
    

    I really do not know what is Xcode or the compiler used in MacOS.
    However, it seems I am not using the same compilers or SDK when building OpenCV as when building my Qt library.
    When configuring my Qt library I use qt-cmake tool, but maybe this sets some toolchain that is not set when using the normal cmake command to build OpenCV.

    Do you know what CMake variable I have to change to use the same SDK Qt uses when building OpenCV?

    Many thanks for your time.

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, the bytes 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 means that the .so files are prebuilt for Linux, not MacOS.

      MesrineM 1 Reply Last reply
      1
      • MesrineM Mesrine has marked this topic as solved on
      • hskoglundH hskoglund

        Hi, the bytes 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x03 means that the .so files are prebuilt for Linux, not MacOS.

        MesrineM Offline
        MesrineM Offline
        Mesrine
        wrote on last edited by
        #3

        @hskoglund
        Thanks, indeed I was downloading the the linux ones. I would never have realized that bug without this answer. How do you know this?

        1 Reply Last reply
        0
        • hskoglundH Offline
          hskoglundH Offline
          hskoglund
          wrote on last edited by
          #4

          Just google "unsupported file format 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x0" and select the first (StackOverflow) hit :-)

          MesrineM 1 Reply Last reply
          1
          • hskoglundH hskoglund

            Just google "unsupported file format 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x0" and select the first (StackOverflow) hit :-)

            MesrineM Offline
            MesrineM Offline
            Mesrine
            wrote on last edited by
            #5

            @hskoglund
            Actually in the linker message, one can see they are .so and Mac use .dylib.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved