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

no matching function for call to 'compile' #2261

Closed
priteshrnandgaonkar opened this issue Apr 28, 2021 · 11 comments
Closed

no matching function for call to 'compile' #2261

priteshrnandgaonkar opened this issue Apr 28, 2021 · 11 comments

Comments

@priteshrnandgaonkar
Copy link

priteshrnandgaonkar commented Apr 28, 2021

While trying to build a cocoapod for Fmt for Folly, I am facing the following error.

    - ERROR | [iOS] xcodebuild:  Headers/Public/Flipper-Fmt/fmt/compile.h:904:29: error: no matching function for call to 'compile'

Any idea how can I solve this ?

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

What {fmt} version do you use and what are the exact build commands?

@priteshrnandgaonkar
Copy link
Author

I am using the master branch of fmt. To build it I am using cocoapod's pod spec lint to verify if Flipper-Folly works with fmt. The current Folly version is quite old, I am trying to update it, and apparently folly now depends on fmt, thats why I am adding a cocoapod definition of fmt.

For context, apparently the older versions of folly is not compatible with xcode 12.5 RC and thats why we need to use the newer folly and need fmt as a cocoapod dep.

The pod definition for fmt is as follows

Pod::Spec.new do |spec|
    spec.name     = 'Flipper-Fmt'
    spec.version  = '7.1.6'
    spec.license  = { :type => 'MIT' }
    spec.homepage = 'https://github.com/fmtlib/fmt'
    spec.authors  = { 'Pritesh Nandgaonkar' => '[email protected]' }
    spec.summary  = '{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.    '

    spec.source   = { :git => "https://github.com/priteshrnandgaonkar/fmt.git",
                      :branch => "master" }
    spec.compiler_flags = '-DFMT_USE_CONSTEXPR=1 -DFMT_HEADER_ONLY=1'
    spec.source_files = "src/*.cc", "include/**/*.h",
    spec.public_header_files = "include/**/*.h"
    spec.requires_arc = true
    spec.ios.deployment_target = '10.0'
    spec.header_dir = 'fmt'
    spec.libraries = "stdc++" 
    spec.exclude_files = "src/fmt.cc", "src/fmt.cc"
    spec.pod_target_xcconfig = {  "USE_HEADERMAP" => "NO",
    "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
    "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/include/\""
  }
end

Internally cocoapod uses Xcodebuild to build the source

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

A couple of observations:

  1. You are trying to compile fmt as both static and header only library which doesn't make sense. You should probably remove -DFMT_HEADER_ONLY=1.
  2. You only need to add src/format.cc to source_files.
  3. You should probably not define FMT_USE_CONSTEXPR=1 and let the library detect if constexpr is supported.

If you properly exclude src/fmt.cc from the build fmt/compile.h shouldn't even be built because it is not included anywhere.

@priteshrnandgaonkar
Copy link
Author

I tried by removing -DFMT_HEADER_ONLY=1 as well got the same error.

I am using it with Folly. And it is being refferred in folly/portability/FmtCompile.h:19, so thats how the header is being reffered. The fmt pod in itself builds, but when I use it with folly it throws the above error.

Screen Shot 2021-04-28 at 3 52 07 PM

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

Please post the compiler invocation command and full error with context as text, not screenshot.

@priteshrnandgaonkar
Copy link
Author

Here are the the full definition of podspec files

From the logs I am able to see the following command caused an issue. Hopefully this helps.

CompileC /Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/Singleton.o /var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-Folly/folly/Singleton.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Flipper-Folly' from project 'Pods')
        cd /var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods
        export LANG\=en_US.US-ASCII
        /Applications/Xcode_12.0.0_fb.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target x86_64-apple-ios10.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=c++1z -stdlib\=libc++ -fmodules -fmodules-cache-path\=/Users/prit91/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/prit91/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DPOD_CONFIGURATION_RELEASE\=1 -DCOCOAPODS\=1 -isysroot /Applications/Xcode_12.0.0_fb.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -I/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Products/Release-iphonesimulator/Flipper-Folly/include -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Private -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Private/Flipper-Folly -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Public -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Public/Flipper-Fmt -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Public/Flipper-Folly -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Headers/Public/libevent -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-Folly -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/boost-for-react-native -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-DoubleConversion -I/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/libevent/include -I/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/DerivedSources-normal/x86_64 -I/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/DerivedSources/x86_64 -I/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/DerivedSources -F/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Products/Release-iphonesimulator/Flipper-Folly -F/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-DoubleConversion/Frameworks -F/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-Glog/Frameworks -F/var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/OpenSSL-Universal/Frameworks -F/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/OpenSSL -F/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/double-conversion -F/Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Products/Release-iphonesimulator/XCFrameworkIntermediates/glog -Wincomplete-umbrella -DFMT_HEADER_ONLY\=1 -DFMT_USE_CONSTEXPR\=1 -DFOLLY_HAVE_BACKTRACE\=1 -DFOLLY_HAVE_CLOCK_GETTIME\=1 -DFOLLY_HAVE_PTHREAD\=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -DFOLLY_HAVE_LIBGFLAGS\=0 -DFOLLY_HAVE_LIBJEMALLOC\=0 -DFOLLY_HAVE_PREADV\=0 -DFOLLY_HAVE_PWRITEV\=0 -DFOLLY_HAVE_TFO\=0 -frtti -fexceptions -std\=c++14 -Wno-error -Wno-unused-local-typedefs -Wno-unused-variable -Wno-sign-compare -Wno-comment -Wno-return-type -Wno-global-constructors -Wno-comma -include /var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Target\ Support\ Files/Flipper-Folly/Flipper-Folly-prefix.pch -MMD -MT dependencies -MF /Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/Singleton.d --serialize-diagnostics /Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/Singleton.dia -c /var/folders/c0/qw29qzkj5v39hgrxsz1bcsd5h2zh96/T/CocoaPods-Lint-20210428-44830-sye0d1-Flipper-Folly/Pods/Flipper-Folly/folly/Singleton.cpp -o /Users/prit91/Library/Developer/Xcode/DerivedData/App-eypxktjqzwzjlgehsbremdyrpgpa/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/Singleton.o

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

Could you post the complete build log?

@priteshrnandgaonkar
Copy link
Author

Here is the entire log

@vitaut
Copy link
Contributor

vitaut commented Apr 28, 2021

Thanks for providing the build log. The problem is that FMT_COMPILE requires if constexpr which your compiler doesn't support. I've implemented a workaround in 355be4b.

@priteshrnandgaonkar
Copy link
Author

Awesome! Let me try with this changes. Fingers crossed.

@priteshrnandgaonkar
Copy link
Author

This problem was solved. Thanks a lot for a quick fix. :)

@vitaut vitaut closed this as completed Apr 28, 2021
pavel-odintsov added a commit to pavel-odintsov/fastnetmon that referenced this issue May 3, 2022
…fmtlib/fmt#2261

error: no matching function for call to 'compile<int, int, int,
int>(build_ipv4_address_from_array(std::array<unsigned char, 4>,
std::string&)::<lambda()>::FMT_COMPILE_STRING)'
   648 |   constexpr auto compiled = detail::compile<Args...>(S());
       |                             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants