Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt latest (11+) would break builds #10886

Closed
zuyu opened this issue Aug 29, 2024 · 3 comments
Closed

fmt latest (11+) would break builds #10886

zuyu opened this issue Aug 29, 2024 · 3 comments
Labels
build triage Newly created issue that needs attention.

Comments

@zuyu
Copy link
Contributor

zuyu commented Aug 29, 2024

Problem description

Homebrew/homebrew-core#178811 upgraded fmt from 10.2.1 to 11.0.2 that introduces a breaking change:

  • broke building folly v2024.05.20.00
  • moved fmt::join to fmt/ranges.h from fmt/format.h since 11.0.0 in fmtlib/fmt@50565f9

In velox, there are several places using different fmt versions that works before, as the brew-installed version was 10.2.1:

MACOS_VELOX_DEPS="bison boost double-conversion flex fmt gflags glog googletest icu4c libevent libsodium lz4 lzo openssl protobuf@21 simdjson snappy thrift xz xsimd zstd"

FMT_VERSION="10.1.1"

resolve_dependency(fmt 9.0.0)

Fixing Suggestions

velox was built successfully w/

  • fmt 11.0.2 (installed via brew)
  • FB_OS_VERSION=v2024.08.26.00 (which also requires fast_float installed via brew)
  • skipping install_fmt (10.1.1) in setup-macos.sh

Code changes to #include <fmt/ranges.h> due to fmt::join usage (IWYU):

  • velox/connectors/hive/HiveDataSource.cpp
  • velox/exec/tests/TableScanTest.cpp

Note that https://formulae.brew.sh/formula/folly shows folly v2024.08.26.00 depends on fmt 11.0.2 (brew-installed folly might work on macOS 14, but not macOS 15 due to some weird linking issue). An earlier version of folly might also works.

System information

Velox System Info v0.0.2
Commit: 5f935a7
CMake Version: 3.30.2
System: Darwin-24.1.0
Arch: arm64
C++ Compiler: /opt/homebrew/opt/ccache/libexec/c++
C++ Compiler Version: 16.0.0.16000026
C Compiler: /opt/homebrew/opt/ccache/libexec/cc
C Compiler Version: 16.0.0.16000026
CMake Prefix Path: /Library/Developer/CommandLineTools/SDKs/MacOSX15.0.sdk/usr;/opt/homebrew;/usr/local;/usr;/;/opt/homebrew/Cellar/cmake/3.30.2;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local

CMake log

FAILED: _deps/folly-build/CMakeFiles/folly_base.dir/folly/IPAddressV4.cpp.o 
/usr/local/bin/ccache /Applications/Xcode_15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFMT_SHARED -DFOLLY_HAVE_INT128_T=1 -DFOLLY_XLOG_STRIP_PREFIXES=\"/Users/runner/work/velox/velox:/Users/runner/work/velox/velox/_build/Debug\" -DGFLAGS_IS_A_DLL=0 -DVELOX_ENABLE_PARQUET -D_GNU_SOURCE -D_REENTRANT -I/Users/runner/work/velox/velox/_build/Debug/_deps/folly-src -I/Users/runner/work/velox/velox/_build/Debug/_deps/folly-build -I/usr/local/include -I/usr/local/Cellar/openssl@3/3.3.1/include -mavx2 -mfma -mavx -mf16c -mlzcnt -std=c++17 -mbmi2 -D USE_VELOX_COMMON_BASE -D HAS_UNCAUGHT_EXCEPTIONS -Wall -Wextra -Wno-unused        -Wno-unused-parameter        -Wno-sign-compare        -Wno-ignored-qualifiers        -Wno-range-loop-analysis          -Wno-mismatched-tags          -Wno-nullability-completeness -g -g -Wall -Wextra -std=gnu++17 -isysroot /Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=13.6 -fPIC -g -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -w -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -MD -MT _deps/folly-build/CMakeFiles/folly_base.dir/folly/IPAddressV4.cpp.o -MF _deps/folly-build/CMakeFiles/folly_base.dir/folly/IPAddressV4.cpp.o.d -o _deps/folly-build/CMakeFiles/folly_base.dir/folly/IPAddressV4.cpp.o -c /Users/runner/work/velox/velox/_build/Debug/_deps/folly-src/folly/IPAddressV4.cpp
In file included from /Users/runner/work/velox/velox/_build/Debug/_deps/folly-src/folly/IPAddressV4.cpp:17:
In file included from /Users/runner/work/velox/velox/_build/Debug/_deps/folly-src/folly/IPAddressV4.h:34:
In file included from /Users/runner/work/velox/velox/_build/Debug/_deps/folly-src/folly/FBString.h:34:
In file included from /usr/local/include/fmt/format.h:41:
/usr/local/include/fmt/base.h:1627:3: error: static assertion failed due to requirement 'formattable_char': Mixing character types is disallowed.
  static_assert(formattable_char, "Mixing character types is disallowed.");
  ^             ~~~~~~~~~~~~~~~~
