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. why I need add the same .a and .dylib file to my Mac qt project
Forum Updated to NodeBB v4.3 + New Features

why I need add the same .a and .dylib file to my Mac qt project

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 364 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.
  • P Offline
    P Offline
    Princein
    wrote on last edited by
    #1

    I developed a Mac qt project,in my project, I need use the boost_system sdk, so I add it use the 'add Library...' by right click my project, after that,in my .pro file,the qt help add information like this:
    macx: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/ -lboost_system

    INCLUDEPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
    DEPENDPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include

    macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a

    I use the 'otool -L' with my executable file which in my .app,it shows :

    otool -L /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor
    /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor:
    /usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)

    and my app work fine,
    In my understanding, I can use one of .a and .dylib,In my understanding,the .a and .dylib has same functions, .a is staic loaded,will became a part of executable file which in my .app,and .dylib is dynamic loaded, not be a part of executable file which in my .app,so I decide use the libboost_system.a only that my app can use in other Mac,so I change my .pro :

    macx: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a
    INCLUDEPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
    DEPENDPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
    macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a

    and I rebuild my project,it shows error:

    Undefined symbols for architecture x86_64:
    "boost::system::generic_category()", referenced from:
    boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in ObjMesh.o
    boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in ObjMesh.o
    boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in AttrController.o
    boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in AttrController.o
    boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in basemeshviewer.o
    boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in basemeshviewer.o
    boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in fueditor.o
    ...
    ld: symbol(s) not found for architecture x86_64

    it's seem the libboost_system.a depent on the libboost_system.dylib,libboost_system.a and libboost_system.dylib are not independent of each other, in my knowledge,the .a and .dylib file are independent of each other,Am I wrong?
    thanks a lot!

    jsulmJ 1 Reply Last reply
    0
    • P Princein

      I developed a Mac qt project,in my project, I need use the boost_system sdk, so I add it use the 'add Library...' by right click my project, after that,in my .pro file,the qt help add information like this:
      macx: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/ -lboost_system

      INCLUDEPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
      DEPENDPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include

      macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a

      I use the 'otool -L' with my executable file which in my .app,it shows :

      otool -L /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor
      /Users/lee/Desktop/VisualStudio/FUEditor/Build/FUEditor.app/Contents/MacOS/FUEditor:
      /usr/local/opt/boost/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)

      and my app work fine,
      In my understanding, I can use one of .a and .dylib,In my understanding,the .a and .dylib has same functions, .a is staic loaded,will became a part of executable file which in my .app,and .dylib is dynamic loaded, not be a part of executable file which in my .app,so I decide use the libboost_system.a only that my app can use in other Mac,so I change my .pro :

      macx: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a
      INCLUDEPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
      DEPENDPATH += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/include
      macx: PRE_TARGETDEPS += $$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a

      and I rebuild my project,it shows error:

      Undefined symbols for architecture x86_64:
      "boost::system::generic_category()", referenced from:
      boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in ObjMesh.o
      boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in ObjMesh.o
      boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in AttrController.o
      boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in AttrController.o
      boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in basemeshviewer.o
      boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in basemeshviewer.o
      boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in fueditor.o
      ...
      ld: symbol(s) not found for architecture x86_64

      it's seem the libboost_system.a depent on the libboost_system.dylib,libboost_system.a and libboost_system.dylib are not independent of each other, in my knowledge,the .a and .dylib file are independent of each other,Am I wrong?
      thanks a lot!

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Princein said in why I need add the same .a and .dylib file to my Mac qt project:

      macx: LIBS += -L$$PWD/../../../../../../usr/local/Cellar/boost/1.67.0_1/lib/libboost_system.a

      I don't know why both were added, but this line is wrong. If you add libs using -l you have to remove "lib" prefix. Another thing wrong with this line: -L specifies a directory where libs can be found not a specific lib.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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