Skip to content

Fix aarch64 duplicate symbol errors in libfolly#2562

Closed
ptarjan wants to merge 1 commit into
facebook:mainfrom
ptarjan:claude/fix-aarch64-duplicate-symbols-1mH8I
Closed

Fix aarch64 duplicate symbol errors in libfolly#2562
ptarjan wants to merge 1 commit into
facebook:mainfrom
ptarjan:claude/fix-aarch64-duplicate-symbols-1mH8I

Conversation

@ptarjan
Copy link
Copy Markdown
Contributor

@ptarjan ptarjan commented Jan 20, 2026

The -use variants of memcpy_aarch64 and memset_aarch64 were being included in the monolithic libfolly.so, causing duplicate symbol errors because they compile the same assembly files as the non-use variants.

Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use to match the pattern used for memcpy-use and memset-use in the main folly/CMakeLists.txt. The -use variants are meant for explicit opt-in to override libc memcpy/memset, not for inclusion in the main library.

The -use variants of memcpy_aarch64 and memset_aarch64 were being
included in the monolithic libfolly.so, causing duplicate symbol
errors because they compile the same assembly files as the non-use
variants.

Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use
to match the pattern used for memcpy-use and memset-use in the main
folly/CMakeLists.txt. The -use variants are meant for explicit opt-in
to override libc memcpy/memset, not for inclusion in the main library.

Fixes: https://github.com/facebook/folly/issues/XXXXX
@meta-cla meta-cla Bot added the CLA Signed label Jan 20, 2026
ptarjan pushed a commit to ptarjan/nixpkgs that referenced this pull request Jan 20, 2026
Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use
targets to prevent duplicate symbol errors when building libfolly.so.

The "Add granular CMake build targets" commit (2026.01.18) introduced
both -use and non-use variants from the same source files, causing
linker errors on aarch64-linux.

facebook/folly#2562
@ptarjan
Copy link
Copy Markdown
Contributor Author

ptarjan commented Jan 20, 2026

Same result as #2561 different implementation

ptarjan pushed a commit to ptarjan/nixpkgs that referenced this pull request Jan 22, 2026
folly: remove obsolete fix-__type_pack_element.patch

folly: disable flaky largeRetries test

This test times out under resource constraints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

folly: disable flaky UseAfterFork test

folly: fix aarch64-linux duplicate symbol errors

Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use
targets to prevent duplicate symbol errors when building libfolly.so.

The "Add granular CMake build targets" commit (2026.01.18) introduced
both -use and non-use variants from the same source files, causing
linker errors on aarch64-linux.

facebook/folly#2562
ptarjan pushed a commit to ptarjan/nixpkgs that referenced this pull request Jan 22, 2026
folly: remove obsolete fix-__type_pack_element.patch

folly: disable flaky largeRetries test

This test times out under resource constraints.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

folly: disable flaky UseAfterFork test

folly: fix aarch64-linux duplicate symbol errors

Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use
targets to prevent duplicate symbol errors when building libfolly.so.

The "Add granular CMake build targets" commit (2026.01.18) introduced
both -use and non-use variants from the same source files, causing
linker errors on aarch64-linux.

facebook/folly#2562
@cho-m
Copy link
Copy Markdown

cho-m commented Mar 3, 2026

I tried patching this into latest v2026.03.02.00 for Homebrew's arm64 Linux build and noticed that it doesn't work when building shared libraries:

  CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
  Missing variable is:
  CMAKE_ASM_CREATE_SHARED_LIBRARY

I worked around this by adding set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

@afrind has imported this pull request. If you are a Meta employee, you can view this in D95509547.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Mar 6, 2026

@yfeldblum merged this pull request in ae5bbaf.

meta-codesync Bot pushed a commit to facebook/hhvm that referenced this pull request Mar 6, 2026
Summary:
The -use variants of memcpy_aarch64 and memset_aarch64 were being included in the monolithic libfolly.so, causing duplicate symbol errors because they compile the same assembly files as the non-use variants.

Add EXCLUDE_FROM_MONOLITH to memcpy_aarch64-use and memset_aarch64-use to match the pattern used for memcpy-use and memset-use in the main folly/CMakeLists.txt. The -use variants are meant for explicit opt-in to override libc memcpy/memset, not for inclusion in the main library.

X-link: facebook/folly#2562

Reviewed By: afrind

Differential Revision: D95509547

Pulled By: yfeldblum

fbshipit-source-id: d999b44c23685d5371f83fcc65ede573a28afb9e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants