FFmpeg libraries on Windows - Undefined References - ffmpeg

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.

Related

GCC ICU 57 static linking

I am trying to link ICU 57 to my binary file. That does not work even thought (I think at least) I am linking the static lib files.
Here is a blunt example:
gcc -static /usr/lib/libicui18n.a /usr/lib/libicuuc.a /usr/lib/libicudata.a /usr/lib/libicule.a /usr/lib/libiculx.a /usr/lib/libicutu.a /usr/lib/libicuuc.a /usr/lib/libicuio.a obj/ex.o obj/msg.o -o bin/ex
This is the error message that I get:
src/msg.c:5: undefined reference to `u_fopen_57'
src/msg.c:9: undefined reference to `u_fgetfile_57'
src/msg.c:10: undefined reference to `u_fgetfile_57'
src/msg.c:11: undefined reference to `u_frewind_57'
src/msg.c:18: undefined reference to `u_fgetc_57'
src/msg.c:17: undefined reference to `u_feof_57'
src/msg.c:25: undefined reference to `u_fclose_57'
Linking the dynamic libs works fine though.
If you can, I'd recommend using pkg-config as I recommended here,
specifically with pkg-config --static … as explained here

Making samples for HSA branch of GCC compiler

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.

Undefined reference errors in gcc

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.

GSoap QT undefined reference to `soap_new'?

I'm trying to use gSoap in QT. When I compile my project I get:
undefined reference to `soap_new'
undefined reference to `soap_delete'
undefined reference to `soap_end'
undefined reference to `soap_free'
undefined reference to `soap_delete'
undefined reference to `soap_end'
undefined reference to `soap_free'
My sample pro contains:
INCLUDEPATH += ../../gsoap-2.8/gsoap/
LIBS += -lwsock32
Any idea what's wrong?
I produced file with:
soapcpp2 -I ../../gsoap-2.8/gsoap/import -i quote.h
soapcpp2 -I ../../gsoap-2.8/gsoap/import quote.h
Those functions are defined in sdtsoap2.c or stdsoap2.cpp (depending if you are using C or C++; for Qt I infer C++).
You must either include stdsoap2.cpp in your project or link against libsoap++.
If you need to pass different flags like WITH_NONAMESPACES, use the first.If you have no special configuration for GSOAP, use the later.
Look at GSOAP docs for more info.

AVR_GCC compile errors delay.h

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

Resources