/usr/local/include/fmt/base.h:2018:20: note: in instantiation of function template specialization 'fmt::detail::make_arg<true, fmt::context, folly::Range<const char *>, 0>' requested here
  return {{detail::make_arg<NUM_ARGS <= detail::max_packed_args, Context>(
                   ^
/usr/local/include/fmt/format.h:4365:28: note: in instantiation of function template specialization 'fmt::make_format_args<fmt::context, folly::Range<const char *>, 1UL, 0UL, 15ULL, 0>' requested here
  return vformat(fmt, fmt::make_format_args(args...));
                           ^
/Users/runner/work/velox/velox/_build/Debug/_deps/folly-src/folly/IPAddressV4.cpp:73:14: note: in instantiation of function template specialization 'fmt::format<folly::Range<const char *> &>' requested here
        fmt::format("Can't convert invalid IP '{}' to long", ip));
             ^
1 error generated.
@zuyu zuyu added build triage Newly created issue that needs attention. labels Aug 29, 2024
@aditi-pandit
Copy link
Collaborator

+1.

My system is messed up as well. setup_macos ccache picks up v 4.10.2 https://formulae.brew.sh/formula/ccache brings fmt 11.0.2 which breaks folly

FAILED: CMakeFiles/folly_base.dir/folly/Singleton.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/c++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_CONTEXT_DYN_LINK -DBOOST_CONTEXT_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -DBOOST_REGEX_DYN_LINK -DBOOST_REGEX_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -DBOOST_THREAD_DYN_LINK -DBOOST_THREAD_NO_LIB -DFOLLY_XLOG_STRIP_PREFIXES=\"/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly:/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly/_build\" -DGFLAGS_IS_A_DLL=0 -D_GNU_SOURCE -D_REENTRANT -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly/_build -I/opt/homebrew/include -I/Users/aditipandit/velox_install/include -I/opt/homebrew/opt/openssl@1.1/include -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -fPIC -g -finput-charset=UTF-8 -fsigned-char -Wall -Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused -Wuninitialized -Wunused-label -Wunused-result -Wno-noexcept-type -Wno-nullability-completeness -Wno-inconsistent-missing-override -faligned-new -MD -MT CMakeFiles/folly_base.dir/folly/Singleton.cpp.o -MF CMakeFiles/folly_base.dir/folly/Singleton.cpp.o.d -o CMakeFiles/folly_base.dir/folly/Singleton.cpp.o -c /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly/folly/Singleton.cpp
In file included from /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly/folly/Singleton.cpp:38:
In file included from /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/folly/folly/portability/FmtCompile.h:19:
/opt/homebrew/include/fmt/compile.h:153:12: error: call to 'write' is ambiguous
    return write<Char>(out, arg);
           ^~~~~~~~~~~
/opt/homebrew/include/fmt/compile.h:217:15: note: in instantiation of function template specialization 'fmt::detail::field<char, folly::Range<const char *>, 0>::format<std::back_insert_iterator<std::string>, folly::Range<const char *>>' requested here
    out = lhs.format(out, args...);
              ^
/opt/homebrew/include/fmt/compile.h:218:16: note: in instantiation of function template specialization 'fmt::detail::concat<fmt::detail::field<char, folly::Range<const char *>, 0>, fmt::detail::text<char>>::format<std::back_insert_iterator<std::string>, folly::Range<const char *>>' requested here
    return rhs.format(out, args...);
               ^
/opt/homebrew/include/fmt/compile.h:432:6: note: in instantiation of function template specialization 'fmt::detail::concat<fmt::detail::text<char>, fmt::detail::concat<fmt::detail::field<char, folly::Range<const char *>, 0>, fmt::detail::text<char>>>::format<std::back_insert_iterator<std::string>, folly::Range<const char *>>' requested here
  cf.format(std::back_inserter(s), args...);
     ^

Uninstalling fmt 11 and bringing in fmt 10 fixes the folly and completes the rest of the setup, but then this breaks ccache

FAILED: velox/velox/connectors/hive/storage_adapters/abfs/CMakeFiles/velox_abfs.dir/RegisterAbfsFileSystem.cpp.o 
/opt/homebrew/bin/ccache /Library/Developer/CommandLineTools/usr/bin/c++ -DFOLLY_HAVE_INT128_T=1 -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/. -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox/velox/external/xxhash -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/cmake-build-debug/velox -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/cmake-build-debug -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/cmake-build-debug/_deps/protobuf-src/src -I/Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox/. -isystem /opt/homebrew/include -isystem /Users/aditipandit/velox_install/include -isystem /opt/homebrew/opt/openssl@1.1/include -isystem /Users/aditipandit/velox_install/include/proxygen -isystem /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox/velox -isystem /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox/velox/external -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -Wno-nullability-completeness -Wno-deprecated-declarations -Wreorder -mcpu=apple-m1+crc -std=c++17 -fvisibility=hidden -D USE_VELOX_COMMON_BASE -D HAS_UNCAUGHT_EXCEPTIONS -g -std=gnu++17 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -fPIC -fcolor-diagnostics -MD -MT velox/velox/connectors/hive/storage_adapters/abfs/CMakeFiles/velox_abfs.dir/RegisterAbfsFileSystem.cpp.o -MF velox/velox/connectors/hive/storage_adapters/abfs/CMakeFiles/velox_abfs.dir/RegisterAbfsFileSystem.cpp.o.d -o velox/velox/connectors/hive/storage_adapters/abfs/CMakeFiles/velox_abfs.dir/RegisterAbfsFileSystem.cpp.o -c /Users/aditipandit/ahana_dev/presto/presto/presto-native-execution/velox/velox/connectors/hive/storage_adapters/abfs/RegisterAbfsFileSystem.cpp
dyld[99479]: Library not loaded: /opt/homebrew/opt/fmt/lib/libfmt.11.dylib
  Referenced from: <2B4CCBD1-71A1-35E6-903D-1217D1C46092> /opt/homebrew/Cellar/ccache/4.10.2_1/bin/ccache
  Reason: tried: '/opt/homebrew/opt/fmt/lib/libfmt.11.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/fmt/lib/libfmt.11.dylib' (no such file), '/opt/homebrew/opt/fmt/lib/libfmt.11.

@czentgr
Copy link
Collaborator

czentgr commented Aug 30, 2024

As a workaround for now - given that fmt is still in the system (from install_fmt) but the homebrew version is picked up (also is used by other depend such as folly and fbthrift - the latter executable dynamically links fmt in that was removed from homebrew).

The workaround for now would be:

  • remove ccache and fmt from the setup-macos.sh script
  • remove ccache and fmt from homebrew
  • re-run the setup-script and rebuild all the dependencies - they should pick up the fmt installed using install_fmt in the script

ccache is a wrapper around the C/C++ compilers but is not strictly necessary to build the components. It is just that nothing is cached and on make clean things we be rebuilt instead of the cache used.

I was able to use this and unblock me for now until the issue is resolved.

@yingsu00
Copy link
Collaborator

I have a working fix. Will send pr today

facebook-github-bot pushed a commit that referenced this issue Sep 19, 2024
Summary:
https://github.com/facebookincubator/velox/pull/10422/files added additional packages to be installed via brew.
When the package versions are updated via brew, it can cause a build failure.
See #10886
We must install or bundle fixed/supported versions to avoid this.

Allow installed package headers to be picked up before brew/system package headers
Add support for DEPENDENCY_DIR and INSTALL_PREFIX.

Pull Request resolved: #10920

Reviewed By: kgpai

Differential Revision: D62989022

Pulled By: Yuhta

fbshipit-source-id: a10faa3212c32d6f9c0e301921a750e3b7142220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build triage Newly created issue that needs attention.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants