Merge pull request #2730

ba1b89fb Updated OpenBSD build instructions and fixed libressl linking issue (ston1th)
This commit is contained in:
Riccardo Spagni 2017-11-14 15:26:57 +02:00
commit 90d78b825a
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 76 additions and 0 deletions

View file

@ -350,6 +350,8 @@ We expect to add Monero into the ports tree in the near future, which will aid i
### On OpenBSD: ### On OpenBSD:
#### OpenBSD < 6.2
This has been tested on OpenBSD 5.8. This has been tested on OpenBSD 5.8.
You will need to add a few packages to your system. `pkg_add db cmake gcc gcc-libs g++ miniupnpc gtest`. You will need to add a few packages to your system. `pkg_add db cmake gcc gcc-libs g++ miniupnpc gtest`.
@ -363,6 +365,71 @@ You will have to add the serialization, date_time, and regex modules to Boost wh
To build: `env CC=egcc CXX=eg++ CPP=ecpp DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/path/to/the/boost/you/built make release-static-64` To build: `env CC=egcc CXX=eg++ CPP=ecpp DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/path/to/the/boost/you/built make release-static-64`
#### OpenBSD >= 6.2
You will need to add a few packages to your system. Choose version 4 for db. `pkg_add db cmake miniupnpc zeromq`.
The doxygen and graphviz packages are optional and require the xbase set.
Build the Boost library using clang. This guide is derived from: https://github.com/bitcoin/bitcoin/blob/master/doc/build-openbsd.md
We assume you are compiling with a non-root user and you have `doas` enabled.
Note: do not use the boost package provided by OpenBSD, as we are installing boost to `/usr/local`.
```
# Create boost building directory
mkdir ~/boost
cd ~/boost
# Fetch boost source
ftp -o boost_1_64_0.tar.bz2 https://netcologne.dl.sourceforge.net/project/boost/boost/1.64.0/boost_1_64_0.tar.bz2
# MUST output: (SHA256) boost_1_64_0.tar.bz2: OK
echo "7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 boost_1_64_0.tar.bz2" | sha256 -c
tar xfj boost_1_64_0.tar.bz2
# Fetch a boost patch, required for OpenBSD
ftp -o boost.patch https://raw.githubusercontent.com/openbsd/ports/bee9e6df517077a7269ff0dfd57995f5c6a10379/devel/boost/patches/patch-boost_test_impl_execution_monitor_ipp
cd boost_1_64_0
patch -p0 < ../boost.patch
# Start building boost
echo 'using clang : : c++ : <cxxflags>"-fvisibility=hidden -fPIC" <linkflags>"" <archiver>"ar" <striper>"strip" <ranlib>"ranlib" <rc>"" : ;' > user-config.jam
./bootstrap.sh --without-icu --with-libraries=chrono,filesystem,program_options,system,thread,test,date_time,regex,serialization --with-toolset=clang
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++"
doas ./b2 -d0 runtime-link=shared threadapi=pthread threading=multi link=static variant=release --layout=tagged --build-type=complete --user-config=user-config.jam -sNO_BZIP2=1 --prefix=/usr/local install
```
Build cppzmq
Build the cppzmq bindings.
We assume you are compiling with a non-root user and you have `doas` enabled.
```
# Create cppzmq building directory
mkdir ~/cppzmq
cd ~/cppzmq
# Fetch cppzmq source
ftp -o cppzmq-4.2.2.tar.gz https://github.com/zeromq/cppzmq/archive/v4.2.2.tar.gz
# MUST output: (SHA256) cppzmq-4.2.2.tar.gz: OK
echo "3ef50070ac5877c06c6bb25091028465020e181bbfd08f110294ed6bc419737d cppzmq-4.2.2.tar.gz" | sha256 -c
tar xfz cppzmq-4.2.2.tar.gz
# Start building cppzmq
cd cppzmq-4.2.2
mkdir build
cd build
cmake ..
doas make install
```
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static`
### On Linux for Android (using docker): ### On Linux for Android (using docker):
# Build image (select android64.Dockerfile for aarch64) # Build image (select android64.Dockerfile for aarch64)

View file

@ -60,6 +60,15 @@ if (CMAKE_USE_WIN32_THREADS_INIT)
else () else ()
set(HAVE_WINDOWS_THREADS 0) set(HAVE_WINDOWS_THREADS 0)
endif () endif ()
# determine if we have libressl
check_symbol_exists(LIBRESSL_VERSION_TEXT "openssl/opensslv.h" HAVE_LIBRESSL)
# check if we have found HAVE_DECL_REALLOCARRAY already, so we can safely undefine and redefine it with value 1
if (HAVE_LIBRESSL AND HAVE_DECL_REALLOCARRAY)
unset(HAVE_DECL_REALLOCARRAY CACHE)
add_definitions(-DHAVE_DECL_REALLOCARRAY=1)
endif ()
configure_file( configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h") "${CMAKE_CURRENT_BINARY_DIR}/config.h")