fix building on OpenBSD, simplify Readme section
Based on a patch from @mrme0w (#5569). Fixes #5770
This commit is contained in:
parent
97ffc6dabd
commit
441f318180
@ -645,7 +645,7 @@ else()
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
||||||
|
|
||||||
# if those don't work for your compiler, single it out where appropriate
|
# if those don't work for your compiler, single it out where appropriate
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
if(CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT OPENBSD)
|
||||||
set(C_SECURITY_FLAGS "${C_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
|
set(C_SECURITY_FLAGS "${C_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
|
||||||
set(CXX_SECURITY_FLAGS "${CXX_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
|
set(CXX_SECURITY_FLAGS "${CXX_SECURITY_FLAGS} -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1")
|
||||||
endif()
|
endif()
|
||||||
@ -657,7 +657,7 @@ else()
|
|||||||
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
|
add_cxx_flag_if_supported(-Wformat-security CXX_SECURITY_FLAGS)
|
||||||
|
|
||||||
# -fstack-protector
|
# -fstack-protector
|
||||||
if (NOT WIN32)
|
if (NOT WIN32 AND NOT OPENBSD)
|
||||||
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
|
add_c_flag_if_supported(-fstack-protector C_SECURITY_FLAGS)
|
||||||
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
|
add_cxx_flag_if_supported(-fstack-protector CXX_SECURITY_FLAGS)
|
||||||
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
|
add_c_flag_if_supported(-fstack-protector-strong C_SECURITY_FLAGS)
|
||||||
@ -665,7 +665,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# New in GCC 8.2
|
# New in GCC 8.2
|
||||||
if (NOT WIN32)
|
if (NOT WIN32 AND NOT OPENBSD)
|
||||||
add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
|
add_c_flag_if_supported(-fcf-protection=full C_SECURITY_FLAGS)
|
||||||
add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
|
add_cxx_flag_if_supported(-fcf-protection=full CXX_SECURITY_FLAGS)
|
||||||
add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
|
add_c_flag_if_supported(-fstack-clash-protection C_SECURITY_FLAGS)
|
||||||
|
94
README.md
94
README.md
@ -463,100 +463,10 @@ 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.
|
|
||||||
|
|
||||||
You will need to add a few packages to your system. `pkg_add db cmake gcc gcc-libs g++ gtest`.
|
|
||||||
|
|
||||||
The doxygen and graphviz packages are optional and require the xbase set.
|
|
||||||
|
|
||||||
The Boost package has a bug that will prevent librpc.a from building correctly. In order to fix this, you will have to Build boost yourself from scratch. Follow the directions here (under "Building Boost"):
|
|
||||||
https://github.com/bitcoin/bitcoin/blob/master/doc/build-openbsd.md
|
|
||||||
|
|
||||||
You will have to add the serialization, date_time, and regex modules to Boost when building as they are needed by Monero.
|
|
||||||
|
|
||||||
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 and 6.3
|
|
||||||
|
|
||||||
You will need to add a few packages to your system. `pkg_add cmake zeromq libiconv`.
|
|
||||||
|
|
||||||
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`.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 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 and apply boost patches, required for OpenBSD
|
|
||||||
ftp -o boost_test_impl_execution_monitor_ipp.patch https://raw.githubusercontent.com/openbsd/ports/bee9e6df517077a7269ff0dfd57995f5c6a10379/devel/boost/patches/patch-boost_test_impl_execution_monitor_ipp
|
|
||||||
ftp -o boost_config_platform_bsd_hpp.patch https://raw.githubusercontent.com/openbsd/ports/90658284fb786f5a60dd9d6e8d14500c167bdaa0/devel/boost/patches/patch-boost_config_platform_bsd_hpp
|
|
||||||
|
|
||||||
# MUST output: (SHA256) boost_config_platform_bsd_hpp.patch: OK
|
|
||||||
echo "1f5e59d1154f16ee1e0cc169395f30d5e7d22a5bd9f86358f738b0ccaea5e51d boost_config_platform_bsd_hpp.patch" | sha256 -c
|
|
||||||
# MUST output: (SHA256) boost_test_impl_execution_monitor_ipp.patch: OK
|
|
||||||
echo "30cec182a1437d40c3e0bd9a866ab5ddc1400a56185b7e671bb3782634ed0206 boost_test_impl_execution_monitor_ipp.patch" | sha256 -c
|
|
||||||
|
|
||||||
cd boost_1_64_0
|
|
||||||
patch -p0 < ../boost_test_impl_execution_monitor_ipp.patch
|
|
||||||
patch -p0 < ../boost_config_platform_bsd_hpp.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,locale --with-toolset=clang
|
|
||||||
./b2 toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" -sICONV_PATH=/usr/local
|
|
||||||
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 -sICONV_PATH=/usr/local --prefix=/usr/local install
|
|
||||||
```
|
|
||||||
|
|
||||||
Build the cppzmq bindings.
|
|
||||||
|
|
||||||
We assume you are compiling with a non-root user and you have `doas` enabled.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create cppzmq building directory
|
|
||||||
mkdir ~/cppzmq
|
|
||||||
cd ~/cppzmq
|
|
||||||
|
|
||||||
# Fetch cppzmq source
|
|
||||||
ftp -o cppzmq-4.2.3.tar.gz https://github.com/zeromq/cppzmq/archive/v4.2.3.tar.gz
|
|
||||||
|
|
||||||
# MUST output: (SHA256) cppzmq-4.2.3.tar.gz: OK
|
|
||||||
echo "3e6b57bf49115f4ae893b1ff7848ead7267013087dc7be1ab27636a97144d373 cppzmq-4.2.3.tar.gz" | sha256 -c
|
|
||||||
tar xfz cppzmq-4.2.3.tar.gz
|
|
||||||
|
|
||||||
# Start building cppzmq
|
|
||||||
cd cppzmq-4.2.3
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake ..
|
|
||||||
doas make install
|
|
||||||
```
|
|
||||||
|
|
||||||
Build monero:
|
|
||||||
```bash
|
|
||||||
env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static
|
|
||||||
```
|
|
||||||
|
|
||||||
#### OpenBSD >= 6.4
|
|
||||||
|
|
||||||
You will need to add a few packages to your system. `pkg_add cmake gmake zeromq cppzmq libiconv boost`.
|
You will need to add a few packages to your system. `pkg_add cmake gmake zeromq cppzmq libiconv boost`.
|
||||||
|
|
||||||
The doxygen and graphviz packages are optional and require the xbase set.
|
The `doxygen` and `graphviz` packages are optional and require the xbase set.
|
||||||
|
Running the test suite also requires `py-requests` package.
|
||||||
|
|
||||||
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static`
|
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user