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

link failure with 3.0.0 and Clang 14.0 on Linux #62

Open
Be-ing opened this issue Jul 13, 2022 · 5 comments
Open

link failure with 3.0.0 and Clang 14.0 on Linux #62

Be-ing opened this issue Jul 13, 2022 · 5 comments

Comments

@Be-ing
Copy link

Be-ing commented Jul 13, 2022

With environment variables CC=clang and CXX=clang++ when running Meson, the build fails with:

[27/44] Linking target librubberband.so.2.2.0
FAILED: librubberband.so.2.2.0
clang++  -o librubberband.so.2.2.0 librubberband_objlib.a.p/src_rubberband-c.cpp.o librubberband_objlib.a.p/src_RubberBandStretcher.cpp.o librubberband_objlib.a.p/src_faster_AudioCurveCalculator.cpp.o librubberband_objlib.a.p/src_faster_CompoundAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_HighFrequencyAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_SilentAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_PercussiveAudioCurve.cpp.o librubberband_objlib.a.p/src_faster_R2Stretcher.cpp.o librubberband_objlib.a.p/src_faster_StretcherChannelData.cpp.o librubberband_objlib.a.p/src_faster_StretcherProcess.cpp.o librubberband_objlib.a.p/src_common_Allocators.cpp.o librubberband_objlib.a.p/src_common_FFT.cpp.o librubberband_objlib.a.p/src_common_Log.cpp.o librubberband_objlib.a.p/src_common_Profiler.cpp.o librubberband_objlib.a.p/src_common_Resampler.cpp.o librubberband_objlib.a.p/src_common_StretchCalculator.cpp.o librubberband_objlib.a.p/src_common_sysutils.cpp.o librubberband_objlib.a.p/src_common_Thread.cpp.o librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o librubberband_objlib.a.p/src_common_BQResampler.cpp.o -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librubberband.so.2 -Wl,--end-group -fuse-ld=mold -pthread
mold: error: undefined symbol: __atomic_is_lock_free
>>> referenced by R3Stretcher.cpp
>>>               librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o:(RubberBand::R3Stretcher::R3Stretcher(RubberBand::R3Stretcher::Parameters, double, double, RubberBand::Log))>>> referenced by R3Stretcher.cpp
>>>               librubberband_objlib.a.p/src_finer_R3Stretcher.cpp.o:(RubberBand::R3Stretcher::R3Stretcher(RubberBand::R3Stretcher::Parameters, double, double, RubberBand::Log))
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

The error is reproducible regardless of linker (mold, lld, GNU ld).

Compiling with GCC 12.1.1 works.

@cannam
Copy link
Member

cannam commented Jul 13, 2022

Odd. How can that be a link error? Either the standard library has it or it doesn't surely?

@cannam
Copy link
Member

cannam commented Jul 13, 2022

Huh. Looks like there is such a thing as libatomic. I had no idea. Interesting that it isn't necessary when using Clang on macOS.

@cannam
Copy link
Member

cannam commented Jul 13, 2022

If the only symbol undefined is the one that we use for diagnostic purposes only (i.e. is_lock_free) and not any of the actual atomic ops, then it might actually be better to (at least conditionally) eliminate the diagnostic check than to add a system-specific library dependency. (Is libatomic system-specific? I'm finding it surprisingly hard to find reliable info)

@Be-ing
Copy link
Author

Be-ing commented Jul 13, 2022

I found this issue: godotengine/godot#46375. Installing the libatomic-static Fedora package as described in this comment resolved the issue. 🤷

@Be-ing
Copy link
Author

Be-ing commented Jul 13, 2022

I'm unclear whether it should be the build system's responsibility to check for the availability of libatomic.

@Be-ing Be-ing changed the title link failure with 3.0.0 and Clang 14.0 link failure with 3.0.0 and Clang 14.0 on Linux Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants