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. I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.

I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 343 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.
  • S Offline
    S Offline
    senmx
    wrote on last edited by senmx
    #1

    I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.
    I use a simple c code to reference this library without any problem.
    Thanks!

    :-1: error: library not found for -ltestlib
    

    app.pro

    macx {
        LIBS += -L$$PWD/libs/macos/ -ltestlib
        INCLUDEPATH += $$PWD/libs/macos/
    }
    

    in $$PWD/libs/macos:

    -rw-r--r--  1 sen  admin   2.1M 10 14 16:14 testlib.dylib
    -rw-r--r--  1 sen  admin   1.6K 10 14 17:53 testlib.h
    
    jsulmJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @senmx said in I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.:

      LIBS += -L$$PWD/libs/macos/ -ltestlib

      The error message says that linker can't find the lib. Check the path you pass to -L (you can check compile log to see what path exactly is passed).
      I'm not sure how this is handled on MacOS, but on Linux linker expects this naming convention for libs: libLIBNAME.so. That means: the file name should start with "lib".

      S Offline
      S Offline
      senmx
      wrote on last edited by
      #4

      @jsulm It is indeed a lib naming problem. After changing to libtest.dylib, it should be like this:
      LIBS += -L$$PWD/libs/macos/ -ltest.

      1 Reply Last reply
      0
      • S senmx

        I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.
        I use a simple c code to reference this library without any problem.
        Thanks!

        :-1: error: library not found for -ltestlib
        

        app.pro

        macx {
            LIBS += -L$$PWD/libs/macos/ -ltestlib
            INCLUDEPATH += $$PWD/libs/macos/
        }
        

        in $$PWD/libs/macos:

        -rw-r--r--  1 sen  admin   2.1M 10 14 16:14 testlib.dylib
        -rw-r--r--  1 sen  admin   1.6K 10 14 17:53 testlib.h
        
        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @senmx said in I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.:

        LIBS += -L$$PWD/libs/macos/ -ltestlib

        The error message says that linker can't find the lib. Check the path you pass to -L (you can check compile log to see what path exactly is passed).
        I'm not sure how this is handled on MacOS, but on Linux linker expects this naming convention for libs: libLIBNAME.so. That means: the file name should start with "lib".

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

        M S 2 Replies Last reply
        2
        • jsulmJ jsulm

          @senmx said in I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.:

          LIBS += -L$$PWD/libs/macos/ -ltestlib

          The error message says that linker can't find the lib. Check the path you pass to -L (you can check compile log to see what path exactly is passed).
          I'm not sure how this is handled on MacOS, but on Linux linker expects this naming convention for libs: libLIBNAME.so. That means: the file name should start with "lib".

          M Offline
          M Offline
          mpergand
          wrote on last edited by mpergand
          #3

          @jsulm
          if i look at: qt-and-zip-files
          it should be:
          LIBS += -L$$PWD/libs/macos/ -ltest

          the .pro i use for asoundlib on linux:

          linux {
          
           INCLUDEPATH += $$MidiClient/Linux
                  
              HEADERS  += $$MidiClient/Linux/ALSA/MidiClientAPI.h 
              
              SOURCES  += $$MidiClient/Linux/ALSA/MidiClientAPI.cpp 
          
          	LIBS += -lasound
                  
          }
          
          and in the .h
          

          #ifndef LINUXMIDIAPI_H
          #define LINUXMIDIAPI_H

          #include "MidiAPI.h"
          #include <alsa/asoundlib.h>

          
          
          
          1 Reply Last reply
          0
          • jsulmJ jsulm

            @senmx said in I exported a testlib.dylib with golang, why can’t I reference this dynamic library under qt.:

            LIBS += -L$$PWD/libs/macos/ -ltestlib

            The error message says that linker can't find the lib. Check the path you pass to -L (you can check compile log to see what path exactly is passed).
            I'm not sure how this is handled on MacOS, but on Linux linker expects this naming convention for libs: libLIBNAME.so. That means: the file name should start with "lib".

            S Offline
            S Offline
            senmx
            wrote on last edited by
            #4

            @jsulm It is indeed a lib naming problem. After changing to libtest.dylib, it should be like this:
            LIBS += -L$$PWD/libs/macos/ -ltest.

            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