I am trying to build a project (PDFium) using clang.
It keeps giving me this error
ld.lld: error: unable to find library -latomic
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
I have these installed on my system
libatomic_ops 7.6.14-1
clang 14.0.6-2
lib32-clang 14.0.6-1
libatomic1
And about LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=/usr/lib64:/usr/lib32:/usr/local/lib:/usr/lib
$ sudo ldconfig
I have tried it on Debian, Arch and Ubuntu.
Related
I have a C++ project with CMake build system. When I compile using GCC it compiles fine. But when I tried to use NDK toolchain, it shows the following error.
Linking CXX executable ../bin/my_app
/opt/r19c/linux-x86_64/toolchains/llvm/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld:
cannot find -lpthread
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
How can I fix this issue?
I get a linking error after updating Movesense library from 1.8.1 to 1.9.0 in my project and even in the hello world sample project. Has anyone else has this problem and can offer a solution?
I am running the SDK on
Ubuntu 18.04.2 LTS
arm-none-eabi-gcc 7.3.1
Same problem with gcc-arm-none-eabi-7-2017-q4
Here is the output of the linking failure after calling ninja:
FAILED: Movesense
: && /usr/bin/arm-none-eabi-gcc -W -Wall -[...] ../platform/nRF5x/linker/gcc/appflash.ld CMakeFiles/Movesense.dir/App.cpp.obj CMakeFiles/Movesense.dir/HelloWorldService.cpp.obj CMakeFiles/Movesense.dir/generated/sbem-code/sbem_definitions.cpp.obj CMakeFiles/Movesense.dir/generated/app-resources/resources.cpp.obj CMakeFiles/Movesense.dir/app-metadata/metadata.cpp.obj -o Movesense /home/lukas/Projects/movesense/movesense-device-lib/MovesenseCoreLib/lib/GCCARM/libmovesense-coreD.a -lm -lstdc++ && :
lto1: internal compiler error: bytecode stream: expected tag round_div_expr instead of reference_type
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: /usr/bin/arm-none-eabi-gcc returned 1 exit status
compilation terminated.
/usr/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
With Movesense 1.8.1 everything works fine:
git checkout 38be3c2
[...]
cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/hello_world_app
[...]
ninja
[...]
[8/8] Linking CXX executable Movesense
Thanks in advance!
From CHANGES.md (& README.md) since 1.9.0
REQUIRED: Use Windows build environment only (due to above GNU OSX bug)
REQUIRED: Use GNU Toolchain for ARM v. 7.2.1 2017q4
This situation is unfortunate and will be rectified in the coming 2.0 release with a new docker based build environment.
Full Disclaimer: I work for the Movesense team
I was able to install the pybind11 example here before I upgraded my MacOS. However, after I upgraded my MacOS to Mojave, when I compile the same example on that link, I see the following error:
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
Am I missing a linker command? I've searched online but couldn't find a solution.
I actually found the answer. I only needed to do
export MACOSX_DEPLOYMENT_TARGET=10.9
The installation went smoothly.
H im trying to publish my app in IOS, to make this try to generate archive:
but show me:
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Showing All Errors Only
ld: bitcode bundle could not be generated because
'/Users/dortiz/Documents/IOS/ProcIOS/Pods/MOCA/libMOCALib.a(Inbox.o)'
was built without full bitcode. All object files and libraries for
bitcode must be generated from Xcode Archive or Install build for
architecture armv7 clang: error: linker command failed with exit code
1 (use -v to see invocation) Build failed 25/04/17, 3:53 p.m.
I try to fix error adding
-fembed-bitcode
In flags c and c++
Go to your Targets > Build Settings. Then, search for "bitcode". Set the Enable Bitcode to "NO".
I really tried a lot. Clang does not come with standard C++ includes, and obviously can not find them :
clang++ file.cpp -o file.out
C:\Folder\file.cpp:1:11: fatal error: 'iostream' file not found
#include <iostream>
^
1 error generated.
Passing the mingw includes by arguments, it returns another error:
clang++ -target x86_64-w64-mingw32 C:\Folder\file.cpp -IC:\MinGW\mingw64\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++ -IC:\MinGW\mingw64\lib\gcc\x86_64-w64-mingw32\6.3.0\include\c++\x86_64-w64-mingw32 -IC:\MinGW\mingw64\x86_64-w64-mingw32\include -o C:\Folder\file.out -std=c++11
clang++.exe: error: unable to execute command: program not executable
clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
When I use -c it does not use the linker and also not generate an executable file.
Edit : I'm running on windows
Run your commands from "x64 Native Tools Command Prompt for VS 2017", or something similar. It will setup some required env vars for you.