Skip to content

Missing symbols in 2.6.0 without CLI11_ENABLE_EXTRA_VALIDATORS #1237

@sethrj

Description

@sethrj

I built CLI11 2.6.0 with default options (no explicit CLI11_ENABLE_EXTRA_VALIDATORS) and with the precompiled library (CLI11_PRECOMPILED). In my downstream library it compiles correctly, using -DCLI11_COMPILE, but fails to link (despite being linked to libCLI11.a):

Undefined symbols for architecture arm64:
  "CLI::detail::PermissionValidator::PermissionValidator(CLI::detail::Permission)", referenced from:
      ___cxx_global_var_init.11 in celer-sim.cc.o
      ___cxx_global_var_init.12 in celer-sim.cc.o
      ___cxx_global_var_init.13 in celer-sim.cc.o
      ___cxx_global_var_init.11 in libceler_app_utils.a[2](CliUtils.cc.o)
      ___cxx_global_var_init.12 in libceler_app_utils.a[2](CliUtils.cc.o)
      ___cxx_global_var_init.13 in libceler_app_utils.a[2](CliUtils.cc.o)

Note that libCLI11.a has most other symbols but not PermissionValidator.

These symbols aren't used in my project (which worked fine with 2.5) but I think are from the global static variables

const detail::PermissionValidator ReadPermissions(detail::Permission::read);
const detail::PermissionValidator WritePermissions(detail::Permission::write);
const detail::PermissionValidator ExecPermissions(detail::Permission::exec);

which are somehow being included through #include <CLI/CLI.hpp>. I think there may be an error with the logic for CLI11_ENABLE_EXTRA_VALIDATORS.

Installation was done with:

/opt/homebrew/opt/cmake/bin/cmake' '-G' 'Unix Makefiles' '-DCMAKE_INSTALL_PREFIX:STRING=/opt/spack/opt/spack/tahoe/cli11/2.6.0/rzosl4e' '-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON' '-DCMAKE_INSTALL_RPATH:STRING=/opt/spack/opt/spack/tahoe/cli11/2.6.0/rzosl4e/lib;/opt/spack/opt/spack/tahoe/cli11/2.6.0/rzosl4e/lib64' '-DCMAKE_PREFIX_PATH:STRING=/opt/spack/opt/spack/tahoe/compiler-wrapper/1.0/e6qqck2;/opt/homebrew/opt/cmake' '-DCMAKE_BUILD_TYPE:STRING=Release' '-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON' '-DCMAKE_FIND_FRAMEWORK:STRING=LAST' '-DCMAKE_FIND_APPBUNDLE:STRING=LAST' '-DCMAKE_INTERPROCEDURAL_OPTIMIZATION:BOOL=OFF' '-DCMAKE_POLICY_DEFAULT_CMP0090:STRING=NEW' '-DCMAKE_FIND_USE_PACKAGE_REGISTRY:BOOL=OFF' '-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON' '-DCMAKE_POLICY_DEFAULT_CMP0042:STRING=NEW' '-DCLI11_BUILD_EXAMPLES:BOOL=OFF' '-DCLI11_BUILD_DOCS:BOOL=OFF' '-DCLI11_BUILD_TESTS:BOOL=OFF' '-DCLI11_PRECOMPILED:BOOL=ON' '-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON' '/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-cli11-2.6.0-rzosl4exg4udhcv7t5ogzacxffahsftu/spack-src'
-- The CXX compiler identification is AppleClang 17.0.0.17000319
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/spack/opt/spack/tahoe/compiler-wrapper/1.0/e6qqck2/libexec/spack/clang/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMake 4.1.1
-- Found Doxygen: /opt/homebrew/bin/doxygen (found version "1.14.0") found components: doxygen dot
-- Configuring done (2.1s)
-- Generating done (0.0s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_POLICY_DEFAULT_CMP0042
    CMAKE_POLICY_DEFAULT_CMP0090


-- Build files have been written to: /private/var/folders/n9/mqnx20b929z469f6p3fbq7c40000gn/T/seth/spack-stage/spack-stage-cli11-2.6.0-rzosl4exg4udhcv7t5ogzacxffahsftu/spack-build-rzosl4e

Trying to work around the problem by manually trying to force CLI11_ENABLE_EXTRA_VALIDATORS=0 fails:

../app/CliUtils.hh:9:9: error: 'CLI11_ENABLE_EXTRA_VALIDATORS' macro redefined [-Werror,-Wmacro-redefined]
    9 | #define CLI11_ENABLE_EXTRA_VALIDATORS 0
      |         ^
/opt/spack/var/spack/environments/celeritas/.spack-env/view/include/CLI/ExtraValidators.hpp:7:9: note: previous definition is here
    7 | #define CLI11_ENABLE_EXTRA_VALIDATORS 1
      |         ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions