Android: libDispatch link error ` error: cannot find -lutil` due entry `link "util"` in bionic.modulemap.gyb


Am I only one who getting link errors in libDispatch after recent updates .)

The issue in missed libutil referenced in glibc.modulemap file generated from bionic.modulemap.gyb.

// File: stdlib/public/Platform/bionic.modulemap.gyb

module SwiftGlibc [system] {
  // FIXME: util contains rarely used functions and not usually needed.
  // Unfortunately link directive doesn't work in the submodule yet.
  link "util"

  link "dl"


I don't see libutil in Android NDK:

find . -type f -iname *.a -or -iname *.so | grep arch-arm/ | grep dl

find . -type f -iname *.a -or -iname *.so | grep arch-arm/ | grep util


Is that libutil is something really exists in Android NDK or it is artefact from Linux. Should we remove link "util" from file bionic.modulemap.gyb?

Thank you!

UPDATE 1: Additional info:

Native libraries must use only public API, and must not link against
non-NDK platform libraries. Starting with API 24 this rule is enforced
and applications are no longer able to load non-NDK platform libraries.
The rule is enforced by the dynamic linker, so non-public libraries are
not accessible regardless of the way code tries to loa
 them: System.loadLibrary, DT_NEEDED entries, and
direct calls to dlopen(3) will all work exactly the same.

Taken from:


  1. Related PR:
  2. File bionic.modulemap.gyb:

It may have been an improper link previously as I don't think that anyone else was trying to build the android SDK on Windows. util is used for one of the submodules, so I would like to investigate this before actually removing it. I don't know if anything in the android side of things is currently using the APIs from util, but if nothing is, then it should be safe to remove the link as well as the submodule.