Closed toygg96 closed 2 years ago
How about the below?
$ source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux
$ export CC=${CLANGCC}
$ export CXX=${CLANGCXX}
$ flutter-elinux build elinux --target-arch=arm64 --target-compiler-triple=aarch64-poky-linux
How about the below?
$ source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux $ export CC=${CLANGCC} $ export CXX=${CLANGCXX} $ flutter-elinux build elinux --target-arch=arm64 --target-compiler-triple=aarch64-poky-linux
Yes I did those.
You used --system-include-directories=/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu -v
option, right? Would you please update your comment(issue) with the command you tried and the error correctly?
Hi Matsubayashi,
Commands Run: $ source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux $ export CC=${CLANGCC} $ export CXX=${CLANGCXX} $ flutter-elinux build elinux --target-arch=arm64 --target-compiler-triple=aarch64-poky-linux
Failed to cmake build: Scanning dependencies of target flutter_assemble [ 0%] Built target flutter_assemble Scanning dependencies of target flutter_wrapper_plugin [ 7%] Building CXX object flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o
In file included from /opt/flutter-elinux/sample/elinux/flutter/ephemeral/cpp_client_wrapper/core_impl ementations.cc:16: //lib/gcc-cross/aarch64-linux-gnu/9/../../../../include/c++/9/cassert:43:10: fatal error: 'bits/c++config.h' file not found
^~~~~~~~~~~~~~~~~~
1 error generated. make[2]: [flutter/CMakeFiles/flutter_wrapper_plugin.dir/build.make:63: flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:118: flutter/CMakeFiles/flutter_wrapper_plugin.dir/all] Error 2 make: *** [Makefile:130: all] Error 2
If I use the "--system-include-directories" option (https://github.com/sony/flutter-elinux/wiki/Building-flutter-apps#troubleshooting), it gives a different error.
Commands Run: $ source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux $ export CC=${CLANGCC} $ export CXX=${CLANGCXX} $ flutter-elinux build elinux --target-arch=arm64 \ --target-compiler-triple=aarch64-poky-linux --system-include-directories=/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu -v
Failed to cmake build: Scanning dependencies of target flutter_assemble [ 0%] Built target flutter_assemble Scanning dependencies of target flutter_wrapper_plugin [ 7%] Building CXX object
flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o
In file included from
/opt/flutter-elinux/sample/elinux/flutter/ephemeral/cpp_client_wrapper/core_impl ementations.cc:21: In file included from
/opt/flutter-elinux/sample/elinux/flutter/ephemeral/cpp_client_wrapper/include/f lutter/engine_method_result.h:8:
//lib/gcc-cross/aarch64-linux-gnu/9/../../../../include/c++/9/memory:121:25:
error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned
int') loses
information
const auto intptr = reinterpret_cast~~~~~~~~~
1 error generated.
make[2]: ***
[flutter/CMakeFiles/flutter_wrapper_plugin.dir/build.make:63:
flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:118: flutter/CMakeFiles/flutter_wrapper_plugin.dir/all] Error 2 make: [Makefile:130: all] Error 2 [ +5 ms]
(package:flutter_tools/src/base/common.dart:10:3)
(package:flutter_elinux/elinux_build_target.dart:387:7)
<asynchronous suspension>
#2 ELinuxBuilder.buildBundle
(package:flutter_elinux/elinux_builder.dart:135:7)
<asynchronous suspension>
#3 BuildPackageCommand.runCommand
(package:flutter_elinux/commands/build.dart:121:5)
<asynchronous suspension>
#4 FlutterCommand.run.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command.dart:1161:27)
<asynchronous suspension>
#5 AppContext.run.<anonymous closure>
(package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#6 CommandRunner.runCommand
(package:args/command_runner.dart:209:13)
Could you use --target-sysroot
option? I successed the build using its option.
$ sudo mv /opt/poky/3.1.16/sysroots/x86_64-pokysdk-linux/usr/bin/ld /opt/poky/3.1.16/sysroots/x86_64-pokysdk-linux/usr/bin/ld.x86_64
$ sudo cp -a /opt/poky/3.1.16/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-ld /opt/poky/3.1.16/sysroots/x86_64-pokysdk-linux/usr/bin/ld
$ source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux
$ export CC=${CLANGCC}
$ export CXX=${CLANGCXX}
$ flutter-elinux build elinux --target-arch=arm64 --target-compiler-triple=aarch64-poky-linux --target-sysroot=/opt/poky/3.1.16/sysroots/aarch64-poky-linux
Also, I updated Case 2: Use Yocto SDK.
I'll close this issue, but please let me know if you have still any problems.
Hi Matsubayashi,
This command "flutter-elinux build elinux --target-arch=arm64 --target-compiler-triple=aarch64-poky-linux --target-sysroot=/opt/poky/3.1.16/sysroots/aarch64-poky-linux" works.
It is strange that I tried that command before and it didn't work with the exact same steps. Probably now it works because my Poky version is now 3.1.16?
Anyways, Thanks for your help :)
It sounds nice. You're welcome.
Hi @HidenoriMatsubayashi ,
I followed the guide in https://github.com/sony/meta-flutter to cross build using Yocto sdk (Skipped Cross-building using bitbake section). Everything succeeded. Then, I ran "source /opt/poky/3.1.15/environment-setup-aarch64-poky-linux" , "export CC=${CLANGCC}" and "export CXX=${CLANGCXX}". After that, I tried to run "flutter-elinux build elinux --target-arch=arm64 \ --target-compiler-triple=aarch64-poky-linux --system-include-directories=/usr/aarch64-linux-gnu/include/c++/9/aarch64-linux-gnu -v" in https://github.com/sony/flutter-elinux/wiki/Building-flutter-apps#case-2-use-yocto-sdk.
But it gave me the following errors: [ +96 ms] executing: [/opt/flutter-elinux/sample/build/elinux/arm64/release/] cmake -DCMAKE_BUILD_TYPE=Release -DFLUTTER_TARGET_BACKEND_TYPE=wayland -DFLUTTER_TARGET_PLATFORM_SYSROOT=/ -DFLUTTER_SYSTEM_INCLUDE_DIRECTORIES=/usr/aarch64-linux-gnu/include/c++/9/aarch6 4-linux-gnu -DCMAKE_C_COMPILER_TARGET=aarch64-poky-linux -DCMAKE_CXX_COMPILER_TARGET=aarch64-poky-linux /opt/flutter-elinux/sample/elinux [ +225 ms] -- Toolchain file defaulted to '/opt/poky/3.1.15/sysroots/x86_64-pokysdk-linux/usr/share/cmake/OEToolchainConfi g.cmake' -- The CXX compiler identification is Clang 10.0.1 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done -- Generating done -- Build files have been written to: /opt/flutter-elinux/sample/build/elinux/arm64/release [ ] executing: [/opt/flutter-elinux/sample/build/elinux/arm64/release/] cmake --build . [ +821 ms] Scanning dependencies of target flutter_assemble [ 0%] Built target flutter_assemble Scanning dependencies of target flutter_wrapper_plugin [ 7%] Building CXX object flutter/CMakeFiles/flutter_wrapperplugin.dir/ephemeral/cpp client_wrapper/core_implementations.cc.o
[ +21 ms] Building an eLinux application with wayland backend in release mode for arm64 target... (completed in 1,833ms) [ ] "flutter elinux" took 2,504ms. [ +7 ms] Failed to cmake build: Scanning dependencies of target flutter_assemble [ 0%] Built target flutter_assemble Scanning dependencies of target flutter_wrapper_plugin [ 7%] Building CXX object
flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o
/opt/flutter-elinux/sample/elinux/flutter/ephemeral/cpp_client_wrapper/core_impl ementations.cc:21: In file included from
/opt/flutter-elinux/sample/elinux/flutter/ephemeral/cpp_client_wrapper/include/f lutter/engine_method_result.h:8:
//lib/gcc-cross/aarch64-linux-gnu/9/../../../../include/c++/9/memory:121:25: error: cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information const auto intptr = reinterpret_cast( ptr);
^
~~~~~~~~~ 1 error generated. make[2]: *** [flutter/CMakeFiles/flutter_wrapper_plugin.dir/build.make:63:flutter/CMakeFiles/flutter_wrapper_plugin.dir/ephemeral/cpp_clientwrapper/core implementations.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:118: flutter/CMakeFiles/flutter_wrapper_plugin.dir/all] Error 2 make: [Makefile:130: all] Error 2 [ +9 ms] 0 throwToolExit (package:flutter_tools/src/base/common.dart:10:3) 1 NativeBundle.build (package:flutter_elinux/elinux_build_target.dart:387:7)