From 9ca99c6f9347078433db9c5d3b2d12c3a8bcfa90 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 18 Aug 2021 12:57:44 +0300 Subject: [PATCH] v.builder: add `-Wl,--allow-multiple-definition` when targeting FreeBSD --- vlib/v/builder/cc.v | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 9d99e57f5b..32bc6b17bc 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -318,6 +318,10 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) { if ccoptions.debug_mode && os.user_os() != 'windows' && v.pref.build_mode != .build_module { ccoptions.linker_flags << '-rdynamic' // needed for nicer symbolic backtraces } + if v.pref.os == .freebsd { + // Needed for -usecache on FreeBSD 13, otherwise we get `ld: error: duplicate symbol: _const_math__bits__de_bruijn32` errors there + ccoptions.linker_flags << '-Wl,--allow-multiple-definition' + } if ccompiler != 'msvc' && v.pref.os != .freebsd { ccoptions.wargs << '-Werror=implicit-function-declaration'