Skip to content

Commit

Permalink
Use /usr/local/x86_64-w64-mingw32 path for windows crossbuilds and up…
Browse files Browse the repository at this point in the history
…dated instructions for setting up a build environment.
  • Loading branch information
CodeShark committed Sep 9, 2017
1 parent 653eb7f commit 8e5f130
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build-all.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fi
# Set target platform parameters # Set target platform parameters
if [ $mingw64 ] if [ $mingw64 ]
then then
if [[ -z "$QMAKE_PATH" ]]; then QMAKE_PATH="/usr/x86_64-w64-mingw32/host/bin/"; fi if [[ -z "$QMAKE_PATH" ]]; then QMAKE_PATH="/usr/local/x86_64-w64-mingw32/host/bin/"; fi
SPEC="-spec win32-g++" SPEC="-spec win32-g++"
fi fi


Expand Down
7 changes: 3 additions & 4 deletions deps/mk/os.mk
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ ifeq ($(OS), linux)
else ifeq ($(OS), mingw64) else ifeq ($(OS), mingw64)
CXX = x86_64-w64-mingw32-g++ CXX = x86_64-w64-mingw32-g++
CC = x86_64-w64-mingw32-gcc CC = x86_64-w64-mingw32-gcc
CXX_FLAGS += -Wno-unknown-pragmas -Wno-strict-aliasing -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden -DBOOST_SYSTEM_NOEXCEPT="" CXX_FLAGS += -Wno-unknown-pragmas -Wno-strict-aliasing -std=c++0x -fvisibility=hidden -fvisibility-inlines-hidden -DBOOST_SYSTEM_NOEXCEPT="" -I/usr/local/x86_64-w64-mingw32/include -L/usr/local/x86_64-w64-mingw32/lib
ARCHIVER = x86_64-w64-mingw32-ar ARCHIVER = x86_64-w64-mingw32-ar
EXE_EXT = .exe EXE_EXT = .exe


LOCAL_SYSROOT = /usr/x86_64-w64-mingw32/local LOCAL_SYSROOT = /usr/local/x86_64-w64-mingw32/local
GLOBAL_SYSROOT = /usr/x86_64-w64-mingw32 GLOBAL_SYSROOT = /usr/local/x86_64-w64-mingw32


PLATFORM_LIBS += \ PLATFORM_LIBS += \
-static-libgcc -static-libstdc++ \ -static-libgcc -static-libstdc++ \
Expand Down Expand Up @@ -67,4 +67,3 @@ endif
ifneq ($(wildcard $(SYSROOT)/lib),) ifneq ($(wildcard $(SYSROOT)/lib),)
LIB_PATH += -L$(SYSROOT)/lib LIB_PATH += -L$(SYSROOT)/lib
endif endif

24 changes: 12 additions & 12 deletions docs/mingw-w64-build-environment
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$ ./bootstrap.sh --without-icu $ ./bootstrap.sh --without-icu
$ echo "using gcc : mingw32 : x86_64-w64-mingw32-g++ : <rc>x86_64-w64-mingw32-windres <archiver>x86_64-w64-mingw32-ar <ranlib>x86_64-w64-mingw32-ranlib ;" > user-config.jam $ echo "using gcc : mingw32 : x86_64-w64-mingw32-g++ : <rc>x86_64-w64-mingw32-windres <archiver>x86_64-w64-mingw32-ar <ranlib>x86_64-w64-mingw32-ranlib ;" > user-config.jam
$ sudo ./b2 toolset=gcc address-model=64 target-os=windows variant=release threading=multi threadapi=win32 \ $ sudo ./b2 toolset=gcc address-model=64 target-os=windows variant=release threading=multi threadapi=win32 \
link=static runtime-link=static --prefix=/usr/x86_64-w64-mingw32 --user-config=user-config.jam \ link=static runtime-link=static --prefix=/usr/local/x86_64-w64-mingw32 --user-config=user-config.jam \
--without-mpi --without-python -sNO_BZIP2=1 --layout=tagged install --without-mpi --without-python -sNO_BZIP2=1 --layout=tagged install
$ cd $ cd


