Visibility warnings when building on MacOS
envgap__VowpalWabbit__vowpal_wabbit-2678
01 / FAILURE SIGNATURE
Captured in a clean container
-- VowpalWabbit Version: 9.1.0
02 / ENVIRONMENT RECIPE
- Base commit
40eb693a8a03f1983f1af02a7faa811413bbe259- Manifest
CMakeLists.txt- Reproduce
cmake -S . -B build -DBUILD_TESTING=OFF && cmake --build build -j4- Run under trace
cmake --build build -j4
Reference environment fix used for admission
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d133fcf99..13ea9ee7e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,8 @@ message(STATUS "Using C++ standard: " ${VW_CXX_STANDARD})
set(CMAKE_CXX_STANDARD ${VW_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
+set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
include(VowpalWabbitUtils)
diff --git a/cmake/VWFlags.cmake b/cmake/VWFlags.cmake
index f78e276be..d533b5e5a 100644
--- a/cmake/VWFlags.cmake
+++ b/cmake/VWFlags.cmake
@@ -22,7 +22,7 @@ set(LINUX_RELEASE_CONFIG -fno-strict-aliasing ${LINUX_X86_64_OPT_FLAGS} -fno-sta
set(LINUX_DEBUG_CONFIG -fno-stack-check)
#Use default visiblity on UNIX otherwise a lot of the C++ symbols end up for exported and interpose'able
-set(VW_LINUX_FLAGS -fvisibility=hidden $<$<CONFIG:Debug>:${LINUX_DEBUG_CONFIG}> $<$<CONFIG:Release>:${LINUX_RELEASE_CONFIG}> $<$<CONFIG:RelWithDebInfo>:${LINUX_RELEASE_CONFIG}>)
+set(VW_LINUX_FLAGS $<$<CONFIG:Debug>:${LINUX_DEBUG_CONFIG}> $<$<CONFIG:Release>:${LINUX_RELEASE_CONFIG}> $<$<CONFIG:RelWithDebInfo>:${LINUX_RELEASE_CONFIG}>)
set(VW_WIN_FLAGS /MP /Zc:__cplusplus)
# Turn on warnings03 / ORIGINAL ISSUE TEXT
VowpalWabbit/vowpal_wabbit #2678 · read the original issue
Building with Clang on MacOS causes *many* warnings about differing visibility settings in translation units. ``` ld: warning: direct access in function 'void predict_or_learn_bandit_adf<false>(warm_cb&, VW::LEARNER::learner<char, std::__1::vector<example*, std::__1::allocator<example*> > >&, example&, int)' from file 'libvw.a(warm_cb.cc.o)' to global weak symbol 'typeinfo for VW::vw_exception' from file 'CMakeFiles/vw-bin.dir/main.cc.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ``` Turning it off seems like the wrong approach (I originally proposed this in #2659)
04 / LABELS
Labels checked by running the task · needs human review
No supported category has been assigned.
Label rules and the text that matched
[]
Mined from a merged pull request linked to the issue whose changed files are all environment files.
The base commit is the pull request's base, not the dated default-branch commit; the registry is pinned to the merge date so the pull request's own pins resolve.
Default commands from envgap default-recipe synthesizer v1; gold_files are the pull request's environment diff.
Preparation uses current registries. Historical package availability is not enforced here; execution metadata records this limitation separately from the oracle's date-bounding policy.