Skip to content

Commit

Permalink
[scons] workaround FreeBSD11 fullstatic link error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stbuehler committed Oct 29, 2016
1 parent 8e67865 commit fbe3a84
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit fbe3a84

Please sign in to comment.