Compile V8 on linux platform failed - v8

compile the latest v8 failed on linux platform.
linux, v8 using ninjia
ninja: Entering directory `out.gn/x64.release'
[14/571] LINK ./mksnapshot
o/x/args.gn+ buffers
FAILED: mksnapshot
../../third_party/llvm-build/Release+Asserts/bin/clang++ -pie -Wl,--fatal-warnings -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -fuse-ld=lld -Wl,--icf=all -Wl,--color-diagnostics -m64 -rdynamic -pie -Wl,--disable-new-dtags -Wl,-O2 -Wl,--gc-sections -o "./mksnapshot" -Wl,--start-group #"./mksnapshot.rsp" -Wl,--end-group -latomic -ldl -lpthread -lrt
ld.lld: error: undefined symbol: void std::atomic_init(std::atomic*, bool)
referenced by module-compiler.cc:260 (../../src/wasm/module-compiler.cc:260)
obj/v8_base_without_compiler/module-compiler.o:(v8::internal::wasm::CompilationState::New(std::shared_ptr const&, std::shared_ptr))
link error

This problem has been solved by replacing std::atomic_init with straight assignment.

Related

What is the difference between -Wl,--export-dynamic and -Wl,-export-dynamic (single vs double-dash)?

A user of xnec2c was trying to build on OSX with clang and got this error:
gcc --pedantic -Wall -std=gnu11 -O2 -g -Wformat -Werror=format-security -fpie -Wno-overlength-strings -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -DGDK_PIXBUF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-honor-nans -fno-signed-zeros -fno-math-errno -Wl,--export-dynamic -Wl,--as-needed -o xnec2c main.o mathlib.o measurements.o interface.o callbacks.o console.o callback_func.o calculations.o cmnd_edit.o geom_edit.o gnuplot.o draw.o draw_structure.o draw_radiation.o fields.o fork.o geometry.o ground.o xnec2c.o input.o matrix.o utils.o nec2_model.o network.o optimize.o plot_freqdata.o radiation.o rc_config.o shared.o somnec.o xnec2c-resources.o -L/opt/local/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lpthread -lm
ld: unknown option: --export-dynamic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(FYI: GTK Builder needs the export-dynamic linking flag.)
This discussion suggests making the double-dash a single dash:
-AM_LDFLAGS = -Wl,--export-dynamic
+AM_LDFLAGS = -Wl,-export-dynamic
However the user found that, actually, it needs a single dash and an underscore (maybe, still having trouble that could be related, but at least ld stopped barking about the option):
-AM_LDFLAGS = -Wl,--export-dynamic
+AM_LDFLAGS = -Wl,-export_dynamic
Questions:
Does single-dash -Wl,-export-dynamic work in both GCC and Clang?
Whats with the underscore version as -Wl,-export_dynamic?
How compatible is that option with older (and newer) versions of the GCC/Clang stacks?
Other considerations or best practice?
Both GNU ld and LLVM lld take --export-dynamic flag
ld that ships with OS X takes -export_dynamic flag
This has nothing to do with gcc or clang, these only pass the flag along to the linker

How to cgo link to libraries built with LLVM's libc++

I would like to CGO link my go program to a c++ static library linked to LLVM's libc++. With GNU's libstdc++, everything works fine.
I am calling go compiler as follows:
CGO_CXXFLAGS="-stdlib=libc++ -I/usr/lib/clang/12.0.0/include -I/usr/local/include -I/usr/include" CGO_LDFLAGS="-stdlib=libc++ -L/usr/lib/clang/12.0.0/lib -L/usr/local/lib -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lpthread -lrt -lc++ -lm -lc" go test --ldflags '-extldflags "-static"' -c -a .
I was missing -lc++ -lc++abi.

Undefined reference errors while linking in makefile

I have a set of cross compiled dynamic libraries generated. While trying to link it, I am getting the following error:
arm-linux-ld: xxx.so: undefined reference to symbol '__aeabi_uldivmod##GCC_3.5'
Does anybody have any idea what I am missing?
Below is the libraries I am linking and the order of linking:
some user defined libraries + -lcrypto -lssl -lz -lpthread -lxml2
-lcsvparser -lubox -lini -lyuarel -lsqlite3 -lcurl -lm -ldl -lrt -lc -lgcc

link ffmpeg error with cmake

I use cmake to create my project using ffmpeg lib, the project is simple.
add_executable(testffmpeg main.cpp)
link_directories( /usr/lib/x86_64-linux-gnu )
target_link_libraries(testffmpeg libavcodec.a libavutil.a )
When make, there's lots of undefined reference errors (my default cxx compiler is clang by "export cxx=/usr/bin/clang++").
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libavcodec.a(crystalhd.o): In function `receive_frame':(.text+0xef): undefined reference to `DtsProcOutputNoCopy'
but when I just use command, it's OK.
clang -o testffmpeg -lavutil -lavcodec main.cpp
while using gcc also get this error
gcc -o testffmpeg -lavutil -lavcodec main.cpp
so, how can I resolve this problem and where is the mistake?
You need add -lcrystalhd in your linker flags.
You can use code below to find all linker flags.
pkg-config --libs libavformat
-L/usr/local/lib -lavformat -lXv -lX11 -lXext -ldl -lvdpau -lva -lva-x11 -lX11 -lva -lva-drm -lva -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb -lxcb-shape -lxcb -lsndio -ljack -lasound -lSDL2 -lx264 -lcrystalhd -lm -llzma -lbz2 -lz -pthread -lavcodec -lXv -lX11 -lXext -ldl -lvdpau -lva -lva-x11 -lX11 -lva -lva-drm -lva -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb-render -lxcb-shape -lxcb -lxcb-shape -lxcb -lsndio -ljack -lasound -lSDL2 -lx264 -lcrystalhd -lm -llzma -lbz2 -lz -pthread -lswresample -lm -lavutil -lm

libpam linking issue ubuntu 12.04

I have installed
libpam0g-dev libpam0g
But when I am linking to libpam I am getting error undefined reference to `pam_start'
and I am linker flags include -lpam.
Same code is working in Ubuntu 11.
Linking flags
-Wl,--start-group -lssl -lpam -lcrypto -lnspr4 -licui18n -licuuc -licudata -lcurl -lcares -lpthread -lpcrecpp -loauth -ldl -lrt -lz -Wl,--end-group
don't works
but this works
-Wl,--start-group -lssl -lpam -lcrypto -lnspr4 -licui18n -licuuc -licudata -lcurl -lcares -lpthread -lpcrecpp -loauth -ldl -lrt -lz -lpam -Wl,--end-group

Resources