Expand All @@ -29,7 +29,7 @@
~/qt-everywhere-opensource-src-5.7.1/qtbase/src/gui/kernel/qplatformsessionmanager.h \ ~/qt-everywhere-opensource-src-5.7.1/qtbase/src/gui/kernel/qplatformsessionmanager.h \
~/qt-everywhere-opensource-src-5.7.1/qtbase/src/gui/kernel/qsessionmanager.h ~/qt-everywhere-opensource-src-5.7.1/qtbase/src/gui/kernel/qsessionmanager.h


$ export INSTALLPREFIX=/usr/x86_64-w64-mingw32 $ export INSTALLPREFIX=/usr/local/x86_64-w64-mingw32
$ mkdir qt5-win64-build $ mkdir qt5-win64-build
$ cd qt5-win64-build $ cd qt5-win64-build
$ ../qt-everywhere-opensource-src-5.7.1/configure -prefix $INSTALLPREFIX -hostprefix $INSTALLPREFIX/host -plugindir $INSTALLPREFIX/plugins \ $ ../qt-everywhere-opensource-src-5.7.1/configure -prefix $INSTALLPREFIX -hostprefix $INSTALLPREFIX/host -plugindir $INSTALLPREFIX/plugins \
Expand All @@ -43,19 +43,19 @@
(-Wno-strict-overflow -Wno-strict-aliasing -Wno-unused-parameters to suppress warnings) (-Wno-strict-overflow -Wno-strict-aliasing -Wno-unused-parameters to suppress warnings)


Patch Qt5 to work with cmake for static build. Windows uses library naming convention name.lib, MinGW uses libname.a. So we must replace the names: Patch Qt5 to work with cmake for static build. Windows uses library naming convention name.lib, MinGW uses libname.a. So we must replace the names:
$ cd /usr/x86_64-w64-mingw32/lib/cmake $ cd /usr/local/x86_64-w64-mingw32/lib/cmake
$ sudo sed -i -e 's/\/\([^\.]*\)\.lib/\/lib\1\.a/g' $(find * -type f) $ sudo sed -i -e 's/\/\([^\.]*\)\.lib/\/lib\1\.a/g' $(find * -type f)
$ cd $ cd


You will need to set the path to find the appropriate qmake, i.e.: You will need to set the path to find the appropriate qmake, i.e.:
$ export PATH=/usr/x86_64-w64-mingw32/host/bin:$PATH $ export PATH=/usr/local/x86_64-w64-mingw32/host/bin:$PATH


