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. create Staticlib
Forum Updated to NodeBB v4.3 + New Features

create Staticlib

Scheduled Pinned Locked Moved Solved General and Desktop
15 Posts 3 Posters 1.9k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    Hi,

    Because you are likely "leaking" symbols of libssh through your library so yes, you have to link to the dependencies of your library in that kind of case.

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

    ODБOïO 1 Reply Last reply
    3
    • SGaistS SGaist

      Hi,

      Because you are likely "leaking" symbols of libssh through your library so yes, you have to link to the dependencies of your library in that kind of case.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by ODБOï
      #6

      @SGaist said in create Staticlib:
      thank you fo the precision, may i ask how to give symbols of libssh to my library correctly, so the project that use my lib dont need to link to libssh also ?

      for the moment my libs .pro file looks like this :

      QT       += network
      QT       -= gui
      TARGET = CN16K_SFTP
      TEMPLATE = lib
      CONFIG += staticlib
      
      DEFINES += QT_DEPRECATED_WARNINGS
      LIBS += -L$$PWD -lssh
      
      SOURCES += \
              cn16k_sftp.cpp
      
      HEADERS += \
              cn16k_sftp.h \
          legacy.h \
          libssh.h \
          libsshpp.hpp \
          server.h \
          sftp.h \
          ssh2.h
      unix {
          target.path = /usr/lib
          INSTALLS += target
      }
      
      

      and in the project where i use my static Library i do this :

      LIBS += -L../CN16K_SFTP/build/release -llibCN16K_SFTP
      LIBS += -L../LIB/SSH_Lib/LSSH_0_8_0 -lssh // how to avoid this line 
      
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #7

        Don't use any of OpenSSL symbols in your header file. If needed use the PIMPLE idiom.

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

        ODБOïO 1 Reply Last reply
        1
        • SGaistS SGaist

          Don't use any of OpenSSL symbols in your header file. If needed use the PIMPLE idiom.

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #8

          @SGaist could you please explain little bit, i don't use anything directly related to openSSL can't understand what do you mean sorry.

          In my static lib projects .pro i dont set this,

          INCLUDEPATH += ../LIB/SSH_Lib/SSH
          

          insted, i import the files in the project folder and do :

          HEADERS += \
                  cn16k_sftp.h \
              legacy.h \
              libssh.h \
              libsshpp.hpp \
              server.h \
              sftp.h \
              ssh2.h
          

          Is this related to what you told me ?
          Thank you

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

            Since I don't know what your code looks like, I can't answer.

            What are all these files ?

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

            ODБOïO 1 Reply Last reply
            0
            • SGaistS SGaist

              Since I don't know what your code looks like, I can't answer.

              What are all these files ?

              ODБOïO Offline
              ODБOïO Offline
              ODБOï
              wrote on last edited by
              #10

              @SGaist this are libssh source files, i imported this files in the project path insted of doing
              INCLUDEPATH += path/to/sources

              legacy.h
              libssh.h
              libsshpp.hpp
              server.h
              sftp.h
              ssh2.h

              and this one is the QObject derived class where i use libssh ( my lib )
              cn16k_sftp.h \

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

                Well, that's not the proper way of using an external library. You shouldn't copy over files like that.

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

                ODБOïO 1 Reply Last reply
                1
                • SGaistS SGaist

                  Well, that's not the proper way of using an external library. You shouldn't copy over files like that.

                  ODБOïO Offline
                  ODБOïO Offline
                  ODБOï
                  wrote on last edited by
                  #12

                  @SGaist do i have to set the
                  INCLUDEPATH += path/to/sources
                  instead of copying the files ?

                  Thnank you

                  ODБOïO 1 Reply Last reply
                  0
                  • ODБOïO ODБOï

                    @SGaist do i have to set the
                    INCLUDEPATH += path/to/sources
                    instead of copying the files ?

                    Thnank you

                    ODБOïO Offline
                    ODБOïO Offline
                    ODБOï
                    wrote on last edited by
                    #13

                    If i delete libssh source files from my Static library and instead do
                    INCLUDEPATH += ../path/to/libssh/sources

                    Then in the project where i use my Static Lib i have to set
                    INCLUDEPATH += ../path/to/libssh/sources also

                    K 1 Reply Last reply
                    0
                    • ODБOïO ODБOï

                      If i delete libssh source files from my Static library and instead do
                      INCLUDEPATH += ../path/to/libssh/sources

                      Then in the project where i use my Static Lib i have to set
                      INCLUDEPATH += ../path/to/libssh/sources also

                      K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #14

                      @LeLev

                      If you consider it from a logical point of view, one will have different folders for different libraries. For smaller libraries especially when you are starting your own library this is not obvious from the beginning, but you will notice with time.
                      For third party I would consider it as mandatory, because how would you be able to change to another version. It will be a nightmare when you have mixed the headers with your own or other third party libs.
                      This explains also why third party libraries have typically certain folder structure. There is often a bin or lib folder holding the library versions. There is a src or inc(lude) folder holding the headers as required. Names might vary, but the structure is typical.

                      The conclusion of these philosophic excusions is that you better keep everything separated because you may want to change to a new version with very little work. The solution is to use somewhere path settings to point to the proper folders. You find this in different flavors of "make" applications.

                      For qmake it would be INCLUDEPATH and LIBS. For use of a newer version of a library for tests you simply change the path entries there. If something is not to your liking you simply change back or restore the old .pro file.

                      @LeLev said in create Staticlib:

                      If i delete libssh source files from my Static library and instead do
                      INCLUDEPATH += ../path/to/libssh/sources

                      Then in the project where i use my Static Lib i have to set
                      INCLUDEPATH += ../path/to/libssh/sources also

                      Yes, under the assumnption that the path is pointing to the proper includes.

                      Vote the answer(s) that helped you to solve your issue(s)

                      1 Reply Last reply
                      2
                      • ODБOïO Offline
                        ODБOïO Offline
                        ODБOï
                        wrote on last edited by
                        #15

                        @koahnig thank you very much.
                        I really appreciate the explanations

                        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