mikeperri / flutter_sequencer

A Flutter plugin for music sequencing.
Other
90 stars 38 forks source link

C++ versions less than C++14 are not supported #45

Open e1ke opened 10 months ago

e1ke commented 10 months ago

Hi Mike,

we had contact a few months ago, thank you again for this great Flutter plugin. I tried to run my App on my Windows environment but sady it throws an error. It looks like the cpp 'Abseil' lib is having issues:

Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_sequencer:buildCMakeDebug[arm64-v8a]'.
> Build command failed.
  Error while executing process C:\Users\User\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_sequencer-0.4.4\android\.cxx\Debug\q4z721e5\arm64-v8a flutter_sequencer st_info}
  ninja: Entering directory `C:\Users\User\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\flutter_sequencer-0.4.4\android\.cxx\Debug\q4z721e5\arm64-v8a'
  [1/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/common/Trace.cpp.o
  [2/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/common/Version.cpp.o
  [3/300] Building CXX object CMakeFiles/flutter_sequencer.dir/2852f6eb9954769251f343469ca232d0/ios/Classes/CallbackManager/CallbackManager.cpp.o
  [4/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/opensles/EngineOpenSLES.cpp.o
  [5/300] Building CXX object CMakeFiles/flutter_sequencer.dir/2852f6eb9954769251f343469ca232d0/ios/Classes/Scheduler/BaseScheduler.cpp.o
  [6/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/common/StabilizedCallback.cpp.o
  [7/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/opensles/OpenSLESUtilities.cpp.o
  [8/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/opensles/AudioStreamBuffered.cpp.o
  [9/300] Building C object third_party/sfizz/CMakeFiles/sfizz_cephes.dir/external/cephes/src/chbevl.c.o
  [10/300] Building C object third_party/sfizz/CMakeFiles/sfizz_kissfft.dir/src/external/kiss_fft/tools/kiss_fftr.c.o
  [11/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/opensles/AudioStreamOpenSLES.cpp.o
  [12/300] Building CXX object build/oboe/CMakeFiles/oboe.dir/src/opensles/OutputMixerOpenSLES.cpp.o
  [13/300] Building C object third_party/sfizz/CMakeFiles/sfizz_cephes.dir/external/cephes/src/i0.c.o
  [14/300] Building C object third_party/sfizz/CMakeFiles/sfizz_kissfft.dir/src/external/kiss_fft/kiss_fft.c.o
  [15/300] Building CXX object third_party/sfizz/CMakeFiles/sfizz_spline.dir/src/external/spline/spline/spline.cpp.o
  [16/300] Building CXX object third_party/sfizz/CMakeFiles/sfizz_cpuid.dir/src/external/cpuid/src/cpuid/cpuinfo.cpp.o
  [17/300] Building CXX object third_party/sfizz/CMakeFiles/sfizz_cpuid.dir/src/external/cpuid/src/cpuid/version.cpp.o
  [18/300] Linking C static library third_party\sfizz\libsfizz_cephes.a
  [19/300] Building CXX object third_party/sfizz/external/abseil-cpp/absl/base/CMakeFiles/absl_spinlock_wait.dir/internal/spinlock_wait.cc.o
  FAILED: third_party/sfizz/external/abseil-cpp/absl/base/CMakeFiles/absl_spinlock_wait.dir/internal/spinlock_wait.cc.o 
  C:\Users\User\AppData\Local\Android\Sdk\ndk\22.1.7171670\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=C:/Users/User/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/User/AppData/Local/Android/Sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/windows-x86_64/sysroot  -I../../../.././third_party/oboe/include -I../../../.././third_party/TinySoundFont -I../../../../third_party/sfizz/external/abseil-cpp -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -std=c++14 -frelaxed-template-template-args -O0 -fno-limit-debug-info  -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wno-multichar -Werror=return-type -Wcast-qual -Wconversion -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wfor-loop-analysis -Wformat-security -Wgnu-redeclared-enum -Winfinite-recursion -Winvalid-constexpr -Wliteral-conversion -Wmissing-declarations -Woverlength-strings -Wpointer-arith -Wself-assign -Wshadow-all -Wshorten-64-to-32 -Wsign-conversion -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-zero-compare -Wundef -Wuninitialized -Wunreachable-code -Wunused-comparison -Wunused-local-typedefs -Wunused-result -Wvla -Wwrite-strings -Wno-float-conversion -Wno-implicit-float-conversion -Wno-implicit-int-float-conversion -Wno-unknown-warning-option -DNOMINMAX -std=gnu++11 -MD -MT third_party/sfizz/external/abseil-cpp/absl/base/CMakeFiles/absl_spinlock_wait.dir/internal/spinlock_wait.cc.o -MF third_party\sfizz\external\abseil-cpp\absl\base\CMakeFiles\absl_spinlock_wait.dir\internal\spinlock_wait.cc.o.d -o third_party/sfizz/external/abseil-cpp/absl/base/CMakeFiles/absl_spinlock_wait.dir/internal/spinlock_wait.cc.o -c ../../../../third_party/sfizz/external/abseil-cpp/absl/base/internal/spinlock_wait.cc
  In file included from ../../../../third_party/sfizz/external/abseil-cpp/absl/base/internal/spinlock_wait.cc:22:
  In file included from ../../../../third_party/sfizz/external/abseil-cpp\absl/base/internal/spinlock_wait.h:24:
  In file included from ../../../../third_party/sfizz/external/abseil-cpp\absl/base/internal/scheduling_mode.h:21:
  In file included from ../../../../third_party/sfizz/external/abseil-cpp\absl/base/config.h:86:
  ../../../../third_party/sfizz/external/abseil-cpp\absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."
  #error "C++ versions less than C++14 are not supported."
   ^
  1 error generated.

could I somehow help you, updating this plugin? Do you need more information? I found these hints on my research: https://github.com/protocolbuffers/protobuf/issues/12393 https://stackoverflow.com/questions/75850778/error-c-versions-less-than-c14-are-not-supported-in-bazel-how-to-resolve

dbrowne11 commented 9 months ago

I just ran into a similar issue. I added flutter sequencer to a pretty much clean project targeting android and developing on windows. So far I've found adjusting CMAKE_CXX_STANDARD in CMakeLists.txt has some affect. Oddly even with CXX 17, I get the message that versions < C++14 are not supported. Changing to CXX 14, 20, or 23 yield other errors loading the same (abseil) library. Let me know if you've found a solution or made other progress, I'd like to solve this and submit a PR if necessary.

LeventeAsztalos commented 6 months ago

@dbrowne11 @e1ke Could you solve this issue? I get the same error when I try to build to android with an M1 mac.

e1ke commented 6 months ago

no, unfortunately I could not solve the issue. I used the flutter_sequencer to get a clean metronome but because of this issue i changed my app to sadly not use this package anymore. Instead I tried to implement my own algorithm for a metronome on point but I am still struggling with it

LeventeAsztalos commented 6 months ago

I think I found the problem. Sfizz, which checked out as a third party repo with a given commit cloneThirdPartyRepo('sfizz', 'https://github.com/sfztools/sfizz.git', 'fc1f0451cebd8996992cbc4f983fcf76b03295c5') uses abseil-cpp as a submodule.

Based on the .gitsubmodules file in the sfizz folder, it should check out the branch = lts_2020_02_25, but if you check the version with git submodule status abseil-cpp, it actually checks out the latest version.

I updated the the submodules at android/third_party/sfizz:

git submodule init
git submodule update

Then I deleted the android/.cxx folder. After this when I tried to rebuilt my project, it built successfully.

I am not sure how to fix this in the package, as the problem is in the checked out sfizz repo I think.