Skip to content

Static build on macOS fails beacuse the sources list for libnode.a is empty #65026

Description

@Xmader

Version

v26.4.0

Platform

arm64 macOS

Subsystem

Build system

What steps will reproduce the bug?

Build with ./configure --enable-static <...>

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Build succeeds.

What do you see instead?

rm -f <node_root>/out/Release/libnode.a && /opt/local/bin/python3.12 gyp-mac-tool filter-libtool libtool  -static -o <node_root>/out/Release/libnode.a 

error: libtool: no files specified
Usage: libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

Additional information

In https://github.com/nodejs/node/blob/v26.4.0/node.gyp#L1087-L1113, no C++ sources are provided for 'target_name': '<(node_lib_target_name)', so the arguments for libtool is empty (Should be bunch of .o files).

Compare the sources list for 'target_name': '<(node_lib_target_name)' in Node v25: https://github.com/nodejs/node/blob/v25.9.0/node.gyp#L888-L913

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to build files or the CI.macosIssues and PRs related to the macOS platform / OSX.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions