2

I Try to clone a Flutter project and it success running in Windows, but when i run in Linux i got error like this.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bitmap:externalNativeBuildDebug'.
> Build command failed.
Error while executing process /home/wahyu/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/android/.cxx/cmake/debug/armeabi-v7a --target bitmap}
[1/2] Building CXX object CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o

  FAILED: /home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++  --target=armv7-none-linux-androideabi16 --gcc-toolchain=/home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/wahyu/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/sysroot  -Dbitmap_EXPORTS  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security   -O0 -fno-limit-debug-info  -fPIC -MD -MT CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o -MF CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o.d -o CMakeFiles/bitmap.dir/home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp.o -c /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp
In file included from /home/wahyu/.pub-cache/hosted/pub.dartlang.org/bitmap-0.1.2/ios/Classes/bitmap.cpp:1:
  In file included from /snap/flutter/current/usr/include/c++/8/stdlib.h:36:
  In file included from /snap/flutter/current/usr/include/c++/8/cstdlib:41:
  In file included from /snap/flutter/current/usr/include/x86_64-linux-gnu/c++/8/bits/c++config.h:508:
  In file included from /snap/flutter/current/usr/include/x86_64-linux-gnu/c++/8/bits/os_defines.h:39:
  In file included from /snap/flutter/current/usr/include/features.h:448:
  /snap/flutter/current/usr/include/x86_64-linux-gnu/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
  # include <gnu/stubs-32.h>
            ^~~~~~~~~~~~~~~~
  1 error generated.
  ninja: build stopped: subcommand failed.



* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1

I tried many things like ensure the Flutter version in my Windows and Linux are the same, reinstall the NDK, CMAKE etc but it doesnt help. is it always like this when we continue a project using Flutter?

What should i do? I never facing like this things when i continue a project in React Native.

Zeke
  • 107
  • 9

1 Answers1

3

The solution is if your flutter didn's install flutter via snap then simply running

sudo apt-get install libc6-dev-i386 (Ubuntu)

should fix the issue.

However this does NOT work for flutter installed via snap. First remove flutter with

sudo snap remove flutter

and reinstall flutter manually (Dont use snap) like in Flutter docs.

Zeke
  • 107
  • 9
  • thanks! the re-installation (with `git clone`) helped me, however no need to install `libc6-dev-i386` in my case. for reference, I described my case here https://github.com/flutter/flutter/issues/106102 – svonidze Jun 18 '22 at 13:38
  • What should be done in case of windows ? – Yogesh Chawla Jan 19 '23 at 11:15
  • @YogeshChawla if you have simila problem better asking this with own question. I believe on Windows it has a different cause. This exact problem seems to be related to snap package. – Petr Gladkikh Jul 18 '23 at 11:34