I have tried to build my code dynamically and it worked as expected, however when I try to statically build with the option --ghc-options '-optl-static -fPIC' I got the follow error
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
any idea?
edit : I added the c tag since I though the gcc is somehow related to c and I guess the error related to c library
Related
I am trying to compile the code for dictionary.c so I can continue onto testing. The only problem is that each time I try to use the make command to compile it i keep on getting the error
speller/ $ make
/usr/bin/ld: cannot open output file speller: Is a directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:4: speller] Error 1
I can imagine that part of the problem is the name of the directory being speller but im overall not very sure of what all I need to do to resolve this error
Any assistance or tips would be greatly appreciated!
I am unsure of what to try to fix it since it seems to be a really broad error
I've littered through Stackoverflow trying to get Unity unit test framework (https://www.throwtheswitch.org/unity) linked and built on CMAKE so that I can write unit tests but I keep hitting this same error:
Undefined symbols for architecture x86_64:
"_setUp", referenced from:
_UnityDefaultTestRun in libunity.a(unity.c.o)
"_tearDown", referenced from:
_UnityDefaultTestRun in libunity.a(unity.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/test_problem2_59.exe] Error 1
make[1]: *** [tests/CMakeFiles/test_problem2_59.exe.dir/al
I have documented my final attempt here https://github.com/aamarin/computer_systems/tree/dev with the latest commit being the unstable commit. I'm not sure what else I'm missing in computer_systems/tests/CMakeLists.txt to get this working. Just looking for some guidance and maybe an explanation I might be missing from here https://gitlab.com/CLIUtils/modern-cmake/-/blob/master/examples/extended-project/src/CMakeLists.txt. Guidance on better structuring my folder structure is helpful as well.
Just add empty functions named setUp and teadDown. UnityGettingStartedGuide.
I have to do a compiler with flex and bison for a school project.
They give to me example of new language but I can't compile them..
The code is working fine for other people so the problem come from my Mac. The problem appears when I try to compile with make command, he say "ld: library not found for -lglib-2.0".
I installed "Glib" already but this don't solve the problem.
make
[ 20%] Linking C executable facile
ld: library not found for -lglib-2.0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [facile] Error 1
make[1]: *** [CMakeFiles/facile.dir/all] Error 2
make: *** [all] Error 2
I need to compile the code to work after on the project.
Thanks you
I am a beginner in both linux and openwrt. Sorry if this is a stupid question.
I am following this tutorial : https://downloads.openwrt.org/docs/eclipse.pdf
Chip : MT7620
Toolchain Prefix : mipsel-openwrt-linux-
Toolchain Path : /ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14
Code:
#include <stdio.h>
void main()
{
printf("Hello World");
}
Error:
**** Build of configuration Debug for project hello ****
make all
Building target: hello
Invoking: Cross GCC Linker
mipsel-openwrt-linux-gcc -L/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib -o"hello" ./main.o
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
/ligo/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/lib/gcc/mipsel-openwrt-linux-musl/5.3.0/../../../../mipsel-openwrt-linux-musl/lib/crt1.o: In function `_start_c':
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
/ligo/openwrt/build_dir/toolchain-mipsel_24kec+dsp_gcc-5.3.0_musl-1.1.14/musl-1.1.14/crt/crt1.c:17: undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [hello] Error 1
add the following 2 lines at the end of bashrc
export PATH=$PATH:~/openwrt/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin
export STAGING_DIR=~/openwrt/staging_dir
source ~/.bashrc
To open/create the bashrc you can execute
sudo gedit ~/.bashrc
Well I feel stupid when I have to figure this problem which happens too often.
I get the above error when I forget to save the file that contains main() it gives this error since the file is empty until you save it.
These instructions tell how to automatically save all the modified files when you kick off a build Save before build Keep this set and you won't see this again.
If you don't have the path to the toolchain set in eclipse, it never even finds a compiler, assembler or linker so it can not produce the error given. The warnings about STAGING_DIR are harmless in this case.
I'm writing C program in Xcode, and I got this problem:
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea to solve it?
Note: I've just update my OS to Mountain Lion yesterday.
A common error is to define a symbol in a header when you wanted to declare it:
When you for instance declare a global variable and forget the extern or you define an inline function and forget the inline. In these cases the compiler emits the symbol in each compile unit that includes this header and you end up with multiple definitions of a symbol.
Anyway you should just look for the symbol in question.