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. How can add mkl static lib to the project?

How can add mkl static lib to the project?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 1.3k 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.
  • zhmhZ Offline
    zhmhZ Offline
    zhmh
    wrote on last edited by
    #1

    I want to attach the static Intel mkl (.a) library to my project so that it can be run on another computer without installing mkl

    I copy .a libs and include in my project directory and choose the libmkl_intel_lp64.a with external library

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/release/ -lmkl_intel_lp64
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/debug/ -lmkl_intel_lp64
    else:unix: LIBS += -L$$PWD/lib/ -lmkl_intel_lp64
    
    INCLUDEPATH += $$PWD/include
    DEPENDPATH += $$PWD/include
    
    win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/lib/release/libmkl_intel_lp64.a
    else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/lib/debug/libmkl_intel_lp64.a
    else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/lib/release/mkl_intel_lp64.lib
    else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/lib/debug/mkl_intel_lp64.lib
    else:unix: PRE_TARGETDEPS += $$PWD/lib/libmkl_intel_lp64.a
    

    But I get these errors when I build project:

    _malloc.c:-1: error: undefined reference to `mkl_serv_malloc'
    dftisetvalue.c:-1: error: undefined reference to `mkl_serv_strnlen_s'
    dfticreatedescriptor_d_md.c:-1: error: undefined reference to `mkl_dft_dfti_create_dcmd'
    .............
    

    How can add mkl static lib to the project?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you check that you are linking all the required libraries ?

      AFAIR mkl is not just one single library. Check which one provides that symbol.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      zhmhZ 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Did you check that you are linking all the required libraries ?

        AFAIR mkl is not just one single library. Check which one provides that symbol.

        zhmhZ Offline
        zhmhZ Offline
        zhmh
        wrote on last edited by zhmh
        #3

        @SGaist There is no error when I add .so to my project as below

        unix {
                INCLUDEPATH += /opt/intel/mkl/include
                LIBS += -L/opt/intel/mkl/lib/intel64 \
                -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \
                -L/opt/intel/lib/intel64 \
                -liomp5 -lpthread -dl -lm
            }
        
        else:win32{
                   INCLUDEPATH += /opt/intel/mkl/include
                   LIBS += -L/opt/intel/mkl/lib/intel64 \
                   -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \
                   -L/opt/intel/lib/intel64 \
                   -liomp5 -lpthread -dl -lm
             }
        

        how can change this to (.a) lib?
        (I have both .a and .so in lib file)

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          As a said earlier: check which of the mkl library provides the missing symbols and link to them as well.

          @zhmh said in How can add mkl static lib to the project?:

          mkl_serv_malloc

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • zhmhZ Offline
            zhmhZ Offline
            zhmh
            wrote on last edited by
            #5

            I found this advisor and used it for link MKL lib to my project and it worked fine!

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What did you use in the end ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              zhmhZ 1 Reply Last reply
              0
              • SGaistS SGaist

                What did you use in the end ?

                zhmhZ Offline
                zhmhZ Offline
                zhmh
                wrote on last edited by zhmh
                #7

                @SGaist

                This:

                win32:CONFIG(release, debug|release): LIBS +=  -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \
                $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
                else:win32:CONFIG(debug, debug|release): LIBS +=  -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \
                $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
                else:unix: LIBS +=  -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \
                $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
                
                INCLUDEPATH += $$PWD/../MKL/include
                DEPENDPATH += $$PWD/../MKL/include
                
                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