Skip to content

Building with -sMAIN_MODULE vs with -sSTRICT and -l<foo> linkage #24436

Done

Description

@juj

When building with -sSTRICT, one must explicitly link in e.g. GL and HTML5 JS libraries with -lGL and -lhtml5. The intent was to avoid accidental pollution of symbols into users's builds if they so need.

When building with -sMAIN_MODULE however, it looks like one cannot manually pass -lGL or -lhtml5, or errors about duplicate symbols will result.

Seen while fixing PR #24431 (comment)

Activity

  1. sbc100 commented on May 30, 2025

    @sbc100
    Collaborator

    I think this is a side effect of the fact that -sMAIN_MODULE=1 (not -sMAIN_MODULE=2) forces all libraries to be included via -Wl,--whole-archive.

  2. juj commented on Nov 30, 2026

    @juj
    CollaboratorAuthor

    Looks like this was fixed by #25449 (October 2025).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions