Commit 1b5d2105 authored by lbrynaut's avatar lbrynaut Committed by Brannon King
Browse files

Fix Windows ICU build by making sure the cross compiled ICU exists before building boost.

Add some additional logging during ICU configuration and build process.

Resolve ICU on windows link issues.

Add /tmp/icu_install (cross-compile staging build) to the travis
directory cache for future windows builds.
parent 0c908ca1
......@@ -20,6 +20,7 @@ cache:
directories:
- build
- depends/built
- /tmp/icu_install
git:
depth: false
before_install:
......
......@@ -744,12 +744,18 @@ fi
fi
AS_IF([test "x$ICU_PREFIX" != xauto], [
ICU_CPPFLAGS="-I$ICU_PREFIX/include",
ICU_LIBS="-L$ICU_PREFIX/lib -licui18n -licuuc -licudata -dl"
ICU_CPPFLAGS="-I$ICU_PREFIX/include"
ICU_LIBS="-L$ICU_PREFIX/lib -licui18n -licuuc -licudata -ldl"
PKG_CONFIG_PATH="${ICU_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
export PKG_CONFIG_PATH
])
AC_MSG_WARN([Using ICU_CPPFLAGS $ICU_CPPFLAGS])
AC_MSG_WARN([Using ICU_LIBS $ICU_LIBS])
AC_MSG_NOTICE([Using ICU_CPPFLAGS $ICU_CPPFLAGS])
AC_MSG_NOTICE([Using ICU_LIBS $ICU_LIBS])
CPPFLAGS="$CPPFLAGS $ICU_CPPFLAGS"
ORIG_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $ICU_LIBS"
if test x$use_pkgconfig = xyes; then
......@@ -787,9 +793,17 @@ if test x$use_pkgconfig = xyes; then
]
)
else # compiling on Windows:
AC_MSG_NOTICE([Configuring for Windows])
CPPFLAGS="$CPPFLAGS -Ii686-w64-mingw32/include"
LDFLAGS="$LDFLAGS -Li686-w64-mingw32/lib"
AC_CHECK_HEADER([unicode/errorcode.h],,AC_MSG_ERROR(libicu headers missing))
AC_CHECK_LIB([icudata], [main], ICU_LIBS="-L$ICU_PREFIX/lib -licui18n -licuuc -licudata -dl",
AC_CHECK_LIB([icu18n], [main],ICU_LIBS=$ICU_LIBS, ICU_LIBS="-L$ICU_PREFIX/lib -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"))
AC_CHECK_LIB([icudata], [main], ICU_LIBS=$ICU_LIBS,
AC_CHECK_LIB([icu18n], [main],ICU_LIBS=$ICU_LIBS, ICU_LIBS="-L$ICU_PREFIX/lib -lsicuio -lsicuin -lsiculx -lsicule -lsicuuc -lsicudt"))
AC_MSG_NOTICE([Using ICU_LIBS=$ICU_LIBS])
LDFLAGS="$ORIG_LDFLAGS $ICU_LIBS"
AC_CHECK_LIB([sicudt], [main], ICU_LIBS=$ICU_LIBS, AC_MSG_ERROR(icu libraries missing))
AC_CHECK_HEADER([openssl/crypto.h],,AC_MSG_ERROR(libcrypto headers missing))
AC_CHECK_LIB([crypto], [main],CRYPTO_LIBS=-lcrypto, AC_MSG_ERROR(libcrypto missing))
......@@ -868,7 +882,7 @@ CXXFLAGS_TEMP="$CXXFLAGS"
LIBS_TEMP="$LIBS"
CXXFLAGS="$CXXFLAGS $CPPFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS"
LIBS="$LIBS $SSL_LIBS $CRYPTO_LIBS"
#AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)
AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)
CXXFLAGS="$CXXFLAGS_TEMP"
LIBS="$LIBS_TEMP"
......
......@@ -6,6 +6,8 @@ SDK_PATH ?= $(BASEDIR)/SDKs
NO_QT ?=
NO_WALLET ?=
NO_UPNP ?=
ICU_DIR ?=
ICU_ONLY ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
BUILD = $(shell ./config.guess)
......@@ -73,7 +75,11 @@ include hosts/$(host_os).mk
include hosts/default.mk
include builders/$(build_os).mk
include builders/default.mk
ifeq ($(ICU_ONLY),)
include packages/packages.mk
else
include packages/packages.icu.mk
endif
build_id_string:=$(BUILD_ID_SALT)
build_id_string+=$(shell $(build_CC) --version 2>/dev/null)
......@@ -113,7 +119,6 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
$(AT)mkdir -p $(@D)
$(AT)echo copying packages: $^
$(AT)echo to: $(@D)
$(AT)echo "$(@D)" > /tmp/icu_install_dir
$(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
$(AT)touch $@
......@@ -133,6 +138,7 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
-e 's|@no_qt@|$(NO_QT)|' \
-e 's|@ICU_DIR@|$(ICU_DIR)|' \
-e 's|@no_wallet@|$(NO_WALLET)|' \
-e 's|@no_upnp@|$(NO_UPNP)|' \
-e 's|@debug@|$(DEBUG)|' \
......
......@@ -21,6 +21,7 @@ if test -z $with_comparison_tool; then
with_comparison_tool=$prefix/native/share/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar
fi
with_icu_dir=@icu_dir@
if test -z $enable_wallet && test -n "@no_wallet@"; then
enable_wallet=no
......@@ -99,3 +100,6 @@ fi
if test -n "@LDFLAGS@"; then
LDFLAGS="@LDFLAGS@ $LDFLAGS"
fi
if test -n "@ICU_DIR@"; then
ICU_DIR="@ICU_DIR@"
fi
......@@ -9,8 +9,8 @@ define $(package)_set_vars
$(package)_config_opts_release=variant=release
$(package)_config_opts_debug=variant=debug
$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam boost.locale.iconv=off boost.locale.posix=off
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 -sICU_PATH=$(shell cat /tmp/icu_install_dir)
$(package)_config_opts+=-sICU_LINK="-L$(shell cat /tmp/icu_install_dir) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"
$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1 -sICU_PATH=$(ICU_DIR)
$(package)_config_opts+=-sICU_LINK=-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc
$(package)_config_opts_linux=threadapi=pthread runtime-link=shared
$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared
$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static
......@@ -26,12 +26,12 @@ $(package)_cxxflags=-fvisibility=hidden
$(package)_cxxflags_linux=-fPIC
$(package)_config_env+=BOOST_ICU_ICONV="off"
$(package)_config_env+=BOOST_ICU_POSIX="off"
$(package)_config_env+=ICU_PREFIX=$(shell cat /tmp/icu_install_dir)
$(package)_config_env+=BOOST_ICU_LIBS="-L$(shell cat /tmp/icu_install_dir) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"
$(package)_config_env+=ICU_PREFIX=$(ICU_DIR)
$(package)_config_env+=BOOST_ICU_LIBS="-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"
$(package)_build_env+=BOOST_ICU_ICONV="off"
$(package)_build_env+=BOOST_ICU_POSIX="off"
$(package)_build_env+=ICU_PREFIX=$(shell cat /tmp/icu_install_dir)
$(package)_build_env+=BOOST_ICU_LIBS="-L$(shell cat /tmp/icu_install_dir) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"
$(package)_build_env+=ICU_PREFIX=$(ICU_DIR)
$(package)_build_env+=BOOST_ICU_LIBS="-L$(ICU_DIR) -lsicudt -lsicuin -lsicuio -lsicule -lsiculx -lsicutest -lsicutu -lsicuuc"
endef
define $(package)_preprocess_cmds
......@@ -39,13 +39,12 @@ define $(package)_preprocess_cmds
endef
define $(package)_config_cmds
echo "int main() { return 0; }" > ./libs/locale/build/has_icu_test.cpp && echo "int main() { return 0; }" > ./libs/regex/build/has_icu_test.cpp && ./bootstrap.sh --with-icu=$(shell cat /tmp/icu_install_dir) --with-libraries=$(boost_config_libraries)
echo "int main() { return 0; }" > ./libs/locale/build/has_icu_test.cpp && echo "int main() { return 0; }" > ./libs/regex/build/has_icu_test.cpp && echo "ICU INSTALL: $(ICU_DIR)" && echo "BOOST CONFIG LIBRARIES: $(boost_config_libraries)" && ./bootstrap.sh --with-icu=$(ICU_DIR) --with-libraries=$(boost_config_libraries)
endef
define $(package)_build_cmds
./b2 link=static cxxflags=-fPIC -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts)
ICU_PATH=$(ICU_DIR) ./b2 link=static cxxflags=-fPIC -d0 -q -j12 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
endef
define $(package)_stage_cmds
./b2 link=static cxxflags=-fPIC -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install
endef
......@@ -21,5 +21,5 @@ define $(package)_build_cmds
endef
define $(package)_stage_cmds
$(MAKE) DESTDIR=$($(package)_staging_dir) install
$(MAKE) DESTDIR=/tmp/icu_install install
endef
packages:=icu boost openssl libevent
packages:=boost openssl libevent
darwin_packages:=zeromq
linux_packages:=zeromq
native_packages := native_ccache native_comparisontool
......
......@@ -20,21 +20,33 @@ pushd $staging_dir
wget -c http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz
tar -xvzf icu4c-57_1-src.tgz
pushd icu/source
./runConfigureICU Linux --prefix=$icu_linux_dir --enable-extras=no --enable-strict=no --enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no
CC="gcc" CXX="g++" ./runConfigureICU Linux --prefix=$icu_linux_dir --enable-extras=no --enable-strict=no -enable-static --enable-shared=no --enable-tests=no --enable-samples=no --enable-dyload=no
make
make install
popd
popd
cd depends
mkdir -p sources
cp "$staging_dir/icu4c-57_1-src.tgz" sources/
make HOST=i686-w64-mingw32 NO_QT=1
cd ..
patch -p1 < packaging/remove_consensus.patch
pushd depends
# Remove the dir saying that dependencies are built (although ccache
# is still enabled).
rm -rf built
# Build and install the cross compiled ICU package.
make HOST=i686-w64-mingw32 NO_QT=1 ICU_ONLY=1
# Then build the rest of the dependencies (now that it exists and we
# can determine the location for it).
icu_mingw_dir=$(find /tmp/icu_install -name i686-w64-mingw32 -type d)
make HOST=i686-w64-mingw32 NO_QT=1 ICU_DIR=$icu_mingw_dir
popd
./autogen.sh
icu_mingw_dir=$(cat /tmp/icu_install_dir)
CC="i686-w64-mingw32-gcc" ./configure --prefix=`pwd`/depends/i686-w64-mingw32 --host=i686-w64-mingw32 --build=i686-w64-mingw32 --without-gui --with-icu=$($icu_mingw_dir/bin/icu-config --prefix) --enable-static --disable-shared
make
echo "Using --with-icu=$icu_mingw_dir"
PREFIX=`pwd`/depends/i686-w64-mingw32
CC="i686-w64-mingw32-gcc" CXX="i686-w64-mingw32-g++" ./configure --prefix=$PREFIX --host=i686-w64-mingw32 --build=i686-w64-mingw32 --without-gui --with-icu=$icu_mingw_dir --enable-static --disable-shared
make -j12
rm -rf $staging_dir
# Remove hardcoded cross compiled ICU package path.
rm -rf /tmp/icu_install
echo "Windows build is complete"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment