flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Home Page:https://flutter.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flutter engine host release build fails on macos

jwoelke opened this issue · comments

When I try to build the flutter engine host in release mode on macos, then this fails.
(no issues to build ios release build)

./flutter/tools/gn --runtime-mode=release
ninja -C out/host_release

On a macbook pro 2018 i7 with 16Gb mem, it at one points runs out of memory.
The last few hundred build steps (of 4000+) fail. The build then just freezes
e.g. at
LINK ./shell_benchmarks
or
LINK ./flutter_tester
or
SOLINK libFlutterMacOS.dylib libFlutterMacOS.dylib.TOC
....
It freezes not always on the same step!

I can build the host debug version without any issues
The same build on MacBook Pro i9 with 32Gb mem succeeds.

Are there any minimum memory requirements to build the macos host release?


Will compiling the app against an ios release build and using the host debug build result in the same build as using the host release build?


Next to the issue above with is not based on latest from master, the current master (12th of may) also fails but also creates different compilation errors:

_ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '__gxx_personality_v0' for architecture x86_64

What can i to do resolve these?


ninja: Entering directory `out/host_release'
[3915/4426] LINK ./fml_benchmarks
FAILED: fml_benchmarks
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_benchmarks -Wl,-filelist,./fml_benchmarks.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[3921/4426] LINK ./fml_unittests
FAILED: fml_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_unittests -Wl,-filelist,./fml_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[3922/4426] LINK ./common_cpp_core_unittests
FAILED: common_cpp_core_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./common_cpp_core_unittests -Wl,-filelist,./common_cpp_core_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[3923/4426] LINK ./client_wrapper_glfw_unittests
FAILED: client_wrapper_glfw_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./client_wrapper_glfw_unittests -Wl,-filelist,./client_wrapper_glfw_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[3924/4426] LINK ./client_wrapper_unittests
FAILED: client_wrapper_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./client_wrapper_unittests -Wl,-filelist,./client_wrapper_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Try disabling link-time optimization by passing the --no-lto flag to flutter/tools/gn

This seems to solve both issues
(./flutter/tools/gn --no-lto --runtime-mode=release)

Since this applies to the build tools, could this in any way affect optimisation for the generated flutter app (AOT/release build)?

@jwoelke Yes, it affects optimization. Your builds were working correctly it just takes a LONG time to link with link-time-optimization. Walk away and have a coffee.

Hello! I'm seeing the same issue when building the engine. I'm on MacOS 10.15.7 with Xcode 12.1. I'm trying to build the engine on 1d12d82d9cb54876f58044aa52198d53ec841c3d.

ninja: Entering directory `out/host_release'
[4741/5757] LINK ./font-subset
FAILED: font-subset
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./font-subset -Wl,-filelist,./font-subset.rsp  -framework Foundation -framework CoreGraphics -framework CoreText
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4751/5757] LINK ./fml_benchmarks
FAILED: fml_benchmarks
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_benchmarks -Wl,-filelist,./fml_benchmarks.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4752/5757] LINK ./fml_unittests
FAILED: fml_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./fml_unittests -Wl,-filelist,./fml_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4754/5757] LINK ./common_cpp_core_unittests
FAILED: common_cpp_core_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./common_cpp_core_unittests -Wl,-filelist,./common_cpp_core_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4755/5757] LINK ./client_wrapper_glfw_unittests
FAILED: client_wrapper_glfw_unittests
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./client_wrapper_glfw_unittests -Wl,-filelist,./client_wrapper_glfw_unittests.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4756/5757] LINK ./client_wrapper_unittests_legacy_encodable_value
FAILED: client_wrapper_unittests_legacy_encodable_value
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.11.0 -flto -arch x86_64 -nostdlib++ -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie  -Xlinker -rpath -Xlinker @executable_path/Frameworks -o ./client_wrapper_unittests_legacy_encodable_value -Wl,-filelist,./client_wrapper_unittests_legacy_encodable_value.rsp  -framework Foundation -ldl -lpthread
ld: reference to bitcode symbol '___gxx_personality_v0' which LTO has not compiled in '___gxx_personality_v0' for architecture x86_64
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
[4758/5757] LINK ./gen_snapshot_product
ninja: build stopped: subcommand failed.

Does the --no-lto affect performance of the generated flutter app or only affects the build time?

I am having the same issue using the master branch and the --no-lto flag

I am having the same issue using the master branch and the --no-lto flag

+1 me too

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.