How to fix "*** [obj/flash_board_cstartup.o] Error 2" - arm

I am trying to get up to speed with the SAM7S examples pack "at91sam7s-ek" available from the Atmel website.
When I load any project into Eclipse I get the following error after building project.
make: *** [obj/flash_board_cstartup.o] Error 2
I have checked that paths are correct and that the files are where they are supposed to be.
Is there anyone that can help me to get this running or can anyone recommend a better set of examples that actually work for the SAM7S devices?
The CDT build console is :
18:58:29 **** Incremental Build of configuration Default for project test_project ****
make all
arm-none-eabi-gcc -g -O0 -I../at91lib/boards/asn442g -I../at91lib/peripherals -I../at91lib/components -I../at91lib -I. -I../at91lib/utility -I../external_libs/ethernet/lwip/src/include -I../external_libs/ethernet/lwip/src/include/lwip -I../external_libs/ethernet/lwip/src/include/ipv4 -I./system/modbus/tcp -I./system/modbus/tcp/arch -I./system/dal/dalAdc -I./system/dal/dalHoldingRegisters -I./system/dal/dalTimer -I./system/bll/bllModbusTCP -I./system/drivers/drvGprsLink -I./system/drivers/drvAtmBus -I./system/hal/halUsart1 -I./system/hal/halGpio -I./system/hal/halUsart0 -I./system/drv/drvAtmBus -Dat91sam7x256 -D__ASSEMBLY__ -Dflash -c -o obj/flash_board_cstartup.o ../at91lib/boards/asn442g/board_cstartup.S
process_begin: CreateProcess(NULL, arm-none-eabi-gcc -g -O0 -I../at91lib/boards/asn442g -I../at91lib/peripherals -I../at91lib/components -I../at91lib -I. -I../at91lib/utility -I../external_libs/ethernet/lwip/src/include -I../external_libs/ethernet/lwip/src/include/lwip -I../external_libs/ethernet/lwip/src/include/ipv4 -I./system/modbus/tcp -I./system/modbus/tcp/arch -I./system/dal/dalAdc -I./system/dal/dalHoldingRegisters -I./system/dal/dalTimer -I./system/bll/bllModbusTCP -I./system/drivers/drvGprsLink -I./system/drivers/drvAtmBus -I./system/hal/halUsart1 -I./system/hal/halGpio -I./system/hal/halUsart0 -I./system/drv/drvAtmBus -Dat91sam7x256 -D__ASSEMBLY__ -Dflash -c -o obj/flash_board_cstartup.o../at91lib/boards/asn442g/board_cstartup.S, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [obj/flash_board_cstartup.o] Error 2
18:58:33 Build Finished (took 3s.647ms)

When make return Error nn, it means that a command that make has executed has returned a non-zero value nn. You need to look at the error message for teh command that failed, rather than teh final status of make - make has not failed; your build has failed.
In this case, the relevant error message (elided) is:
process_begin: CreateProcess(NULL, arm-none-eabi-gcc [...] obj/flash_board_cstartup.o
../at91lib/boards/asn442g/board_cstartup.S, ...) failed.
It appears on the face of it that the compiler arm-none-eabi-gcc cannot be found. Is it installed, and does the PATH environment variable include its location?

Related

Using gmake on Mac with CLion (with an ArchLinux makefile)

I am trying to use a make file that my professor provided, but that make file is made to work in an Arch Linux VM, and not my Mac environment. To solve this, I've downloaded gmake and gcc via homebrew, and swapped them out as the make and compiler targets in my CLion toolchain. However, when I try to build, I am still getting the error "ld: unknown option: -rpath=$ORIGIN". This is the line that is failing (line 10) everytime:
$(CC) $(CFLAGS) $(LDFLAGS) -DDEBUG=$(DEBUG) -L. -Wl,-rpath='$$ORIGIN' -driverfile myfile.c -o $#
Here is my output when I hit build:
====================[ Build | all ]=============================================
/usr/local/Cellar/make/4.3/bin/gmake --jobs=9 all
/usr/local/Cellar/gcc/11.2.0_3/bin/gcc-11 -Wall -g -DDEBUG=1 -L. -Wl, -rpath='$ORIGIN' -driverfile myfile.c -o myfile
ld: unknown option: -rpath=$ORIGIN
collect2: error: ld returned 1 exit status
gmake: *** [Makefile:10: myfile] Error 1
I am allowed to modify the makefile for testing purposes on my local machine, so long as all the stuff still works with the original makefile on the Arch Linux VM, and I'm happy to do this if it's the only solution, but I'd much rather figure out why its not working as is. (Even if the answer is 'Bc its a Mac and Apple says so.')

No such file or directory error when using make

I am still relatively new to Linux, but I have an assignment in my operating systems class that involves several files. My professor gave us his makefile, but it isn't working for me. Make just returns errors. I know that I have all of the same files as my professor and, although mine aren't done yet, there is no reason I see for the code to not compile.
Here is the Makefile:
sync: sync.c prodcons.c prodcons.h producer.c producer.h consumer.c consumer.h Makefile
${CC} -g -Wall -pthread -o sync ssync.c prodcons.c producer.c consumer.c ln -sf sync assn4
and here is the error message I am getting:
J_studentid#cs3060:~/assn4$ make
cc -g -Wall -pthread -o sync sync.c prodcons.c producer.c consumer.c ln -sf sync assn4
cc: error: ln: No such file or directory
cc: error: sync: No such file or directory
cc: error: assn4: No such file or directory
cc: error: unrecognized command line option ‘-sf’; did you mean ‘-Hf’?
Makefile:2: recipe for target 'sync' failed
make: *** [sync] Error 1
J_studentid#cs3060:~/assn4$
I saw the professor compile and run the code in class, so I know it has the potential to work, but it is giving me problems. I am more than happy to provide more information or code, but I don't think the contents of the files is relevant to the compilation errors. Thank you!
I am pretty sure that this is the intended source code of your makefile that is both valid and working:
all:
${CC} -g -Wall -pthread -o sync ssync.c prodcons.c producer.c consumer.c
ln -sf sync assn4
Issues with your makefile were:
No default target, i.e. missing all:
ln -sf sync assn4 were used as compiler arguments
Also, please make sure that the command lines (e.g., ${CC} ...) always start with a TAB character. I cannot tell whether there was some in your codeblock since they are changed to spaces automatically here but wanted to point out.

Is there a way to find the root of this error?

Im trying to compile some files with this given gcc command on a server cluster through Mac terminal:
gcc -o driver -std=c11 -Wall -W -ggdb3 driver.c ASMParser.c ParseResult.c Generate.o Grader.o
And get this error:
/usr/bin/ld:Grader.o: file format not recognized; treating as linker script
/usr/bin/ld:Grader.o:1: syntax error
collect2: error: ld returned 1 exit status
but its not very helpful considering Grader.o is a file I didn't even modify, it was provided by the teacher.
Any help on how to fix this? I have compiled it successfully using that gcc command before but after I added a few more implementation details in ASMParser.c it started giving me this error. Im expecting it to create a file called "driver" that I can run like this:
./driver "test file" "results.txt"

Openssl (OS X Yosemite) Installation Make Errors

While OpenSSL ver. 0.9.8za was already installed on my system (darwin64-x86_64-cc), I elected to install the latest version, 1.0.1j, using the instructions for UNIX systems, in the "INSTALL" file within the downloaded tarball. I chose to configure with the 64-bit option, './Configure darwin64-x86_64-cc', and then ran the makefile. So far, so good. After about a minute, as I was thinking the installation would be successful, the compiler displayed following error messages, after compilation terminated:
Compile command line: './Configure darwin64-x86_64-cc' (Openssl suggestion for 64-bit)
duplicate symbol _OPENSSL_cleanse in:
../libcrypto.a(mem_clr.o)
../libcrypto.a(x86_64cpuid.o)
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1
The problem appears to originate in the linker, but then again, I'm still a command line novice.
So, given this error, what needs to be changed in order to fully compile OpenSSL 1.0.1j?
When the automatic configuration route was taken (./config), the following error is given:
cc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include -DOPENSSL_THREADS -D_REENTRANT
DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN
DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m
DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM
DGHASH_ASM -c -o obj_xref.o obj_xref.c
ar r ../../libcrypto.a o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
ar: ../../libcrypto.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: ../../libcrypto.a: Inappropriate file type or format
make[2]: *** [lib] Error 1
make[1]: *** [subdirs] Error 1
make: *** [build_crypto] Error 1
Update: The "PROBLEMS" documentation suggests changing two lines in the apps/Makefile and test/Makefile:
"LIBCRYPTO= -L.. -lcrypto"
"LIBSSL=-L -lssl"
to:
"LIBCRYPTO=../libcrypto.a"
"LIBSSL=../libssl.a"
Re-attempting make afterward, the same message was given.
My sincere thanks for the help and comments by jww, Jonathan L. and others gave/made. Should errors persist, I'll continue the search for the missing information and eventually post a solution.
I'm not sure what your problem is. Using XCode 6 (6.1.1, I believe) on Yosemite 10.10.1, I was able to get openssl-1.0.1j from OpenSSL.org and extract it. I then configured it with:
./Configure --prefix=/usr/openssl/openssl-1.0.1j darwin64-x86_64-cc zlib threads shared
With those, I was able to build, test and install without problem. That's pretty close to what you did; I simply have noted the presence of zlib (compression) and requested thread and shared library support — and specified a slightly out-of-the-way location to install it. (The top-level directory specified with --prefix existed but was empty.) I tried adding sctp to the configuration options, but no dice — an SCTP header is missing, so I didn't bother to try further.

Error occurs when compiling with GCC

I am attempting to compile a C program with multiple files on window platform. However, when I make it, errors are occurred. I have already tried to modify command in makefile but still could not fix it.
This is my GCC command:
gcc -o "SYSMONTR" $(OBJPATH)/chkdsksp ../chkdsksp.c -g -I"$(DB2PATH)/include" -I"$(MYLIBDIR)" $(MYIQDIR)/iqclilib.a $(OBJPATH)/icrou.a -lc -ldb2 -lnsl -L"$(DB2PATH)/lib"
This is result:
gcc -o "SYSMONTR" ../../iLINKOBJ/chkdsksp ../chkdsksp.c -g -I"C:/Program Files/IBM/SQLLIB/include" -I"../../iLINKCLIB" ../../iLINKIQOBJ/iqclilib.a ../../iLINKOBJ/icrou.a -lc -ldb2 -lnsl -L"C:/Program Files/IBM/SQLLIB/lib"
../../iLINKOBJ/chkdsksp: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
makefile:49: recipe for target `SYSMONTR' failed
make: *** [SYSMONTR] Error 1
What could cause such error and what should I do with it? Using cygwin on Window (IDE: Eclipse).
Any supports will be appreciated.
If chkdsksp is an object file built by another team to run on AIX, you cannot expect it to function -- or even be recognized by your compiler -- on Cygwin. You must contact that team and get a) the source code or b) a version of the object file compiled for your platform (and tested).

Resources