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. MinGW can't find libraries when compiling static build for altcoin wallet.
Forum Updated to NodeBB v4.3 + New Features

MinGW can't find libraries when compiling static build for altcoin wallet.

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 6.4k 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.
  • M Offline
    M Offline
    Madman66
    wrote on last edited by Madman66
    #3

    adding to zaca.pro:
    LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX -L$${BOOST_LIB_PATH}
    windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX

    results in:
    make: i686-w64-mingw32.static-g++: Command not found
    make: *** [release/zaca-qt.exe] Error 127

    complete lboost section in .pro file is:

    # Set libraries and includes at end, to use platform-defined defaults if not overridden
    INCLUDEPATH += $$BOOST_INCLUDE_PATH $$BDB_INCLUDE_PATH $$OPENSSL_INCLUDE_PATH $$QRENCODE_INCLUDE_PATH
    LIBS += $$join(BOOST_LIB_PATH,,-L,) $$join(BDB_LIB_PATH,,-L,) $$join(OPENSSL_LIB_PATH,,-L,) $$join(QRENCODE_LIB_PATH,,-L,)
    LIBS += -lssl -lcrypto -ldb_cxx$$BDB_LIB_SUFFIX
    
    # -lgdi32 has to happen after -lcrypto (see  #681)
    windows:LIBS += -lws2_32 -lshlwapi -lmswsock -lole32 -loleaut32 -luuid -lgdi32
    !windows: {
        LIBS += -lgmp
    } else {
        INCLUDEPATH += $$SECP256K1_INCLUDE_PATH
        LIBS += $$join(SECP256K1_LIB_PATH,,-L,) -lsecp256k1
    }
    LIBS += -lboost_system$$BOOST_LIB_SUFFIX -lboost_filesystem$$BOOST_LIB_SUFFIX -lboost_program_options$$BOOST_LIB_SUFFIX -lboost_thread$$BOOST_THREAD_LIB_SUFFIX
    windows:LIBS += -lboost_chrono$$BOOST_LIB_SUFFIX
    
    contains(RELEASE, 1) {
        !windows:!macx {
            # Linux: turn dynamic linking back on for c/c++ runtime libraries
            LIBS += -Wl,-Bdynamic
        }
    }
    
    !windows:!macx {
        DEFINES += LINUX
        LIBS += -lrt -ldl
    }
    
    system($$QMAKE_LRELEASE -silent $$_PRO_FILE_)
    
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      Madman66
      wrote on last edited by Madman66
      #4

      I just managed to fix the secp256k1 install, now this error is gone, but the others are still there:

      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_system-mgw53-mt-s-1_65_1
      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_filesystem-mgw53-mt-s-1_65_1
      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_program_options-mgw53-mt-s-1_65_1
      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_chrono-mgw53-mt-s-1_65_1
      collect2: error: ld returned 1 exit status
      make: *** [release/zaca-qt.exe] Error 1
      
      

      I would really appreciate any help with that!! Thanks!!

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

        Where are these files precisely located ?
        Are you sure about their suffix ?

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

        M 1 Reply Last reply
        1
        • SGaistS SGaist

          Where are these files precisely located ?
          Are you sure about their suffix ?

          M Offline
          M Offline
          Madman66
          wrote on last edited by
          #6

          Nowhere in the file system ...

          A 1 Reply Last reply
          0
          • M Offline
            M Offline
            Madman66
            wrote on last edited by Madman66
            #7

            someone said:
            "the libraries aren't being found by the build process, looks like you need to tend to your environment variable bindings."

            ... and I should check this example for the compiling bash - my system is Ubuntu 14.04 x64 by the way:

            #!/bin/bash
            
            # Working setup to cross-compile Windows binaries for Slimcoin hosted on a
            # Vagrant Ubuntu 16.04 VM using non-Canonical ppas for MXE and Qt5.7:
            # deb http://pkg.mxe.cc/repos/apt/debian wheezy main
            
            # Doesn't seem to pass the QT directives through, though. Tough.
            
            # Basic path bindings
            PATH=/usr/lib/mxe/usr/bin:$PATH
            MXE_PATH=/usr/lib/mxe
            MXE_INCLUDE_PATH=/usr/lib/mxe/usr/i686-w64-mingw32.static/include
            MXE_LIB_PATH=/usr/lib/mxe/usr/i686-w64-mingw32.static/lib
            # Belt and braces
            CXXFLAGS="-std=gnu++11 -march=i686"
            LDFLAGS="-march=i686"
            target="i686-w64-mingw32.static"
            
            # Particularise for cross-compiling
            export BOOST_LIB_SUFFIX=-mt
            export BOOST_THREAD_LIB_SUFFIX=_win32-mt
            export BOOST_INCLUDE_PATH=${MXE_INCLUDE_PATH}/boost
            export BOOST_LIB_PATH=${MXE_LIB_PATH}
            export OPENSSL_INCLUDE_PATH=${MXE_INCLUDE_PATH}/openssl
            export OPENSSL_LIB_PATH=${MXE_LIB_PATH}
            export BDB_INCLUDE_PATH=${MXE_INCLUDE_PATH}
            export BDB_LIB_PATH=${MXE_LIB_PATH}
            export MINIUPNPC_INCLUDE_PATH=${MXE_INCLUDE_PATH}
            export MINIUPNPC_LIB_PATH=${MXE_LIB_PATH}
            export QMAKE_LRELEASE=${MXE_PATH}/usr/${target}/qt5/bin/lrelease
            
            # Call qmake to create Makefile.[Release|Debug]
            ${target}-qmake-qt5 \
                MXE=1 \
                USE_O3=1 \
                USE_QRCODE=1 \
                FIRST_CLASS_MESSAGING=1 \
                RELEASE=1 \
                USE_UPNPC=1 \
                BOOST_LIB_SUFFIX=${BOOST_LIB_SUFFIX} \
                BOOST_THREAD_LIB_SUFFIX=${BOOST_THREAD_LIB_SUFFIX} \
                BOOST_INCLUDE_PATH=${BOOST_INCLUDE_PATH} \
                BOOST_LIB_PATH=${BOOST_LIB_PATH} \
                OPENSSL_INCLUDE_PATH=${OPENSSL_INCLUDE_PATH} \
                OPENSSL_LIB_PATH=${OPENSSL_LIB_PATH} \
                BDB_INCLUDE_PATH=${BDB_INCLUDE_PATH} \
                BDB_LIB_PATH=${BDB_LIB_PATH} \
                MINIUPNPC_INCLUDE_PATH=${MINIUPNPC_INCLUDE_PATH} \
                MINIUPNPC_LIB_PATH=${MINIUPNPC_LIB_PATH} \
                QMAKE_LRELEASE=${QMAKE_LRELEASE} slimcoin-qt.pro
            
            # Go for it. If successful, Windows binary will be written out to ./release/slimcoin-qt.exe
            make -f Makefile.Release CXXFLAGS="-DQT_GUI -DQT_NO_PRINTER -std=gnu++11 -march=i686" LDFLAGS="-march=i686"
            

            Someone knows what has to be changed in my bash file to make it running:

            #!/bin/bash
            MXE_INCLUDE_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/include
            MXE_LIB_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/lib
            
            i686-w64-mingw32.static-qmake-qt5 
            BOOST_LIB_SUFFIX=-mt 
            BOOST_THREAD_LIB_SUFFIX=_win32-mt 
            BOOST_INCLUDE_PATH=$MXE_INCLUDE_PATH/boost 
            BOOST_LIB_PATH=$MXE_LIB_PATH 
            OPENSSL_INCLUDE_PATH=$MXE_INCLUDE_PATH/openssl 
            OPENSSL_LIB_PATH=$MXE_LIB_PATH 
            BDB_INCLUDE_PATH=$MXE_INCLUDE_PATH 
            BDB_LIB_PATH=$MXE_LIB_PATH 
            MINIUPNPC_INCLUDE_PATH=$MXE_INCLUDE_PATH 
            MINIUPNPC_LIB_PATH=$MXE_LIB_PATH 
            QMAKE_LRELEASE=/mnt/mxe/usr/i686-w64-mingw32.static/qt5/bin/lrelease zaca.pro
            
            make -f Makefile.Release
            
            1 Reply Last reply
            0
            • M Madman66

              Nowhere in the file system ...

              A Offline
              A Offline
              ambershark
              wrote on last edited by
              #8

              @Madman66 said in MinGW can't find libraries when compiling static build for altcoin wallet.:

              Nowhere in the file system ...

              Well that's your problem then. Find out what the static boost libs are called on your file system and fix your build to use those. You will need to set BOOST_LIB_PATH properly. And make sure the names of the files match.

              1 Reply Last reply
              2
              • M Offline
                M Offline
                Madman66
                wrote on last edited by
                #9

                According to https://github.com/mxe/mxe/issues/1942 I really have to fix the library path with -L
                Would someone be so nice to explain me how to do that?

                A 1 Reply Last reply
                0
                • M Madman66

                  According to https://github.com/mxe/mxe/issues/1942 I really have to fix the library path with -L
                  Would someone be so nice to explain me how to do that?

                  A Offline
                  A Offline
                  ambershark
                  wrote on last edited by
                  #10
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    Might be a silly question, but are you sure you got boost built in the first place ?

                    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
                    1
                    • M Offline
                      M Offline
                      Madman66
                      wrote on last edited by Madman66
                      #12

                      I build boost with
                      make MXE_TARGETS="i686-w64-mingw32.static" boost
                      in the mxe directory:
                      /mnt/mxe

                      in this order:
                      make MXE_TARGETS="i686-w64-mingw32.static" boost
                      make MXE_TARGETS="i686-w64-mingw32.static" gettext
                      make MXE_TARGETS="i686-w64-mingw32.static" qttools
                      make MXE_TARGETS="i686-w64-mingw32.static" qt
                      make MXE_TARGETS="i686-w64-mingw32.static" miniupnpc

                      I tried diffent sources for testing now, it always jumps off with -lboost ... so boost may actually be the problem. Any idea how I can fix that? See tail of latest try:

                      [ ............ ] /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool -lrpcrt4 /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5EventDispatcherSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5FontDatabaseSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5ThemeSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5AccessibilitySupport.a -L/mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqgif.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqjpeg.a -ljpeg /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Widgets.a -luxtheme -ldwmapi /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lm -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lpng16 -lharfbuzz_too -lfreetype_too -lglib-2.0 -lshlwapi -lpcre -lintl -liconv /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm -lz -lpcre2-16 build/bitcoin-qt_res.o
                      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_system
                      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_filesystem
                      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_program_options
                      /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_chrono
                      collect2: error: ld returned 1 exit status
                      make: *** [release/librexcoin-qt.exe] Error 1
                      
                      
                      A 1 Reply Last reply
                      0
                      • M Madman66

                        I build boost with
                        make MXE_TARGETS="i686-w64-mingw32.static" boost
                        in the mxe directory:
                        /mnt/mxe

                        in this order:
                        make MXE_TARGETS="i686-w64-mingw32.static" boost
                        make MXE_TARGETS="i686-w64-mingw32.static" gettext
                        make MXE_TARGETS="i686-w64-mingw32.static" qttools
                        make MXE_TARGETS="i686-w64-mingw32.static" qt
                        make MXE_TARGETS="i686-w64-mingw32.static" miniupnpc

                        I tried diffent sources for testing now, it always jumps off with -lboost ... so boost may actually be the problem. Any idea how I can fix that? See tail of latest try:

                        [ ............ ] /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool -lrpcrt4 /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5EventDispatcherSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5FontDatabaseSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5ThemeSupport.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5AccessibilitySupport.a -L/mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqgif.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /mnt/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqjpeg.a -ljpeg /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Widgets.a -luxtheme -ldwmapi /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lm -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lpng16 -lharfbuzz_too -lfreetype_too -lglib-2.0 -lshlwapi -lpcre -lintl -liconv /mnt/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm -lz -lpcre2-16 build/bitcoin-qt_res.o
                        /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_system
                        /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_filesystem
                        /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_program_options
                        /mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lboost_chrono
                        collect2: error: ld returned 1 exit status
                        make: *** [release/librexcoin-qt.exe] Error 1
                        
                        
                        A Offline
                        A Offline
                        ambershark
                        wrote on last edited by
                        #13

                        @Madman66 Add a -L/path/to/where/boost/libs/are to your project and it will find the libs using -lboost_system, etc.

                        1 Reply Last reply
                        1
                        • M Offline
                          M Offline
                          Madman66
                          wrote on last edited by
                          #14

                          @ambershark thank you so much, but can you tell me where should I add

                          -L/path/to/where/boost/libs/are
                          

                          excactly?

                          A 1 Reply Last reply
                          0
                          • M Madman66

                            @ambershark thank you so much, but can you tell me where should I add

                            -L/path/to/where/boost/libs/are
                            

                            excactly?

                            A Offline
                            A Offline
                            ambershark
                            wrote on last edited by
                            #15

                            @Madman66 It depends ... what build system are you using? autotools? qmake? cmake? command line?

                            Nevermind I looked above and see a .pro file so that's qmake.. Just add it to the LIBS line, i.e.

                            LIBS += -L/path/to/boost

                            It looks like it is trying to use the variable you set in your script:
                            LIBS += $$join(BOOST_LIB_PATH,,-L,). So you could always just set your BOOST_LIB_PATH properly. I already said all that in a previous post though. So I'm assuming that it didn't work properly. ;)

                            1 Reply Last reply
                            2

                            • Login

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