diff --git a/src/SConscript b/src/SConscript index eabee41a..2f3b5a3b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -35,8 +35,18 @@ def RemoveDuplicateLibs(libs): Import('env') +def WorkaroundFreeBSDLibOrder(libs): + # lib(re)ssl includes (weak) arc4random functions + # which "on purpose" might conflict with those in libc + # => link libc first solves this + # (required for FreeBSD11 fullstatic build) + if 'c' in libs: + return ['c'] + libs + return libs + def GatherLibs(env, *libs): - return RemoveDuplicateLibs(env['LIBS'] + list(libs) + [env['APPEND_LIBS']]) + libs = RemoveDuplicateLibs(env['LIBS'] + list(libs) + [env['APPEND_LIBS']]) + return WorkaroundFreeBSDLibOrder(libs) common_src = Split("base64.c buffer.c log.c \ keyvalue.c chunk.c \