Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker error while building on M1 (MacOS) #5458

Open
sysupbda opened this issue Mar 4, 2025 · 2 comments
Open

linker error while building on M1 (MacOS) #5458

sysupbda opened this issue Mar 4, 2025 · 2 comments
Assignees

Comments

@sysupbda
Copy link
Contributor

sysupbda commented Mar 4, 2025

When syncing to the latest main branch, and following the instructions in INSTALL.UNIX for MacOS, the make process fails while linking quickjs.

Description

The make process compiles but fails while linking. I ran the link command using the -v option as suggested by the error and it results in the following messages:

couchdb % cc src/couch_quickjs/c_src/couchjs.o src/couch_quickjs/c_src/couchjs_mainjs_bytecode.o -flto -v -lm src/couch_quickjs/quickjs/libquickjs.lto.a -o src/couch_quickjs/priv/couch_mainjs
Apple clang version 16.0.0 (clang-1600.0.26.6)
Target: arm64-apple-darwin24.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -platform_version macos 15.0.0 15.2 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -mllvm -enable-linkonceodr-outlining -o src/couch_quickjs/priv/couch_mainjs -L/usr/local/lib src/couch_quickjs/c_src/couchjs.o src/couch_quickjs/c_src/couchjs_mainjs_bytecode.o -lm src/couch_quickjs/quickjs/libquickjs.lto.a -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/lib/darwin/libclang_rt.osx.a
ld: multiple errors: could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[7](libbf.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[7](libbf.o)'; could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[6](quickjs-libc.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[6](quickjs-libc.o)'; could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[5](cutils.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[5](cutils.o)'; could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[4](libunicode.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[4](libunicode.o)'; could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[3](libregexp.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[3](libregexp.o)'; could not parse bitcode object file src/couch_quickjs/quickjs/libquickjs.lto.a[2](quickjs.o): 'Invalid attribute group entry (Producer: 'LLVM19.1.7' Reader: 'LLVM APPLE_1_1600.0.26.6_0')', using libLTO version 'LLVM version 16.0.0' in 'src/couch_quickjs/quickjs/libquickjs.lto.a[2](quickjs.o)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Steps to Reproduce

1- brew install autoconf autoconf-archive automake libtool erlang icu4c spidermonkey pkg-config
2- JS_ENGINE=quickjs ./configure --disable-spidermonkey
3- make

Note that I intend to only use quickjs, but the reason I disabled spidermonkey is that it would complain I don't have a supported version.

Expected Behaviour

make should produce the erlang package that can be deployed to a BEAM VM, or there should be an executable that wraps starting the VM with the CouchDB application.

Following the instructions of https://github.com/apache/couchdb/blob/main/INSTALL.Unix.md#mac-os-x should result in a working environment.

Your Environment

Warnings of interest:
WARN: Missing plugins: [pc]

Information of interest:

Updating snappy from {git,"https://github.com/apache/couchdb-snappy.git",
                          {tag,"CouchDB-1.0.9"}}
Updating fauxton from {git,"https://github.com/apache/couchdb-fauxton",
                           {tag,"v1.3.1"}}
Updating ibrowse from {git,"https://github.com/apache/couchdb-ibrowse.git",
                           {tag,"CouchDB-4.4.2-6"}}
Updating jiffy from {git,"https://github.com/apache/couchdb-jiffy.git",
                         {tag,"1.1.2"}}
Updating mochiweb from {git,"https://github.com/apache/couchdb-mochiweb.git",
                            {tag,"v3.2.2"}}
Updating meck from {git,"https://github.com/apache/couchdb-meck.git",
                        {tag,"CouchDB-0.9.2-1"}}
Updating recon from {git,"https://github.com/apache/couchdb-recon.git",
                         {tag,"2.5.5"}}
Updating proper from {git,"https://github.com/proper-testing/proper",
                          "a5ae5669f01143b0828fc21667d4f5e344aa760b"}
  • CouchDB version used: "main branch" - commit a2ba5e2
  • Operating system and version: Darwin XXXXXX.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:06 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T8103 arm64
@nickva
Copy link
Contributor

nickva commented Mar 6, 2025

Unfortunately I don't have a recent arm mac setup, and am stuck on an older macos version, but in the past, after updating the operating system, I sometimes had to re-install the command line tools, and also make sure to remove any old object files with git clean -xffd that may have been compiled with the old version of the compiler.

@big-r81
Copy link
Contributor

big-r81 commented Mar 6, 2025

An additional hint. If you want to use SpiderMonkey, you need to explicitly add a version to the ./configure command. The current version of the SpiderMonkey formula is 128, so your configure command should be:

./configure --spidermonkey-version 128

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

No branches or pull requests

4 participants