[scons] workaround FreeBSD11 fullstatic link error

The error for reference:

/usr/lib/libc.a(arc4random.o): In function `arc4random':
/usr/src/lib/libc/gen/arc4random.c:(.text+0x410): multiple definition of `arc4random'
/usr/local/lib/libcrypto.a(arc4random.o):(.text+0x0): first defined here
/usr/lib/libc.a(arc4random.o): In function `arc4random_buf':
/usr/src/lib/libc/gen/arc4random.c:(.text+0x580): multiple definition of `arc4random_buf'
/usr/local/lib/libcrypto.a(arc4random.o):(.text+0x80): first defined here
personal/stbuehler/mod-csrf
Stefan Bühler 2016-10-29 19:30:47 +02:00
parent 8e678653be
commit fbe3a84907
1 changed files with 11 additions and 1 deletions

View File

@ -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 \