5) Build OpenSSL for windows (version 1.1.x doesn't work) 5) Build OpenSSL for windows (version 1.1.x doesn't work)
$ wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz $ wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
$ tar -xzvf openssl-1.0.2k.tar.gz $ tar -xzvf openssl-1.0.2k.tar.gz
$ cp -R openssl-1.0.2k openssl-win64-build $ cp -R openssl-1.0.2k openssl-win64-build
$ cd openssl-win64-build $ cd openssl-win64-build
$ CROSS_COMPILE="x86_64-w64-mingw32-" ./Configure mingw64 no-asm no-shared --prefix=/usr/x86_64-w64-mingw32 $ CROSS_COMPILE="x86_64-w64-mingw32-" ./Configure mingw64 no-asm no-shared --prefix=/usr/local/x86_64-w64-mingw32
$ make $ make
$ sudo make install_sw $ sudo make install_sw
$ cd $ cd
Expand All @@ -67,7 +67,7 @@
$ tar -xzvf sqlite-autoconf-3180000.tar.gz $ tar -xzvf sqlite-autoconf-3180000.tar.gz
$ mkdir sqlite-win64-build $ mkdir sqlite-win64-build
$ cd sqlite-win64-build $ cd sqlite-win64-build
$ ../sqlite-autoconf-3180000/configure --host=x86_64-w64-mingw32 --target=windows --prefix=/usr/x86_64-w64-mingw32 CFLAGS=-DSQLITE_ENABLE_UNLOCK_NOTIFY $ ../sqlite-autoconf-3180000/configure --host=x86_64-w64-mingw32 --target=windows --prefix=/usr/local/x86_64-w64-mingw32 CFLAGS=-DSQLITE_ENABLE_UNLOCK_NOTIFY
$ make $ make
$ sudo make install $ sudo make install
$ cd $ cd
Expand Down Expand Up @@ -101,8 +101,8 @@
$ tar -xjvf libodb-2.4.0.tar.bz2 $ tar -xjvf libodb-2.4.0.tar.bz2
$ mkdir libodb-win64-build $ mkdir libodb-win64-build
$ cd libodb-win64-build $ cd libodb-win64-build
$ ../libodb-2.4.0/configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 --enable-threads=win32 \ $ ../libodb-2.4.0/configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32 --enable-threads=win32 \
CPPFLAGS="-I/usr/x86_64-w64-mingw32/include -DLIBODB_STATIC_LIB" --disable-shared LDFLAGS=-L/usr/x86_64-w64-mingw32/lib CPPFLAGS="-I/usr/local/x86_64-w64-mingw32/include -DLIBODB_STATIC_LIB" --disable-shared LDFLAGS=-L/usr/local/x86_64-w64-mingw32/lib
$ make $ make
$ sudo make install $ sudo make install
$ cd .. $ cd ..
Expand All @@ -112,15 +112,15 @@
$ tar -xjvf libodb-sqlite-2.4.0.tar.bz2 $ tar -xjvf libodb-sqlite-2.4.0.tar.bz2
$ mkdir libodb-sqlite-win64-build $ mkdir libodb-sqlite-win64-build
$ cd libodb-sqlite-win64-build $ cd libodb-sqlite-win64-build
$ ../libodb-sqlite-2.4.0/configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 --enable-threads=win32 \ $ ../libodb-sqlite-2.4.0/configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32 --enable-threads=win32 \
CPPFLAGS="-I/usr/x86_64-w64-mingw32/include -DLIBODB_STATIC_LIB" --disable-shared LDFLAGS=-L/usr/x86_64-w64-mingw32/lib CPPFLAGS="-I/usr/local/x86_64-w64-mingw32/include -DLIBODB_STATIC_LIB" --disable-shared LDFLAGS=-L/usr/local/x86_64-w64-mingw32/lib
$ make $ make
$ sudo make install $ sudo make install
$ cd $ cd


10) ODB will, by default, use the linux headers. We want this behavior for system libraries, but we want to override it for 10) ODB will, by default, use the linux headers. We want this behavior for system libraries, but we want to override it for
nonsystem libraries. To do this, we create symlinks. nonsystem libraries. To do this, we create symlinks.
$ cd /usr/x86_64-w64-mingw32 $ cd /usr/local/x86_64-w64-mingw32
$ sudo mkdir -p local/include $ sudo mkdir -p local/include
$ cd local/include $ cd local/include
$ sudo ln -s ../../include/odb/ odb $ sudo ln -s ../../include/odb/ odb
Expand All @@ -135,7 +135,7 @@


12) Build qrencode QR Code C library (libqrencode) for windows 12) Build qrencode QR Code C library (libqrencode) for windows
$ cd mSIGNA/deps/qrencode-3.4.3 $ cd mSIGNA/deps/qrencode-3.4.3
$ ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 --without-tools --enable-static --disable-shared $ ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/x86_64-w64-mingw32 --without-tools --enable-static --disable-shared
$ make $ make
$ sudo make install $ sudo make install
$ cd $ cd

0 comments on commit 8e5f130

Please sign in to comment.