Flutter doesn't build for Linux

Hi Everyone.
I have a problem, I can’t run flutter app in clear Linux, because when I run command “Flutter run -d linux”, I have error that I don’t know what needs to be done to solve this error.

CMake Error at /usr/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):
  The C++ compiler                                                      
                                                                        
    "/usr/bin/clang++"                                                  
                                                                        
  is not able to compile a simple test program.                         
                                                                        
  It fails with the following output:                                   
                                                                        
    Change Dir: /home/BadGuy/My practice/first/build/linux/release/CMakeFiles/CMakeTmp
                                                                        
    Run Build Command(s):/usr/bin/ninja cmTC_84ece && [1/2] Building CXX object CMakeFiles/cmTC_84ece.dir/testCXXCompiler.cxx.o
    FAILED: CMakeFiles/cmTC_84ece.dir/testCXXCompiler.cxx.o             
    /usr/bin/clang++   -g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-trapping-math -Wl,-sort-common -Wl,--enable-new-dtags -mtune=skylake -Wa,-mbranches-within-32B-boundaries -fvisibility-inlines-hidden -Wl,--enable-new-dtags -MD -MT CMakeFiles/cmTC_84ece.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_84ece.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_84ece.dir/testCXXCompiler.cxx.o -c testCXXCompiler.cxx
    clang-10: warning: -Wl,-z: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,now: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,-z: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,relro: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,-sort-common: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,--enable-new-dtags: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: warning: -Wl,--enable-new-dtags: 'linker' input unused [-Wunused-command-line-argument]
    clang-10: error: unsupported argument '-mbranches-within-32B-boundaries' to option 'Wa,'
    clang-10: warning: optimization flag '-ftree-loop-distribute-patterns' is not supported [-Wignored-optimization-argument]
    clang-10: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument]
    ninja: build stopped: subcommand failed.                            
                                                                        
                                                                        
                                                                        
                                                                        
                                                                        
  CMake will not be able to correctly generate this project.            
Call Stack (most recent call first):                                    
  CMakeLists.txt:2 (project)

report this bug to upstream

It looks like the clang++ compiler supports -mbranches-within-32B-boundaries directly. It doesn’t accept it as a Wa parameter. In other words, try removing the -Wa, before this parameter and run the compile again.

1 Like