Skip to content

Commit

Permalink
build: support for static linking with boost
Browse files Browse the repository at this point in the history
When shipping a seastar executable for an older distribution, it is
desirable to link statically against boost, in order to reduce the number
of foreign packages that need to be installed.

Message-Id: <[email protected]>
  • Loading branch information
avikivity committed Oct 25, 2016
1 parent 5e3a281 commit 5ada8c7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ def sanitize_vptr_flag(compiler):
help='Enable(1)/disable(0)compiler debug information generation for tests')
arg_parser.add_argument('--static-stdc++', dest = 'staticcxx', action = 'store_true',
help = 'Link libgcc and libstdc++ statically')
arg_parser.add_argument('--static-boost', dest = 'staticboost', action = 'store_true',
help = 'Link with boost statically')
add_tristate(arg_parser, name = 'hwloc', dest = 'hwloc', help = 'hwloc support')
add_tristate(arg_parser, name = 'xen', dest = 'xen', help = 'Xen support')
args = arg_parser.parse_args()
Expand Down Expand Up @@ -314,9 +316,22 @@ def sanitize_vptr_flag(compiler):
'tests/test_runner.cc',
]


def maybe_static(flag, libs):
if flag and not args.static:
libs = '-Wl,-Bstatic {} -Wl,-Bdynamic'.format(libs)
return libs

defines = ['FMT_HEADER_ONLY']
# Include -lgcc_s before -lunwind to work around for https://savannah.nongnu.org/bugs/?48486. See https://github.com/scylladb/scylla/issues/1725.
libs = '-laio -lboost_program_options -lboost_system -lboost_filesystem -lstdc++ -lm -lboost_unit_test_framework -lboost_thread -lcryptopp -lrt -lgnutls -lgnutlsxx -llz4 -lprotobuf -ldl -lgcc_s -lunwind'
libs = ' '.join(['-laio',
maybe_static(args.staticboost,
'-lboost_program_options -lboost_system -lboost_filesystem'),
'-lstdc++ -lm',
maybe_static(args.staticboost, '-lboost_unit_test_framework -lboost_thread'),
'-lcryptopp -lrt -lgnutls -lgnutlsxx -llz4 -lprotobuf -ldl -lgcc_s -lunwind',
])

hwloc_libs = '-lhwloc -lnuma -lpciaccess -lxml2 -lz'
xen_used = False
def have_xen():
Expand Down

0 comments on commit 5ada8c7

Please sign in to comment.