Some 32-bit archs require explicit liking to `libatomic`, otherwise build fails: Undefined symbols: "___atomic_compare_exchange_8", "___atomic_fetch_xor_8" etc.

Open
#321 27 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@bsekisser is already working on this.

Since Jan 15, 2025.

  • #381 by @bsekisser — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c
Domain
build-system

Research direction

Start with the reported run-test262 build command and trace the linker flags used by that target. Check how the build handles 32-bit architectures and verify the affected build with the reported undefined atomic symbols. Done means the affected targets link successfully with the required atomic support.

Written by the indexing model from the issue text.

Description

/opt/local/bin/gcc-mp-13 -g -o run-test262 .obj/run-test262.o .obj/quickjs.o .obj/libregexp.o .obj/libunicode.o .obj/cutils.o .obj/quickjs-libc.o .obj/libbf.o -lm -ldl -lpthread 
ar rcs libquickjs.a .obj/quickjs.o .obj/libregexp.o .obj/libunicode.o .obj/cutils.o .obj/quickjs-libc.o .obj/libbf.o
Undefined symbols:
  "___atomic_compare_exchange_8", referenced from:
Undefined symbols:
  "___atomic_compare_exchange_8", referenced from:
      _js_atomics_op in quickjs.o
      _js_atomics_op in quickjs.o
  "___atomic_fetch_xor_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_fetch_xor_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_fetch_add_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_fetch_add_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_load_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_load_8", referenced from:
  "___atomic_store_8", referenced from:
      _js_atomics_op in quickjs.o
      _js_atomics_store in quickjs.o
  "___atomic_fetch_sub_8", referenced from:
  "___atomic_store_8", referenced from:
      _js_atomics_op in quickjs.o
      _js_atomics_store in quickjs.o
  "_clock_gettime", referenced from:
  "___atomic_fetch_sub_8", referenced from:
      _js_atomics_wait in quickjs.o
      _js_atomics_op in quickjs.o
      _js_os_setTimeout in quickjs-libc.o
      _js_os_poll in quickjs-libc.o
  "___atomic_fetch_or_8", referenced from:
      _js_atomics_op in quickjs.o
  "_clock_gettime", referenced from:
      _js_agent_monotonicNow in run-test262.o
      _run_test_dir_list in run-test262.o
      _run_test_dir_list in run-test262.o
      _js_atomics_wait in quickjs.o
  "___atomic_fetch_and_8", referenced from:
      _js_os_setTimeout in quickjs-libc.o
      _js_os_poll in quickjs-libc.o
      _js_atomics_op in quickjs.o
  "___atomic_fetch_or_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_exchange_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_fetch_and_8", referenced from:
      _js_atomics_op in quickjs.o
  "___atomic_exchange_8", referenced from:
      _js_atomics_op in quickjs.o
ld: symbol(s) not found
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [run-test262] Error 1
make: *** Waiting for unfinished jobs....
Dominant language
C
Stars
11.1k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bellard/quickjs

All issues in bellard/quickjs

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.