I am new to Pandaboard development. I am using CodeSourcery cross compiler to cross compile my application code. My application is a simple 'hello world' app. I am using this for cross-compilation:
arm-none-linux-gnueabi-gcc app.c -o app.out -march=armv5
I am able to generate the app.out.
But when I copied this app.out to my panda board and tried to execute it, I got this exception:
-bash: ./app.out: No such file or directory
How can I resolve this?
This issue is solved using the static linking of shared libraries.The command to do the same is given below.
arm-none-linux-gnueabi-gcc app.c -o app.out -march=armv5 -static
Related
I have this strange issue where creating / using a static library works in my Ubuntu VM but not on macOS:
ld: warning: ignoring file ./dist/libXXXX.a, building for macOS-x86_64 but attempting to link with file built for macOS-x86_64
Command to create the static library is:
ar rcs libtest.a obj1.o obj2.o ...
Compiler invocation:
gcc -g -Wall -Wextra main.c -L./dist -lXXXX -o main
Searching on google didn't yield any usable results except for this (maybe) related question on SO:
Possible related question
I realize this is an old post and you found your fix, but let me post this here for anyone else who runs into this problem for whom these answers don't provide a solution.
You might be using two different toolchains unknowingly, one from Apple (installed via Xcode) and one from GNU (installed via Home-brew or MacPorts). If you type ranlib --version and see version info showing that ranlib is GNU, this is likely the case.
Make sure that /usr/bin comes in your $PATH before /usr/local/bin and /opt/local/bin. When you run which -a ranlib, the first result in the list should be /usr/bin/ranlib. Same for which -a ar-- the first result should be /usr/bin/ar. If it is not so, you need to fix your $PATH.
Once you fix your path and clean your project, try building again and things should work.
The issue was solved when I directly put those object files rather than gathering them into a static library, i.e.,
gcc -g -Wall -Wextra main.c obj1.o obj2.o -o main
After that, I got many warnings like ld: warning: object file (obj1.o) was built for newer macOS version (11.0) than being linked (10.14), but it is a warning, and the object is linked, so the problem is solved.
The root cause is that some library passes -mmacosx-version-min=10.14 to gcc, so the object file is built for 10.14, but my macos is now 11.0.
If you want to make things work, try directly using object files rather than creating a static library.
If you want to resolve all the warnings, find ``-mmacosx-version-min` and comment it.
After looking at my script that automatically creates the static library I've found the culprit:
For some reason my tool created object files for header files (resulting in files like header.h.o).
Removing those fixed the issue.
I am geetting this error while compiling the 010-TestCase.cpp file which is in examples in catch2. I am very new to this framework. Please respond if anyone have opinion about this.Cat
This seems to be issue when using examples with single-header distribution of Catch2 as an opposite to CMake installation.
What did the trick for me was removing offending -I$(CATCH_SINGLE_INCLUDE) from the example command. It didn't appear in Google Search but I expect it to contain path to which I do include barely as "catch2.hpp".
Test works for me after I've eended up with:
g++ -std=c++11 -Wall -o 010-TestCase 010-TestCase.cpp && ./010-TestCase --success
I have a CortexM0 project using a custom Makefile that builds and debugs successfully on a 1st machine.
Now trying to move the project to a second Mac.
Same version of Eclipse.
On build I get a linker error:
EclipseApr2019/gcc-arm-none-eabi-5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: cannot find -lg
My make file looks like this (extract):
# echo "path="$(TOOLS)
$(TOOLS)arm-none-eabi-gcc -n -v -mcpu=cortex-m0 -mthumb -g -nostartfiles -T STM32F031C6_simple.ld main.c StartUp_simple.s -o $(NAME).elf
I have tried to append the ARM gcc tools directory to the PATH variable in the Project, but no luck.
I would add a -l option to the link stage in the makefile, but do not know why this library is being pulled in or where it is. My code only does a series of shifts and reads/writes to registers on an MCU. The build on the 1st machine worked fine without specifying a library location like this.
Given I have custom makefile and am not generating Makefile automatically, there are no tool settings (and Library search path) available under Properties/CC++Build/Settings.
What is library "g" that the linker is pulling in?
Where is it?
Under Eclipse, how can I point the linker to the library?
Why didn't I need to do that before?
What is some general advice for designing an Eclipse project with a custom makefile to make it most portable between machines?
Thank you.
Eclipse IDE for C/C++ Developers
Version: 2019-03 (4.11.0)
I am trying to build some software for AmigaDOS 3.x on a ubuntu 16.04 host system, but at link time I get this error:
/opt/m68k-amigaos/m68k-amigaos/bin/ld: cannot open crt0.o: No such file or directory
The process of building from .c to .o works fine and with no errors. Its only the link stage that displays any error. The link command I am using is:
sst: $(OFILES)
m68k-amigaos-gcc -o sst $(OFILES) -lm
Any ideas?
The question was answered here:
https://github.com/adtools/amigaos-cross-toolchain/issues/12
I will copy/paste it here, in case the original post on Github became unavailable:
You need to use -noixemul switch during linking stage, otherwise the toolchain will try to use ixemul startup routine which is not available.
$ m68k-amigaos-gcc -noixemul hello.c -o hello
I am new to this iPhone. So I installed the GNUstep compiler and I imported one small program. Now I want to compile this and execute the code... I did this by using the code:
gcc -o hello hello.m -I/c/GNUstep/GNUstep/System/Library/Headers \
-L /c/GNUstep/GNUstep/System/Library/Libraries -lobjc -lgnustep-base \
-fconstant-string-class=NSConstantString
but it is giving the error as
1./GNUstep/GNUstep/system/library/libraries:permission denied
2.ld.exe : cannot find -lobjc
3.ld.exe : cannot find -lgnustep-base-fconstant-string-class=NSConstantString
collect2:id returned 1 exit status
Please help me anyone.. have I too add any new libraries to this?
Try using this command:
$ gcc `gnustep-config --objc-flags` -o hello hello.m -L C:/GNUstep/GNUstep/Syst
em/Library/Libraries -lobjc -lgnustep-base
You can simple check out my you tube tutorial about that : here
I use GNUstep GORM to make a Objective-C project. The GORM will make a GNUmakefile automatically. If you want to command line style for compile the project, open Shell (you may close the GORM), change to the project directory using cd command, and type make. The GNUstep will compile the project (followed the GNUmakefile). There is a simple project by Yen-Ju Chen at http://www.nongnu.org/gstutorial/en/ch10.html.