p-hatan/ mirror

pub repository

mirror.p-hatan.com

native_toolchain_c

0.19.3

A library to invoke the native C compiler installed on the host machine.

Download archive

Readme

dart Coverage Status pub package package publisher

A library to invoke the native C compiler installed on the host machine.

Status: Experimental

NOTE: This package is currently experimental and published under the labs.dart.dev pub publisher in order to solicit feedback.

For packages in the labs.dart.dev publisher we generally plan to either graduate the package into a supported publisher (dart.dev, tools.dart.dev) after a period of feedback and iteration, or discontinue the package. These packages have a much higher expected rate of API and breaking changes.

Your feedback is valuable and will help us evolve this package. For bugs, please file an issue in the bug tracker.

Example

An example can be found in ../hooks/example/build/.

Changelog

0.19.3

  • Fixed building with MSVC on Windows when a source, include, or output path contains a space (e.g. a user name with a space in the default pub cache location). The compiler and archiver are now invoked directly instead of through cmd.exe, whose quote handling mangled such command lines. As a consequence, cmd.exe environment variable expansion (%VAR%) no longer applies to compiler flags and defines; they are passed to the tools verbatim.
  • The MSVC archiver is now passed the object file names derived from the sources instead of *.obj, so object files left in the output directory by other builds are no longer swept into the archive, and archive member names no longer embed the local build directory path.
  • Support cross-compiling to Linux from macOS and Windows hosts. (#2185)

0.19.2

  • Fixed compatibility with newer Xcode versions when cross-compiling static libraries on macOS hosts targeting Android and Linux.

0.19.1

  • Added support for passing sanitizer flags (-fsanitize=address, -fsanitize=memory, -fsanitize=thread) to C compilers and linkers.
  • Depend on package:code_assets ^1.2.0.

0.19.0

  • Bumped dependency on package:code_assets to ^1.1.0 and package:hooks to ^2.0.0.

0.18.0

  • Made CLinker.run Logger argument optional. It now defaults to a logger printing to stdout and stderr.
  • For LinkerOptions.treeshake, skip bundling a dynamic library if symbolsToKeep is empty.

0.17.6

  • On Android, use the NDK's libc++.a linker script when cppLinkStdLib is 'c++_static'. This ensures both libc++_static and libc++abi are linked, fixing dlopen failures on newer Android versions caused by missing C++ ABI symbols. (#3240)

0.17.5

  • Search for NDK in ANDROID_HOME and ANDROID_NDK environment variables.
  • On iOS and macOS, use the -encryptable linker flag. This resolves an issue with app store rejections.
  • Fix unportable link arg when cross-compiling from MacOS.

0.17.4

  • For Windows, include errors from the standard output of cl in the logger's output of CBuilder. (#2809)

0.17.3

  • Bump package:hooks and package:code_assetsto 1.0.0.

0.17.2

  • Made CBuilder.run Logger argument optional. It now defaults to a logger printing to stdout and stderr. (Technically this is a breaking change on passing null explicitly, but I doubt anyone is using it like that.)
  • Broaden compiler tool discovery

0.17.1

  • Bump package:hooks and package:code_assetsto 0.20.0.

0.17.0

  • Fix treeshaking on mac.

0.16.8

  • Support building assets for packages which are not the input package.

0.16.7

  • Support Module Definitions for linking on Windows.

0.16.6

  • Support linking for Windows.

0.16.5

  • Support linking for iOS.

0.16.4

  • Support linking for MacOS.

0.16.3

  • Support linking for Android.

0.16.2

  • Bump the SDK constraint to at least the one from package:hooks to fix dartdoc generation on https://pub.dev.

0.16.1

  • Firebase Studio NixOS support (default install locations for native toolchains).

0.16.0

  • Depend on package:code_assets and package:hooks 0.19.0. (package:native_assets_cli was split up into these packages.)

0.15.0

  • Bump package:native_assets_cli to 0.18.0.

0.14.0

  • Bump package:native_assets_cli to 0.17.0.

0.13.0

  • Bump package:native_assets_cli to 0.16.0.

0.12.0

  • Bump package:native_assets_cli to 0.16.0.

0.11.0

  • Replace linkInPackage with Routing.
  • Bump package:native_assets_cli to 0.14.0.

0.10.0

  • Bump package:native_assets_cli to 0.13.0 and required fixes.

0.9.0

  • Added support for forced includes to CBuilder.
  • Toolchain recognizing fixes.
  • Bump package:native_assets_cli to 0.12.0.

0.8.0

  • Bump package:native_assets_cli to 0.11.0.
  • Support for LLVM Clang on Windows (requires MSVC to be installed).

0.7.0

0.6.0

  • Address analyzer info diagnostic about multi-line if requiring a block body.
  • Bump package:native_assets_cli to 0.9.0. This makes package:native_toolchain_c now take BuildOutputBuilder and LinkOutputBuilder objects.

0.5.4

  • Bump package:native_assets_cli to 0.8.0.

0.5.3

  • Fix internal bug in LinkerOptions.
  • Bump package:native_assets_cli to 0.7.3.

0.5.2

  • Deprecated CBuilder's constructors dartBuildFiles. The Dart sources are automatically used for determining whether hooks need to be rerun by newer Dart and Flutter SDKs.

0.5.1

  • Bump package:native_assets_cli to 0.7.0.

0.5.0

  • Renamed parameters in Builder.run.
  • Added Language.objectiveC.
  • Use HookConfig.targetIosSdk and HookConfig.targetMacosSdk optional values, and pass them to the clang compiler.

0.4.2

  • Bump package:native_assets_cli to 0.5.0.

0.4.1

0.4.0

0.3.4+1

  • Stop depending on private package:native_assets_cli CCompilerConfig fields.

0.3.4

  • Bump package:native_assets_cli to 0.4.0.

0.3.3

  • Export environmentFromBatchFile.
  • Bump package:native_assets_cli to 0.3.2.

0.3.2

  • Added workaround minSdkVersion 19 and 20 for Android.
  • Start using sysroot for Android.
  • Added tests for up to Android API version 34.

0.3.1

  • Added MSVC arm64 toolchain.

0.3.0

  • Bump package:native_assets_cli to 0.3.0.

0.2.5

  • Explicitly tell linker to create position dependent or position independent executable (#113).

0.2.4

  • Added includes for specifying include directories.
  • Added flags for specifying arbitrary compiler flags.
  • Added std for specifying a language standard.
  • Added language for selecting the language (c and cpp) to compile source files as.
  • Added cppLinkStdLib for specifying the C++ standard library to link against.

0.2.3

  • Fix MSVC tool resolution inside (x86) folder (#123).

0.2.2

  • Generate position independent code for libraries by default and add pic option to control this behavior.

0.2.1

  • Added defines for specifying custom defines.
  • Added buildModeDefine to toggle define for current build mode.
  • Added ndebugDefine to toggle define of NDEBUG for non-debug builds.

0.2.0

  • Breaking change Rename assetName to assetId (#100).
  • Added topics.

0.1.0

  • Initial version.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add native_toolchain_c
pubspec.yaml
name: native_toolchain_c
description: >-
  A library to invoke the native C compiler installed on the host machine.
version: 0.19.3
repository: https://github.com/dart-lang/native/tree/main/pkgs/native_toolchain_c

topics:
  - compiler
  - ffi
  - interop
  - native-assets
  - native-toolchain

resolution: workspace

environment:
  sdk: '>=3.10.0 <4.0.0'

dependencies:
  code_assets: ^1.2.0
  glob: ^2.1.1
  hooks: ^2.0.0
  logging: ^1.3.0
  meta: ^1.19.0
  pub_semver: ^2.2.0

dev_dependencies:
  collection: ^1.19.1
  dart_flutter_team_lints: ^3.5.2
  native_test_helpers:
    path: ../native_test_helpers/
  test: ^1.25.15
  test_case_selector:
    path: ../test_case_selector/
  test_descriptor: ^2.0.2

Version history

VersionPublishedArchiveSHA-256
0.1.02023-07-11T17:11:05.437788ZDownload968a06b366558228f36da720545c7896bb66f35c1af17175f3d8de79e052e3c1
0.2.02023-08-08T08:31:27.097158ZDownloadf1df3ff28fdbdad11992e2edbd874a60b5dcde42de9f4388952f00022d876671
0.2.12023-09-06T12:00:39.878706ZDownload71713c3bd3bcf09dc6e76a128cf2fa2870431a0ef8541db8565671f8b5d9f99e
0.2.22023-09-06T12:43:11.921292ZDownload78ad0b861a76d76b6ef2cc3f30fe64925ad21863baa95f020ba1fab7bce5e56a
0.2.32023-09-11T11:35:33.116872ZDownloadd5624d62289c98abf8843e38a8b7e19245bd7b518fa888ccac99e94633a44782
0.2.42023-09-14T10:32:04.478407ZDownloadc614a8e6a1e9e386013d22dc5a98b1576d0a8b9c2e3597d14945b87046555b2d
0.2.52023-09-18T11:43:05.318785ZDownload55cab6518a7446e58e507be944d92d067e6775e5ef33c85a53356ec1b7c8d5e6
0.3.02023-10-03T13:09:47.883772ZDownload9df6ff10acf73ba1d053350366d6c539ac2602f217be130a2330b0386c724dd2
0.3.12023-10-30T11:36:43.768305ZDownloadd0973e57e9d56c2392af81e859aebf9bcf46d83f5367bde897ef79fbde1488a9
0.3.22023-11-01T22:11:04.304411ZDownload33fb9767c82c50bcfe8da8081fa8d132e6c81d09252d8308d2b3b1acd6ef9081
0.3.32023-12-15T20:16:46.833913ZDownload26579e00aafdbcccdbe0cb095a1d7e32da6210aa6dc35864f58d11a20ca9942e
0.3.42024-01-11T22:05:33.562099ZDownload1ff8e805475edc2cd10615a8d504f03d0acb835021bd7a9cc897c4e708007d32
0.3.4+12024-01-16T10:57:03.461363ZDownload222673a967d44c56751b3192f494e58ac2aabba6fb9ecb97995d31308211ee9d
0.4.02024-03-22T13:04:13.590067ZDownload32f84370865904706011fed2cae675f47139a18f1aaa631f7f39094f5d727c37
0.4.12024-03-22T15:33:53.590227ZDownload1b1b86f47570378d0003f0d949fbb03b637ec9d2dcbcf698a16f7cbffb3a945c
0.4.22024-05-16T13:27:49.971203ZDownloadaec03fabbafed4a85d0168cbd4e2e800494381afafce482910a5b17e4e28825c
0.5.02024-07-05T19:24:02.450139ZDownloadc717526bbd2f29462d17887593cc5f55c57a2e912d132188e1ab14b468b11501
0.5.12024-07-10T10:01:33.982120ZDownloadcc7e7af76c9bfa4e06206f493a6d59c099fe6a017b388611ae79dbe725606b5c
0.5.22024-07-12T15:01:58.571245ZDownload6f4f327d9c131848a833652d758faf4bcb883af45afbb050fcd5ffa8b4e8029b
0.5.32024-09-02T09:52:01.458930ZDownloade227eb4873aaa6983191a6656557489b5a3c7d8f6221dccecb45506bb567359c
0.5.42024-09-13T12:18:59.546688ZDownload0a9eef56809904863c5387153001a74c67518e8709f86f95e070d2c712eadb54
0.6.02024-11-05T11:39:00.681172ZDownload3ef4f76600c5c900e335b8a106b1d5d41aee1c066146fa045994653a542c996b
0.7.02024-12-20T13:20:08.862485ZDownloada96452f019c8a1560cf47cb7ef3c68db6a74b18bd1e0c648986d7708014f93e6
0.8.02025-01-22T16:50:27.112270ZDownload544ae836ccfbeab22ab336eb3a052908c459372c7875bef4c7970299a18f90d8
0.9.02025-03-20T14:46:55.096550ZDownload60ecdc23618009379eb8d6c5971084e68b180eb69780b10034215f0f0eeff00a
0.10.02025-03-31T09:49:41.508791ZDownload47826bb55203aac93178981d8b3afbd3a9614a02f64668c5bd471d9113b36e73
0.11.02025-04-08T18:28:37.274484ZDownloade5b14abd4309f820817a48701dfd40d1fbd80a1d5fa2ce6838b758e952ea46d9
0.12.0-02025-04-11T07:51:07.276784ZDownload8a34c3b5e6d63d31fa06c19659324bf84f97c8c30f5f4c7f7a56174b9220c75e
0.12.02025-04-15T14:30:34.945543ZDownload82abfdd58c6c5f501f5641c5af4d40c81847ec7086eff8e163b901e910c21e6c
0.13.02025-04-16T17:07:04.235782ZDownloadcb09ab52c1b7a14206358fd45109d95f7d6851fe46a9b15e589ffcd29287dc76
0.14.02025-04-23T17:03:31.004973ZDownloade4248e901a66962375b4c99ee2153a7ef991249aa128ec202291392297a422b1
0.15.02025-04-29T09:56:19.574479ZDownload9b6e39258ebb1de99f5dd05aae66a62b68d7118af74028a8f2dcdc1c41e49e02
0.16.02025-05-01T07:26:48.014952ZDownload5607a7758fa79f537c4a911294e61a6b56886157fc37ad8671f34f0a4c61f4ee
0.16.12025-05-19T07:28:36.858705ZDownload17cd04ceb82cb889250475a32bdeabdb997ad67bc99cc630329d79117486733b
0.16.22025-05-21T14:25:16.119608ZDownload12a82543ee3540d7971808a25fc8c153694b7715f088a818cdaa3117ebe6878c
0.16.32025-06-12T11:11:24.254686ZDownload677cbc3c364121e65626853160dcb0f230399a65dbabf363155b5fdcb078c03e
0.16.42025-06-16T12:07:18.747984ZDownload02a4ce344981077ebaab9f6942b866460c03be57c47412271b6e38441773fec9
0.16.52025-06-17T08:50:26.591497ZDownload09d74aa91f0c791230d90222aa2f27c68f0de080aaacef55cdc9ff8ec173dd8b
0.16.62025-06-20T07:39:00.304339ZDownload99a7feeac19069bbaf3cf9a4d54f47fa54f3ea6da681f669a8761c80540a0838
0.16.72025-07-07T10:20:40.535270ZDownloadc1bf2d24a381ac45d931d509438a76f61aa74d6f4967023bc1a4a28d2f46f063
0.16.82025-07-10T07:12:14.221830ZDownload74a0c80d877c519bc6bde2c4e27b6b01c1f93c9b480f65ceae8bedd3aba3c086
0.17.02025-07-16T15:30:14.584997ZDownloade22164c9cc85c9ae259a4c8c577432f0e9a83da0c2bf82f9d207083a06c9444c
0.17.12025-08-04T11:29:28.759187ZDownload7e8358a4f6ec69a4f2d366bb971af298aca50d6c2e8a07be7c12d7f6d40460aa
0.17.22025-10-02T06:46:37.797882ZDownloadf8872ea6c7a50ce08db9ae280ca2b8efdd973157ce462826c82f3c3051d154ce
0.17.32025-11-07T15:23:47.710440ZDownload932ba84084915969879a044ab24342dde5f687a5c24208590c487f1af2317d21
0.17.42025-11-21T13:55:52.282444ZDownload89e83885ba09da5fdf2cdacc8002a712ca238c28b7f717910b34bcd27b0d03ac
0.17.52026-03-06T11:20:19.803376ZDownload92b2ca62c8bd2b8d2f267cdfccf9bfbdb7322f778f8f91b3ce5b5cda23a3899f
0.17.62026-03-17T13:47:39.446378ZDownload6ba77bb18063eebe9de401f5e6437e95e1438af0a87a3a39084fbd37c90df572
0.18.02026-04-21T09:34:04.622085ZDownload8aaead321425bd3f03bd5894aa27c8ea6993eab95531da7e59f5d39c6e5708ec
0.19.02026-05-18T20:06:40.073180ZDownload49c147aa4a5905ec12028e2b7bfe360eace6cb91fe4cf08a3fe76e309592acae
0.19.12026-05-27T14:44:17.297637ZDownloadf59351d28f49520cd3a74eb1f41c5f19ae15e53c65a3231d14af672e46510a96
0.19.22026-06-29T08:34:37.803930ZDownloadf9c168717100ae6d9fee9ffb0be379bf1f8b26b0f6bcbd4fdddcd931993a6a72
0.19.32026-07-13T14:23:02.392350ZDownloada1c26117c48cebe5677b0cf0e33a980a79a7c5577effc86f52e5a0d309cdcb60
0.19.42026-08-18T07:25:08.960444ZDownload9d233b6f2d9c52e1a2b5fbe70451d2c10ac674d3bb419d0ec8de14989d437c26
0.19.52026-09-16T15:33:43.507298ZDownload90eaad8059ebc2004a63810a4696ea9acdb02473e47ed3b6b3bafb100ac77e31

Dependencies

code_assets "^1.2.0"

glob "^2.1.1"

hooks "^2.0.0"

logging "^1.3.0"

meta "^1.19.0"

pub_semver "^2.2.0"