MinGW can't find libraries when compiling static build for altcoin wallet.
-
Sorry for the newbie question. Just at the very end compiling jumps out with:
/mnt/mxe/usr/bin/i686-w64-mingw32.static-ld: cannot find -lsecp256k1
/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 1I guess the solution is very simple and I really appeciate any help!!! Thanks in advance!
I compile the src with:
#!/bin/bash
MXE_INCLUDE_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/include
MXE_LIB_PATH=/mnt/mxe/usr/i686-w64-mingw32.static/libi686-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.promake -f Makefile.Release
-
Hi and welcome to devnet,
You likely need to add a
LIBS += -L$${BOOST_LIB_PATH}
statement inzaca.pro
or at least where you are have the-lboost_system*
statements. -
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_SUFFIXresults in:
make: i686-w64-mingw32.static-g++: Command not found
make: *** [release/zaca-qt.exe] Error 127complete 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_)
-
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!!
-
Where are these files precisely located ?
Are you sure about their suffix ? -
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
-
@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.
-
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? -
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?This post is deleted! -
Might be a silly question, but are you sure you got boost built in the first place ?
-
I build boost with
make MXE_TARGETS="i686-w64-mingw32.static" boost
in the mxe directory:
/mnt/mxein 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" miniupnpcI 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
-
I build boost with
make MXE_TARGETS="i686-w64-mingw32.static" boost
in the mxe directory:
/mnt/mxein 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" miniupnpcI 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
@Madman66 Add a
-L/path/to/where/boost/libs/are
to your project and it will find the libs using-lboost_system
, etc. -
@ambershark thank you so much, but can you tell me where should I add
-L/path/to/where/boost/libs/are
excactly?
-
@ambershark thank you so much, but can you tell me where should I add
-L/path/to/where/boost/libs/are
excactly?
@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. ;)