Instructions in the blinky.zip, gcc-section, Teensy++ v.2. Makefile and blinky.c are in the zip. I modified the blinky.c by defining F_CPU at the start because not using Makefile, please, see below. So why do I get the errs and how can I compile the C-files for at90usb1286 chip?
$ avr-gcc -mmcu=atmega88 blinky.c
In file included from blinky.c:28:
/usr/local/lib/gcc/avr/4.2.2/../../../../avr/include/util/delay.h:90:3: warning: #warning "Compiler optimizations disabled; functions from <util/delay.h> won't work as designed"
/tmp//ccB66ecl.o: In function `main':
blinky.c:(.text+0x3e): undefined reference to `usb_init'
/tmp//ccB66ecl.o: In function `morse_character':
blinky.c:(.text+0x24c): undefined reference to `print_P'
blinky.c:(.text+0x36e): undefined reference to `print_P'
blinky.c:(.text+0x378): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x37e): undefined reference to `print_P'
blinky.c:(.text+0x386): undefined reference to `print_P'
blinky.c:(.text+0x390): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x394): undefined reference to `usb_debug_putchar'
blinky.c:(.text+0x416): undefined reference to `print_P'
blinky.c:(.text+0x4fa): undefined reference to `print_P'
blinky.c:(.text+0x6f8): undefined reference to `print_P'
/tmp//ccB66ecl.o: In function `morse_P':
blinky.c:(.text+0x834): undefined reference to `print_P'
Those are link errors. You could do a compile only (notice that I added the -c flag):
avr-gcc -c -mmcu=atmega88 blinky.c
You would then have to link that with your other objects to create a binary.
Alternately, you could provide all the source files in a single command line and the compiler will compile and link them:
avr-gcc -mmcu=atmega88 blinky.c print.c usb_debug_only.c
Related
I'm trying to make print usable for an arm64 platform (bare-metal, compiler is aarch64-none-elf-gcc).
If I naively compile a simple hello_world.c program containing printf, I get errors as I expected. The errors are like below.
ckim#chan-ubuntu:~/prj/abdsn/ab21u/ab21zeus/simoob$ arm-none-elf-gcc tt.c
....aarch64-none-elf/lib/libc.a(lib_a-exit.o): in function `exit':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'
....aarch64-none-elf/lib/libc.a(lib_a-sbrkr.o): in function `_sbrk_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/sbrkr.c:51: undefined reference to `_sbrk'
....aarch64-none-elf/lib/libc.a(lib_a-writer.o): in function `_write_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/writer.c:49: undefined reference to `_write'
....aarch64-none-elf/lib/libc.a(lib_a-closer.o): in function `_close_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/closer.c:47: undefined reference to `_close'
....aarch64-none-elf/lib/libc.a(lib_a-lseekr.o): in function `_lseek_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/lseekr.c:49: undefined reference to `_lseek'
....aarch64-none-elf/lib/libc.a(lib_a-readr.o): in function `_read_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/readr.c:49: undefined reference to `_read'
....aarch64-none-elf/lib/libc.a(lib_a-fstatr.o): in function `_fstat_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/fstatr.c:55: undefined reference to `_fstat'
....aarch64-none-elf/lib/libc.a(lib_a-isattyr.o): in function `_isatty_r':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/newlib/libc/reent/isattyr.c:52: undefined reference to `_isatty'
collect2: error: ld returned 1 exit status
The toolchain is looking for _exit, _sbrk, _write, _close, _lseek, _lread, _fstat, _isatty which I should probably supply for the linker to link. But I guess because arm64 is being widely used, there should be some codes I can just reference/download and fix a little for our UART IP and use. Can anyone give me some direction?
In the past, someone in our team seem to have borrowed linux code and separate printf which uses our uart IP (using sparc architecture). I'm not sure if I should do the similar thing for this case too.
I am trying to use FFmpeg libraries available from here under Windows 10 (64 bits). I downloaded version=20181126-90ac0e5, architecture=Windows-64, Linking=Dev. There are 3 folders inside that FFmpeg folder: examples, lib and include.
To use these libraries I copied the contents of the "include" folder to the "include" folder of my MinGW installation. I also copied the contents of the "lib" folder to the "lib" folder of MinGW.
I try to compile the decode_video.c example that comes inside the examples folder with the following way:
gcc decode_video.c -o decode_video.exe -lavcodec -lavutil -lavformat -lm
The compiler gives me these undefined references:
undefined reference to `avcodec_send_packet'
undefined reference to `avcodec_receive_frame'
undefined reference to `av_packet_alloc'
undefined reference to `avcodec_find_decoder'
undefined reference to `av_parser_init'
undefined reference to `avcodec_alloc_context3'
undefined reference to `avcodec_open2'
undefined reference to `av_frame_alloc'
undefined reference to `av_parser_parse2'
undefined reference to `av_parser_close'
undefined reference to `avcodec_free_context'
undefined reference to `av_frame_free'
undefined reference to `av_packet_free'
I would like to know what I am doing wrong here. Any guidance is very welcome.
I'm trying to add the Chilkat C/C++ libraries into a project in CodeBlocks (32-bit, version 12.11) for Windows 7.
So I went to http://www.chilkatsoft.com/downloads_mingw.asp, and downloaded the 32-bit MinGW library.
Then in CodeBlocks I did:
Settings>Compiler>Linker Settings>Add>C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a
Settings>Compiler>Search Directories>Compiler>Add>C:\chilkat-9.5.0-mingw32\include
Settings>Compiler>Search Directories>Linker>Add>C:\chilkat-9.5.0-mingw32
Project>Build Options...>Project Root>Linker Settings>Add>C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a
Project>Build Options...>Project Root>Search Directory>Compiler>Add>C:\chilkat-9.5.0-mingw32\include
Project>Build Options...>Project Root>Search Directory>Linker>Add>C:\chilkat-9.5.0-mingw32
Then I set my compiler to GNU GCC Compiler.
Finally, I encounter these two issues:
When I do #include<...> and press Ctrl+Space inside the brackets, there are no suggestions for anything related to the Chilkat library. See first code block below for full code (pretty simple).
While the program builds successfully with CkMailMan.h included, it breaks when I instantiate CkMailMan, with the errors shown in the second code block below.
I suspect it has to do with the library extension being ".a," which is for Linux. But I get the same problem when I do a Visual Basic version of this library (extensions .dll) and use the Microsoft Visual C++ 2010 compiler. Any ideas?
Code:
#include <iostream>
#include <CkMailMan.h>
using namespace std;
CkMailMan mailman;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
Error messages in Build Log when running code:
-------------- Build: Debug in TimeButler (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -IC:\chilkat-9.5.0-x86-vc10\include -IC:\chilkat-9.5.0-mingw32\include -IC:\chilkat-9.5.0-mingw32\include -c C:\TimeButler\main.cpp -o obj\Debug\main.o
mingw32-g++.exe -LC:\chilkat-9.5.0-x86-vc10\libs -LC:\chilkat-9.5.0-mingw32 -LC:\chilkat-9.5.0-mingw32 -o bin\Debug\TimeButler.exe obj\Debug\main.o C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbgDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRel.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRelDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbg.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatDbgDll.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRel.lib C:\chilkat-9.5.0-x86-vc10\libs\ChilkatRelDll.lib C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x51): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x14a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x395): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x4cf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x5d7): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.text+0x6df): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMailMan.o):CkMailMan.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x15a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x247): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x30b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x35b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x805): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.text+0x9c8): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsBase.o):ClsBase.cpp:(.eh_frame+0x173): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x6a): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x522): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.text+0x666): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkMultiByteBase.o):CkMultiByteBase.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xa5): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x151): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x3fd): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x587): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0x8af): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.text+0xbd3): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsMailMan.o):ClsMailMan.cpp:(.eh_frame+0x3f): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x117): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x253): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x3bf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x5ff): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x806): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.text+0x88b): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(_clsTcp.o):_clsTcp.cpp:(.eh_frame+0xcb): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x5b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0xd6): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x142): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x3dd): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x451): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.text+0x4e2): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(CkString.o):CkString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xd3): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x163): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x21b): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0x862): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xfd9): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.text+0xff3): more undefined references to `_Unwind_Resume' follow
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(XString.o):XString.cpp:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0xaf): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x15f): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x482): undefined reference to `_Unwind_Resume'
C:\chilkat-9.5.0-mingw32\libchilkat-9.5.0.a(ClsHttpProxyClient.o):ClsHttpProxyClient.cpp:(.text+0x733): undefined reference to `_Unwind_Resume'
Process terminated with status 1 (0 minutes, 10 seconds)
50 errors, 0 warnings (0 minutes, 10 seconds)
Turns out I needed to switch to the visual Studio C++ compiler and download the library in that compiler's format. I was right about not being able to use '.a' extension libraries.
I just recently built and installed the hsa branch of gcc according to the associated wiki. Everything went relatively well until I got around to making the samples, vectorCopy and matrixMultiply. Here is the error output I got for matrixMultiply when running the make command (again, following the recommendations of the wiki):
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_region_get_info'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_init'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_create'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_agent_iterate_regions'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_create'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_store_relaxed'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_get_symbol'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_add_module'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_signal_wait_acquire'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_destroy'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_memory_allocate'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_status_string'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_iterate_agents'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_finalize'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_create'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_agent_get_info'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_queue_create'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_freeze'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_queue_add_write_index_relaxed'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_symbol_get_info'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_load_code_object'
I am using Lubuntu 15.04 with the standard kernel (3.19). I am using slightly old driver and runtime components that correspond to HSA 1.0 Provisional rather than 1.0 Final, since Okra (which is needed for HSA-OpenMP-GCC) is not yet up-to-date and can not be used with the latest drivers and firmware. I have "sanity checked" the runtime and Okra, and both tests (vector_copy and Squares, respectively) function properly. I am also able to use aparapi-lambda successfully with the same setup.
The hardware is an A10-7700k on an Asus A88x-Pro motherboard with 16Gb of RAM.
So, does anyone know why I am getting these errors? I am under the suspicion that the GCC hsa branch has been updated to follow the 1.0 Final specification which is not yet compatible with Okra, which would prevent anyone from actually being able to use the compiler until someone finally updates Okra. But, I can't be too sure about that.
edit: Here is the new makefile:
GCCHSAIL=$(GCC_HSA)/bin/gcc
LDFLAGS=-lhsa-runtime64 -lhsa-runtime-ext64 -lhsakmt -L $(GCC_HSA)/lib64 -L ~/HSA-Runtime-AMD-master/lib -L opt/hsa/lib -L ~/libhsakmt/build/lnx64a -Wl,-rpath,$(GCC_HSA)/lib64
CFLAGS=-lm -fopenmp -Wall -O3
all : matmul
clean :
rm -rf *.o matmul test.output
# GCC Specifics
matmul.o : matmul.c
$(GCCHSAIL) -c $(CFLAGS) $<
matmul : matmul.o
$(GCCHSAIL) matmul.o $(CFLAGS) -o $# $(LDFLAGS)
The old makefile had no switches making reference to required .so files. With the new makefile, now I get the following errors:
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_add_module'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_symbol_get_info'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_load_code_object'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_freeze'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_create'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_executable_get_symbol'
/hsailgcc/lib64/libgomp.so: undefined reference to `hsa_ext_program_finalize'
There are fewer errors now, though, for whatever reason, 7 of them persist.
edit edit: Problem solved. The GCC hsa branch has moved on to support HSA 1.0F and no longer depends on Okra. That means that the old driver components and old runtime I used to maintain Okra compatibility are incompatible with the present build of GCC hsa. That should be simple enough to fix. Thanks for all the help with compiler switches.
gcc link results with errors:
dns.cpp: undefined reference to '__res_querydomain'
dns.cpp: undefined reference to '__dn_skipname'
dns.cpp: undefined reference to '__dn_expand'
dns.cpp: undefined reference to '__res_query'
Is there another library that I need to link to?
Adding -lresolv solved this for me.