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 to include library with it's own dependencies
Forum Updated to NodeBB v4.3 + New Features

How to include library with it's own dependencies

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.5k Views 2 Watching
  • 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.
  • YosemiteY Offline
    YosemiteY Offline
    Yosemite
    wrote on last edited by
    #1

    I am trying to use the Gamma synthesis library in my Qt project (http://mat.ucsb.edu/gamma/). It has a dependency on libsndfile and portaudio. I am on Windows 10 and have built libsndfile and portaudio using msys the usual way with:

    ./configure
    make
    make install

    I then built Gamma in msys as well, no errors, although it does generate a .a file rather than a .dll.a. When I include the gamma lib in my Qt project and try and use the Gamma classes that depend on libsndfile or portaudio I get undefined port audio and libsndfile references and: "bad reloc address 0x5e" errors. I can include classes that do not depend on libsndfile or portaudio, which leads me to believe that the library is otherwise correctly built.

    Have I not provided the dependencies correctly? Could the Gamma library actually be trying to load these libraries at runtime? How could I check?

    Thanks!

    kshegunovK 1 Reply Last reply
    0
    • YosemiteY Yosemite

      I am trying to use the Gamma synthesis library in my Qt project (http://mat.ucsb.edu/gamma/). It has a dependency on libsndfile and portaudio. I am on Windows 10 and have built libsndfile and portaudio using msys the usual way with:

      ./configure
      make
      make install

      I then built Gamma in msys as well, no errors, although it does generate a .a file rather than a .dll.a. When I include the gamma lib in my Qt project and try and use the Gamma classes that depend on libsndfile or portaudio I get undefined port audio and libsndfile references and: "bad reloc address 0x5e" errors. I can include classes that do not depend on libsndfile or portaudio, which leads me to believe that the library is otherwise correctly built.

      Have I not provided the dependencies correctly? Could the Gamma library actually be trying to load these libraries at runtime? How could I check?

      Thanks!

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2

      @Yosemite
      Hello,

      I then built Gamma in msys as well, no errors, although it does generate a .a file rather than a .dll.a.

      Judging from this, you seem to statically link the Gamma library in your project, is this correct? If so, are you adding the necessary linker flags to link against the Gamma's dependencies in your application? (Here's a discussion as to why you need to do this).

      Kind regards.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • YosemiteY Offline
        YosemiteY Offline
        Yosemite
        wrote on last edited by
        #3

        That thread was incredibly informative, many thanks! I actually had tried linking portaudio, but decided to take a look at what exactly I was including . I had linked to -llibportaudio, in the portaudio/lib directory (which contains both libportaudio.dll.a and libportaudio.a). I just noticed that in the portaudio/bin directory there was libportaudio-2.dll. Linking to that resolved the errors!

        If someone has the time to explain what the .dll.a and .a files are I would be really curious. Are those intermediate files created when I built the library, or something the .dll actually uses? I am assuming the former, because the project still builds when I remove them.

        kshegunovK 1 Reply Last reply
        0
        • YosemiteY Yosemite

          That thread was incredibly informative, many thanks! I actually had tried linking portaudio, but decided to take a look at what exactly I was including . I had linked to -llibportaudio, in the portaudio/lib directory (which contains both libportaudio.dll.a and libportaudio.a). I just noticed that in the portaudio/bin directory there was libportaudio-2.dll. Linking to that resolved the errors!

          If someone has the time to explain what the .dll.a and .a files are I would be really curious. Are those intermediate files created when I built the library, or something the .dll actually uses? I am assuming the former, because the project still builds when I remove them.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @Yosemite
          The *.a file(s) is a static build of the said library. Usually on windows they're with extension *.lib, but sometimes when the project is ported from *nix to windows, the *.a extension is used (so it's compatible with *nix).

          Kind regards.

          Read and abide by the Qt Code of Conduct

          YosemiteY 1 Reply Last reply
          1
          • kshegunovK kshegunov

            @Yosemite
            The *.a file(s) is a static build of the said library. Usually on windows they're with extension *.lib, but sometimes when the project is ported from *nix to windows, the *.a extension is used (so it's compatible with *nix).

            Kind regards.

            YosemiteY Offline
            YosemiteY Offline
            Yosemite
            wrote on last edited by
            #5

            @kshegunov
            Sorry, there was a typo in my last post. The two files in portaudio/lib are libportaudio.dll.a and libportaudio.la (not .a).

            If I understand correctly the .la file is a libtool helper file. The .dll.a file appears to be a static import library, containing symbols exported from the library, which MinGW can link to in place of a .dll.

            http://stackoverflow.com/questions/15852677/static-and-dynamic-shared-linking-with-mingw

            I think I've learned enough to know that I do not need to worry about these files in Qt - my original problem was caused by mistaking them for the library.

            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