drachtio / drachtio-server

A SIP call processing server that can be controlled via nodejs applications
https://drachtio.org
MIT License
237 stars 92 forks source link

Support building with system boost #290

Closed orgads closed 1 year ago

davehorton commented 1 year ago

what is the goal here? This seems to assume that boost is provided on every distribution someone might want to build drachtio server on?

orgads commented 1 year ago

I tried not to assume anything, and I didn't remove the submodule. If the submodule is not present, then I use the system boost.

orgads commented 1 year ago

My goal is to simplify the build process. See my improved Dockerfile.

davehorton commented 1 year ago

OK, thanks for the explanation. One question though -- I see in your configure.ac you added this test

AM_CONDITIONAL([DEP_BOOST], [test -d "${srcdir}/deps/boost/libs"])

and then if that test passes you build boost from the checked-out boost submodule (if I follow). But since the boost submodule is always going to be part of the checkout, won't that test always pass and then you are still building from the source? I know I am missing something, just want to understand before I merge, otherwise looks good

davehorton commented 1 year ago

also can you just commit a change to resolve the merge conflict with Makefile.am and then with that and your helpful explanation to me we should be all set

orgads commented 1 year ago

Rebased. My idea is that if you don't initialize the boost submodule (but do initialize the rest), build will use the system boost.

davehorton commented 1 year ago

actually it appears that this commit has broken the "normal" build process

/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
g++ -std=gnu++11 -std=c++17 -DHAVE_CONFIG_H -I. -I.. -I../deps/sofia-sip/libsofia-sip-ua/su -I../deps/sofia-sip/libsofia-sip-ua/nta -I../deps/sofia-sip/libsofia-sip-ua/sip -I../deps/sofia-sip/libsofia-sip-ua/msg -I../deps/sofia-sip/libsofia-sip-ua/url -I../deps/sofia-sip/libsofia-sip-ua/tport -I../deps/sofia-sip/libsofia-sip-ua/bnf -I../deps/jansson/src -I../deps/cpp-bredis/include -I../deps/prometheus-cpp/build/include -I/usr/local/include  -D_REENTRANT -DDRACHTIO_VERSION=\"1.0.0\" -Wno-error=deprecated-declarations -DBOOST_ALLOW_DEPRECATED_HEADERS -DBOOST_LOG_DYN_LINK -O2 -Wno-stringop-overflow -I/usr/local/opt/openssl/include -fvisibility=hidden   -g -O2 -MT src/drachtio-main.o -MD -MP -MF src/.deps/drachtio-main.Tpo -c -o src/drachtio-main.o `test -f 'src/main.cpp' || echo '../'`src/main.cpp
warning: unknown warning option '-Wno-stringop-overflow'; did you mean '-Wno-shift-overflow'? [-Wunknown-warning-option]
In file included from ../src/main.cpp:26:
../src/controller.hpp:56:10: fatal error: 'boost/log/common.hpp' file not found
#include <boost/log/common.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.

I should have tested with and without system boost before merging...as should you have

orgads commented 1 year ago

I'm quite sure I did. I'll test again.

davehorton commented 1 year ago

I think the issue is building not from the source directory, but from a build subdirectory, ie as per the instructions in the readme

./autogen.sh
mkdir build && cd $_
../configure
make

This fails

orgads commented 1 year ago

Sorry for the mess. I had this fix on my clone, but forgot to push it. Pushed now: #298.

davehorton commented 1 year ago

This fails at a different place on a debian 11 server

onst*)'
/usr/bin/ld: src/drachtio-ua-invalid.o: in function `boost::log::v2_mt_posix::aux::record_pump<boost::log::v2_mt_posix::sources::severity_logger_mt<drachtio::severity_levels> >::auto_release::~auto_release()':
/usr/local/src/drachtio-server/build/../deps/boost/boost/log/sources/record_ostream.hpp:493: undefined reference to `boost::log::v2_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2_mt_posix::aux::stream_provider<char>::stream_compound*)'
/usr/bin/ld: src/drachtio-ua-invalid.o: in function `boost::log::v2_mt_posix::record::reset()':
/usr/local/src/drachtio-server/build/../deps/boost/boost/log/core/record.hpp:157: undefined reference to `boost::log::v2_mt_posix::record_view::public_data::destroy(boost::log::v2_mt_posix::record_view::public_data const*)'
/usr/bin/ld: src/drachtio-ua-invalid.o: in function `boost::log::v2_mt_posix::aux::record_pump<boost::log::v2_mt_posix::sources::severity_logger_mt<drachtio::severity_levels> >::auto_release::~auto_release()':
/usr/local/src/drachtio-server/build/../deps/boost/boost/log/sources/record_ostream.hpp:493: undefined reference to `boost::log::v2_mt_posix::aux::stream_provider<char>::release_compound(boost::log::v2_mt_posix::aux::stream_provider<char>::stream_compound*)'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:604: drachtio] Error 1
make[1]: Leaving directory '/usr/local/src/drachtio-server/build'
make: *** [Makefile:461: all] Error 2

I ran these commands:

git clone https://github.com/drachtio/drachtio-server.git
cd drachtio-server/
git fetch origin pull/298/head:compile-fix
git checkout compile-fix
git submodule update --init --recursive
 ./autogen.sh
 mkdir build && cd $_
 ../configure
 make