Open gaaclarke opened 1 month ago
Summary: The user is unable to embed Dart in a CMake project. They followed the instructions in the Dart documentation to link against a built Dart library, but encountered linking errors. The user was unable to find the necessary symbols, such as __ZN4dart11ObjectStore19LazyInitCoreMembersEv
, in the build libraries.
I would not go this route: e.g. I don't think we want to support wrapping build.py
into some other build system.
I think what we should do instead is:
Description
I attempted to create a new C++ project with CMake that would build against Dart and execute
Dart_VersionString()
using the Dart documentation. I was unable to do it, I got as far as linking but found no way to resolve the linking errors. For example, the symbol__ZN4dart11ObjectStore19LazyInitCoreMembersEv
was in none of the build libraries.We don't have to use cmake as a build system, but we should be able to use external build systems to embed Dart.
Seen results
Unable to use the instructions in https://github.com/dart-lang/sdk/blob/main/docs/Building.md to link against a built dart.
Expected results
I should be able to wrap Dart's build system and embed dart in a cmake project.
The code
main.cc
CMakeLists.txt
Notes
fetch dart
takes about 15 minutes and 15 GB of hard drive space.FetchContent_Declare
notExternalProject_Add
to make sure the headers exist forINTERFACE_INCLUDE_DIRECTORIES
. This created a really long configure process where nothing was printed out for 15 minutes. I had to useset(FETCHCONTENT_QUIET OFF)
to avoid that.fetch dart
doesn't allow you to pin to a specific version of Dart, which is what I'd want./tools/build.py -h
$
so it can't directly be pasted into the terminal./tools/build.py runtime
to see if that gave me the proper library files to link against, that didn't work either. It wasn't clear what that actually did compared tocreate_sdk
.