flutter-go-bridge
flutter-go-bridge copied to clipboard
Unable to find stdlib.h when closely following example app.
Hey,
I'm closely following the example app, with a go directory and hook/build.dart that is identical to the example app apart from a single Go function I added to test out the functionality, and I've tried everything I can think of to get this to build successfully without success. I have zero experience with c... I've been trying to avoid it for the 10 years I've done this... and I've tried everything I can think of.
For what it's worth, I'm on an M1 macbook pro. The package would be amazing if I can get it to work... I spent all night last night working offline, trying to write a script that would compile Go to the various architectures and operating systems, and wound up with some jumbled mess that I was scared to touch so I didn't break it.
Launching lib/main.dart on macOS in debug mode...
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:00008103-001318D92EBB001E, name:My Mac }
{ platform:macOS, arch:x86_64, id:00008103-001318D92EBB001E, name:My Mac }
Unhandled exception:
ProcessException: Full command string: 'CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared '-ldflags=-s -w' -o /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/out/libulld.dylib /Users/bigsexy/Desktop/flutter/ulld/go/bridge'.
Exit code: '1'.
For the output of the process check the logger output.
Command: go build -buildmode=c-shared -ldflags=-s -w -o /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/out/libulld.dylib /Users/bigsexy/Desktop/flutter/ulld/go/bridge
#0 runProcess (package:native_toolchain_go/run_process.dart:94:5)
<asynchronous suspension>
#1 GoBuilder.run (package:native_toolchain_go/go_native_toolchain.dart:133:7)
<asynchronous suspension>
#2 main.<anonymous closure> (file:///Users/bigsexy/Desktop/flutter/ulld/hook/build.dart:16:5)
<asynchronous suspension>
#3 build (package:native_assets_cli/src/api/build.dart:94:3)
<asynchronous suspension>
#4 main (file:///Users/bigsexy/Desktop/flutter/ulld/hook/build.dart:6:3)
<asynchronous suspension>
Building assets for package:ulld failed.
build.dart returned with exit code: 255.
To reproduce run:
/Users/bigsexy/development/flutter/bin/cache/dart-sdk/bin/dart --packages=/Users/bigsexy/Desktop/flutter/ulld/.dart_tool/package_config.json /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/hook.dill --config=/Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/input.json
stderr:
Unhandled exception:
ProcessException: Full command string: 'CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared '-ldflags=-s -w' -o /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/out/libulld.dylib /Users/bigsexy/Desktop/flutter/ulld/go/bridge'.
Exit code: '1'.
For the output of the process check the logger output.
Command: go build -buildmode=c-shared -ldflags=-s -w -o /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/out/libulld.dylib /Users/bigsexy/Desktop/flutter/ulld/go/bridge
#0 runProcess (package:native_toolchain_go/run_process.dart:94:5)
<asynchronous suspension>
#1 GoBuilder.run (package:native_toolchain_go/go_native_toolchain.dart:133:7)
<asynchronous suspension>
#2 main.<anonymous closure> (file:///Users/bigsexy/Desktop/flutter/ulld/hook/build.dart:16:5)
<asynchronous suspension>
#3 build (package:native_assets_cli/src/api/build.dart:94:3)
<asynchronous suspension>
#4 main (file:///Users/bigsexy/Desktop/flutter/ulld/hook/build.dart:6:3)
<asynchronous suspension>
stdout:
Using compiler /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang from BuildConfig.cCompiler.cc.
Trying to recognize file:///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang.
Running `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version`.
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Tool instance file:///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang is likely Tool(Apple Clang).
Looking up version with --version for ToolInstance(Apple Clang, null, file:///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang).
Running `/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version`.
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found version for ToolInstance(Apple Clang, 16.0.0, file:///Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang).
Running `CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -buildmode=c-shared '-ldflags=-s -w' -o /Users/bigsexy/Desktop/flutter/ulld/.dart_tool/native_assets_builder/ulld/ca4e7d3d4e7b8912cbd24d9e8a6cecdc/out/libulld.dylib /Users/bigsexy/Desktop/flutter/ulld/go/bridge`.
# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
Target dart_build failed: Error: Building native assets failed. See the logs for more details.
Command PhaseScriptExecution failed with a nonzero exit code
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Flutter Assemble' from project 'Runner')
** BUILD FAILED **
Building macOS application...
Error: Build process failed