I wrote a complicated scons script. But I found my program won't be compiled successful.
The error code is : "error adding symbols: DSO missing from command line"
I checked the compile progress. I found the g++ link order was changed.
I don't know by who and why?
So, did anyone meet this issue?
Related
I'm sucessfully building pulp-riscv-gnu-toolchain from this this
But when I try to compile my simple source code with builded compiler,
error occured.
My command is riscv32-unknown-elf-g++ -o hello hello.cpp
Error message is /home/jskim/test_toolchains_lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/bin/ld : cannot open linker script file riscv.ld : No such file or directory
So I try with this command riscv32-unknown-elf-g++ -o main main.cpp -T /home/jskim/test_toolchains/riscv32-unknown-elf-ld/lib/ldscripts/elf32lriscv.x
But following error occured : /home/jskim/test_toolchains/lib/gcc/riscv32-unknown-elf/7.1.1/../../../../riscv32-unknown-elf/lib/crt0.o: In function '.L0': (.text+0x10):undefined reference to '_fbss' collect2: error: ld returned 1 exit status
I'm using CentOS 7.6 and I try build this pulp-gcc with gcc 4.8.5 and 7.3.1 but both shows me same error. Please help me.
I resolve the problem in this way.
Actually Here is the solution.
I'm not accurate but I think the problem is that the name is not matched.
crt0, which seems to be the helper of start riscv processor has this line la a0 _fbss just basically linker can recognize this if _fbss is replaced with _edata. So i edit the assembly file which is located at pulp-riscv-gnu-toolchain/riscv-newlib/libgloss/riscv/ And rebuild the gnu toolchain. And execute your compiler with -T option like riscv32-unknown-elf-g++ -o main main.cpp -T /home/jskim/test_toolchains/riscv32-unknown-elf-ld/lib/ldscripts/elf32lriscv.x
This is the easiest solution as I think.
I've mainly worked on Windows, so I'm quite unfamiliar with less common issues under Linux.
Here's the error I'm getting when dub tries to link my application:
/usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Error: /usr/bin/gcc failed with status: 1
/usr/bin/ldc2 failed with exit code 1.
I've an image handling library as a dependency, which is required for the application, and it (obviously) uses zlib for *.png compression/decompression. I've installed zlib1g-dev for Ubuntu, but did not fix my issues, and the same exact code compiles without any issues under Windows.
You need to link in zlib, as mentioned before.
I would recommend to do so via the "libs" array (see this page: https://dub.pm/package-format-json.html). The advantage of using libs over lflags is that libs will try to use pkg-config, which is a generic way to get linker / compile flags for C[++] libraries on POSIX. It works on Linux and Mac OSX. If pkg-config is not found, dub will just default to do what lflags would do in the first place.
Here's an example from my own project: https://github.com/Geod24/libsodiumd/blob/9b397645e2fc3ca502acb58e1b4631d3faf094e2/dub.json
/lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
This error is telling you that you must add -lz to command line. I don't know what dub is, but somehow you must convince it to add -lz to the link command it constructs.
It's probably enough to add -lz to the lflags in your dub file.
I have a question about using CMake to link the shared library.
After building OpenBLAS from source and install it succesfully.
In /opt/OpenBLAS/include has header files and
in /opt/OpenBLAS/lib has shared and static libraries.
If I have a toy program call cpp_gemm.cpp, I can build it by typing
g++ -o cpp_gemm cpp_gemm.cpp -I/opt/OpenBLAS/include -L/opt/OpenBLAS/lib -lopenblas
And execute it without error message.
But I want to use CMake to build it, so I write following rules in CMakeLists.txt
cmake_minimum_required(VERSION 2.8.4)
project(CppGEMM)
include_directories(/opt/OpenBLAS/include)
link_directories(/opt/OpenBLAS/lib)
add_executable(cpp_gemm cpp_gemm.cpp)
target_link_libraries(cpp_gemm openblas)
After I create build folder and enter into it, I type
cmake ..
make
to build the program successfully.
But I will get
Illegal instruction (core dumped)
after execute it.
After searching the related problems by Google search, I found that
replace
link_directories(/opt/OpenBLAS/lib)
with
link_directories(/opt/OpenBLAS)
can solve my problem.
That is, I can build the program successfully and execute it without the
error message.
I'm confused, but I can not find any material to realize it.
Can anyone tell me why this occurred?
Many thanks!
I ran across this error while trying to compile the NMR software modelfree4.20 for Linux. The distribution comes with a MakeFile, and so I type "make" in the modelfree folder to try and compile it, and after it writes a few files I get the following error:
/usr/bin/ld: -f may not be used without -shared
collect2: error: ld returned 1 exit status
Makefile:74: recipe for target 'modelfree4' failed
make: *** [modelfree4] Error 1
I have no idea what "-f may not be used without -shared" means or what it is trying to tell me to fix? I don't see anything with a -f or -shared in the MakeFile when I open it up, and I didn't specify any options when I ran "make."
Any help on this is greatly appreciated!
I think I could see 2 possibilities.
If the Makefile is generated by a configure script, you may need to run it again. You may have picked up a bad Makefile due to misconfiguration. Possibly you need to run the autotools to generate the configure script again.
It's possible that there is some system- or session-specific LDFLAGS environment variable interfering with linking. Try unset LDFLAGS?
I'm trying to cross compile with eclipse. newbie on this. My problem:
When I try to build my code it says : bin/sh/ 1 arm-linux-gnueabi-g++ not found
here is my screenshot:
I had a same problem and i solved.
If you copy arm-liunx-guneabi-g++ from Eclipse console and paste to terminal and execute,
then you may see same message.
like this
Ubuntu32bit:~/workspace/HelloWorldTest$ arm-linux-gnueabi-g++
arm-linux-gnueabi-g++: command not found
But if you type to terminal using tab, then you may see following message.
Ubuntu32bit:~/workspace/HelloWorldTest$ arm-linux-gnueabi-g++
arm-linux-gnueabi-g++: fatal error: no input files
compilation terminated.
I don't know Why this happened. It's same string "arm-linux-gnueabi-g++".
So solution is that "arm-linux-gnueabi-g++" copy from terminal then paste to
Eclipse's project, Properties.
Settings -> GCC C++ Compiler
GCC C++ Linker