Undefined references when building GLFW/OpenGL program? - c

I am trying to use C, MINGW and GLFW to create a program and I keep on getting this error when compiling.
cc1.exe: warning: unrecognized gcc debugging option: y
cc1.exe: warning: unrecognized gcc debugging option: n
cc1.exe: warning: unrecognized gcc debugging option: m
cc1.exe: warning: unrecognized gcc debugging option: i
cc1.exe: warning: unrecognized gcc debugging option: c
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x127): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x160): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x179): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1ca): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x24b): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x291): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x9ee): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa07): undefined reference to `GetDeviceCaps#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe9f): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xeba): undefined reference to `GetDeviceGammaRamp#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xec8): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x100e): undefined reference to `CreateDCW#16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1029): undefined reference to `SetDeviceGammaRamp#8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1037): undefined reference to `DeleteDC#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1f3): undefined reference to `CreateDIBSection#24'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x262): undefined reference to `CreateBitmap#20'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x28d): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x37b): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x389): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xb55): undefined reference to `CreateRectRgn#16'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc2c): undefined reference to `DeleteObject#4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x6c4): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xbbd): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xf46): undefined reference to `SwapBuffers#4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1254): undefined reference to `ChoosePixelFormat#8'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x126f): undefined reference to `SetPixelFormat#12'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1592): undefined reference to `DescribePixelFormat#16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15d9): undefined reference to `SetPixelFormat#12'
collect2.exe: error: ld returned 1 exit status
This is my code
#include "GLFW/glfw3.h"
#include <stdio.h>
#define GLFW_INCLUDE_GLCOREARB
int main() {
GLFWwindow* window;
if (!glfwInit()) return -1;
window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
if (!window)
{
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
So its basically just the given example on glfw website.
I use this command to build:
gcc -o Test.o Main.c -IGLFW -IGL -dynamic ./libs/glfw3.dll ./libs/glew32.dll -lopengl32 -static ./libs/libglfw3.a ./libs/glew32.lib ./libs/glew32s.lib
I dont have any issues with compiling the glfw but I have problems with GLEW, maybe it is because it is lib files instead of a.

Related

Mingw GCC Linker complains when using std option flag

I'm using Mingw's gcc compiler but when I started using the -std options, the linker started complaining about references (except for -std=gnuXX).
I can't find anything about this (maybe I'm really bad at research) because most of the results are on linux and/or relate to other problems with ld..
Here is the command I typed :
gcc src/main.c -o bin/main.exe -std=c11 The same occurs with c89,c99,c17 etc..
Here is my test code :
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
printf("Cool\n");
return EXIT_SUCCESS;
}
Here is the command output
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(mbrscan.o):(.text+0xb6):
undefined reference to `SetLastError#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingw32.a(wcharmap.o):(.text+0x208): undefined reference to `WideCharToMultiByte#32'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0xbe):
undefined reference to `GetCPInfo#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../libmingwex.a(codeset.o):(.text+0x143): undefined reference to `GetCPInfo#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_init_function':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:639: undefined reference to `CreateSemaphoreW#16'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_key_create':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:590: undefined reference to `TlsAlloc#0'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:597: undefined reference to `__mingwthr_key_dtor'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_getspecific':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:621: undefined reference to `SetLastError#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_lock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:655: undefined reference to `InterlockedIncrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_unlock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:689: undefined reference to `InterlockedDecrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:690: undefined reference to `ReleaseSemaphore#12'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_setspecific':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:629: undefined reference to `TlsSetValue#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_once':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:562: undefined reference to `InterlockedIncrement#4'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/9.2.0/libgcc_eh.a(emutls.o): in function `_gthread_mutex_lock':
/home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:656: undefined reference to `WaitForSingleObject#8'
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: /home/keith/builds/mingw/gcc-9.2.0-mingw32-cross-native/mingw32/libgcc/./gthr-default.h:662: undefined reference to `InterlockedDecrement#4'
collect2.exe: error: ld returned 1 exit status
I'm also wondering if I should use Mingw-w64 or Clang/LLVM instead.. ?
EDIT : It works fine with Mingw-w64 so I switched, thanks !

Trouble linking own application using ffmpeg/libav

I have a source, that I'd like to build and link against the libav library on Linux.
I followed the compilation guide of ffmpeg here: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Everything works.
I build the included examples like this: FFmpeg: building example C codes
It also works.
Now, I'd like to build my own little applications, where I try to learn about using libav. My current problem is, that by using the command line
gcc muxing.c -g -I ../../../ffmpeg_build/include/ -L ../../../ffmpeg_build/lib/ -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil -lm -lz -lpthread -lfdk-aac -lmp3lame -lx264 -lva -lX11
I get to this point:
muxing.c: In function ‘write_audio_frame’:
muxing.c:354:5: warning: ‘avcodec_encode_audio2’ is deprecated [-Wdeprecated-declarations]
ret = avcodec_encode_audio2(codecContext, &pkt, frame, &got_packet);
^~~
In file included from ../../../ffmpeg_build/include/libavformat/avformat.h:317:0,
from muxing.c:42:
../../../ffmpeg_build/include/libavcodec/avcodec.h:5418:5: note: declared here
int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt,
^~~~~~~~~~~~~~~~~~~~~
muxing.c: In function ‘write_video_frame’:
muxing.c:524:5: warning: ‘avcodec_encode_video2’ is deprecated [-Wdeprecated-declarations]
ret = avcodec_encode_video2(codecContext, &pkt, frame, &got_packet);
^~~
In file included from ../../../ffmpeg_build/include/libavformat/avformat.h:317:0,
from muxing.c:42:
../../../ffmpeg_build/include/libavcodec/avcodec.h:5457:5: note: declared here
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt,
^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: ../../../ffmpeg_build/lib//libx264.a(opencl-8.o): undefined reference to symbol 'dlclose##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Then I read, in order to overcome this linker error, I have to append -ldl to my command line, but then I get this:
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_flush':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:204: undefined reference to `opus_multistream_decoder_ctl'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:169: undefined reference to `opus_multistream_decode_float'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:165: undefined reference to `opus_multistream_decode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:174: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:145: undefined reference to `opus_multistream_decoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libopusdec.o): In function `libopus_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:101: undefined reference to `opus_multistream_decoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:105: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:111: undefined reference to `opus_multistream_decoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:113: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:126: undefined reference to `opus_multistream_decoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusdec.c:129: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:487: undefined reference to `opus_multistream_encode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:483: undefined reference to `opus_multistream_encode_float'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:492: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:530: undefined reference to `opus_multistream_encoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:348: undefined reference to `opus_multistream_encoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:358: undefined reference to `opus_multistream_surround_encoder_create'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:365: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_configure_encoder':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:121: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:123: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:128: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:131: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:134: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:136: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:139: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:142: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:145: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:148: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:153: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:156: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:161: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:164: undefined reference to `opus_strerror'
../../../ffmpeg_build/lib//libavcodec.a(libopusenc.o): In function `libopus_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:410: undefined reference to `opus_multistream_encoder_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:412: undefined reference to `opus_strerror'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libopusenc.c:426: undefined reference to `opus_multistream_encoder_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:287: undefined reference to `vorbis_analysis_buffer'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:294: undefined reference to `vorbis_analysis_wrote'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:310: undefined reference to `vorbis_analysis_blockout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:311: undefined reference to `vorbis_analysis'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:313: undefined reference to `vorbis_bitrate_addblock'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:317: undefined reference to `vorbis_bitrate_flushpacket'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:302: undefined reference to `vorbis_analysis_wrote'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:180: undefined reference to `vorbis_analysis_wrote'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:182: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:183: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:184: undefined reference to `vorbis_info_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:203: undefined reference to `vorbis_info_init'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_setup':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:98: undefined reference to `vorbis_encode_setup_vbr'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:107: undefined reference to `vorbis_encode_setup_managed'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:114: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:121: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:127: undefined reference to `vorbis_encode_ctl'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:160: undefined reference to `vorbis_encode_setup_init'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisenc.o): In function `libvorbis_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:208: undefined reference to `vorbis_analysis_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:214: undefined reference to `vorbis_block_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:220: undefined reference to `vorbis_comment_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:222: undefined reference to `vorbis_comment_add_tag'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:224: undefined reference to `vorbis_analysis_headerout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisenc.c:257: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:161: undefined reference to `vpx_codec_decode'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:221: undefined reference to `vpx_codec_get_frame'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:162: undefined reference to `vpx_codec_error'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:163: undefined reference to `vpx_codec_error_detail'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:161: undefined reference to `vpx_codec_decode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:162: undefined reference to `vpx_codec_error'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_decode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:222: undefined reference to `vpx_codec_get_frame'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:201: undefined reference to `vpx_codec_vp9_dx_algo'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:201: undefined reference to `vpx_codec_vp8_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_free':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:269: undefined reference to `vpx_codec_destroy'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:271: undefined reference to `vpx_codec_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vpx_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:53: undefined reference to `vpx_codec_version_str'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:54: undefined reference to `vpx_codec_build_config'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:56: undefined reference to `vpx_codec_dec_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:59: undefined reference to `vpx_codec_error'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vp8_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:278: undefined reference to `vpx_codec_vp8_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxdec.o): In function `vp9_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxdec.c:298: undefined reference to `vpx_codec_vp9_dx_algo'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_encode':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1118: undefined reference to `vpx_codec_encode'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1126: undefined reference to `vpx_codec_encode'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `queue_frames':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:979: undefined reference to `vpx_codec_get_cx_data'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:981: undefined reference to `vpx_codec_get_cx_data'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `log_encoder_error':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:164: undefined reference to `vpx_codec_error'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:165: undefined reference to `vpx_codec_error_detail'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `codecctl_int':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:298: undefined reference to `vpx_codec_control_'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:524: undefined reference to `vpx_codec_get_caps'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:527: undefined reference to `vpx_codec_version_str'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:528: undefined reference to `vpx_codec_build_config'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:533: undefined reference to `vpx_codec_enc_config_default'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:534: undefined reference to `vpx_codec_err_to_string'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:719: undefined reference to `vpx_codec_enc_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:727: undefined reference to `vpx_codec_enc_init_ver'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:812: undefined reference to `vpx_img_wrap'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:820: undefined reference to `vpx_img_wrap'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vp8_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1279: undefined reference to `vpx_codec_vp8_cx'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vp9_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:1309: undefined reference to `vpx_codec_vp9_cx'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `codecctl_intp':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:320: undefined reference to `vpx_codec_control_'
../../../ffmpeg_build/lib//libavcodec.a(libvpxenc.o): In function `vpx_free':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:344: undefined reference to `vpx_codec_destroy'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpxenc.c:346: undefined reference to `vpx_codec_destroy'
../../../ffmpeg_build/lib//libavcodec.a(libx265.o): In function `libx265_encode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:84: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:86: undefined reference to `x265_api_get_173'
../../../ffmpeg_build/lib//libavcodec.a(libx265.o): In function `libx265_encode_init_csp':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:494: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:496: undefined reference to `x265_api_get_173'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libx265.c:498: undefined reference to `x265_api_get_173'
../../../ffmpeg_build/lib//libavcodec.a(libvpx.o): In function `ff_vp9_init_static':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpx.c:73: undefined reference to `vpx_codec_vp9_cx'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvpx.c:73: undefined reference to `vpx_codec_get_caps'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:191: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:192: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:193: undefined reference to `vorbis_info_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:194: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_frame':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:169: undefined reference to `vorbis_synthesis'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:175: undefined reference to `vorbis_synthesis_pcmout'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:179: undefined reference to `vorbis_synthesis_read'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:170: undefined reference to `vorbis_synthesis_blockin'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:48: undefined reference to `vorbis_info_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:49: undefined reference to `vorbis_comment_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:97: undefined reference to `vorbis_synthesis_headerin'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_close':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:191: undefined reference to `vorbis_block_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:192: undefined reference to `vorbis_dsp_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:193: undefined reference to `vorbis_info_clear'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:194: undefined reference to `vorbis_comment_clear'
../../../ffmpeg_build/lib//libavcodec.a(libvorbisdec.o): In function `oggvorbis_decode_init':
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:109: undefined reference to `vorbis_synthesis_init'
/home/ritter/ffmpeg_sources/ffmpeg/libavcodec/libvorbisdec.c:110: undefined reference to `vorbis_block_init'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_create':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1490: undefined reference to `vaGetDisplay'
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1514: undefined reference to `vaGetDisplayDRM'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vaapi.o): In function `vaapi_device_derive':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vaapi.c:1561: undefined reference to `vaGetDisplayDRM'
../../../ffmpeg_build/lib//libavutil.a(hwcontext_vdpau.o): In function `vdpau_device_create':
/home/ritter/ffmpeg_sources/ffmpeg/libavutil/hwcontext_vdpau.c:461: undefined reference to `vdp_device_create_x11'
collect2: error: ld returned 1 exit status
So, what can I do, to get it compiled and linked fully?

Getting error while running opencv code in C

I am having a opencv code in C:
#ifdef _CH_
#pragma package <opencv>
#endif
#ifndef _EiC
// motion templates sample code
#include "cv.h"
#include "highgui.h"
#include <time.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#endif
with these header files.
if I run it using
gcc `pkg-config --cflags --libs opencv` motempl_temp.c -o opencv
I get error:
/tmp/cc2rKXbX.o: In function `cvDecRefData':
motempl_temp.c:(.text+0xac2): undefined reference to `cvFree_'
motempl_temp.c:(.text+0xb4b): undefined reference to `cvFree_'
/tmp/cc2rKXbX.o: In function `cvGetRow':
motempl_temp.c:(.text+0xc63): undefined reference to `cvGetRows'
/tmp/cc2rKXbX.o: In function `cvGetCol':
motempl_temp.c:(.text+0xc91): undefined reference to `cvGetCols'
/tmp/cc2rKXbX.o: In function `cvReleaseMatND':
motempl_temp.c:(.text+0xcab): undefined reference to `cvReleaseMat'
/tmp/cc2rKXbX.o: In function `cvSubS':
motempl_temp.c:(.text+0xe08): undefined reference to `cvAddS'
/tmp/cc2rKXbX.o: In function `cvCloneSeq':
motempl_temp.c:(.text+0xe5a): undefined reference to `cvSeqSlice'
/tmp/cc2rKXbX.o: In function `cvSetNew':
motempl_temp.c:(.text+0xed6): undefined reference to `cvSetAdd'
/tmp/cc2rKXbX.o: In function `cvGetSetElem':
motempl_temp.c:(.text+0xf93): undefined reference to `cvGetSeqElem'
/tmp/cc2rKXbX.o: In function `cvEllipseBox':
motempl_temp.c:(.text+0x1062): undefined reference to `cvEllipse'
/tmp/cc2rKXbX.o: In function `cvFont':
motempl_temp.c:(.text+0x10ce): undefined reference to `cvInitFont'
/tmp/cc2rKXbX.o: In function `cvReadIntByName':
motempl_temp.c:(.text+0x11d8): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadRealByName':
motempl_temp.c:(.text+0x1277): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadStringByName':
motempl_temp.c:(.text+0x1306): undefined reference to
`cvGetFileNodeByName'
/tmp/cc2rKXbX.o: In function `cvReadByName':
motempl_temp.c:(.text+0x1349): undefined reference to
`cvGetFileNodeByName'
collect2: error: ld returned 1 exit status
All the header files are in the path /usr/local/include/opencv folder and this is included in the path variable.
The OpenCV C API is deprecated. You should use the C++ API.
You can compile your code with g++:
g++ motempl_temp.c -o opencv `pkg-config opencv --cflags --libs`

Android valgrind build fails on Mavericks

I'm trying to build valgrind for android-arm on my OS X (Mavericks). ./configure runs successfully but make gives me following error (I have removed some of the line from error log to keep it short):
valgrind-3.10.1 gausharm$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in include
make[2]: Nothing to be done for `all'.
Making all in VEX
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
make[3]: Nothing to be done for `all-am'.
Making all in coregrind
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
mkdir -p ../.in_place; \
for f in vgpreload_core-arm-linux.so ; do \
rm -f ../.in_place/$f; \
ln -f -s ../coregrind/$f ../.in_place; \
done
for f in ; do \
if [ ! -e $f.dSYM -o $f -nt $f.dSYM ] ; then \
echo "dsymutil $f"; \
dsymutil $f; \
fi; \
done
mkdir -p ../.in_place; \
for f in ; do \
rm -f ../.in_place/$f.dSYM; \
ln -f -s ../coregrind/$f.dSYM ../.in_place; \
done
mkdir -p ../.in_place; \
for f in m_gdbserver/32bit-core-valgrind-s1.xml m_gdbserver/32bit-core-valgrind-s2.xml m_gdbserver/32bit-core.xml m_gdbserver/32bit-linux-valgrind-s1.xml m_gdbserver/32bit-linux-valgrind-s2.xml m_gdbserver/32bit-linux.xml m_gdbserver/32bit-sse-valgrind-s1.xml m_gdbserver/32bit-sse-valgrind-s2.xml m_gdbserver/32bit-sse.xml m_gdbserver/64bit-avx-valgrind-s2.xml m_gdbserver/64bit-avx-valgrind-s1.xml m_gdbserver/64bit-avx.xml m_gdbserver/64bit-core-valgrind-s1.xml m_gdbserver/64bit-core-valgrind-s2.xml m_gdbserver/64bit-core.xml m_gdbserver/64bit-linux-valgrind-s1.xml m_gdbserver/64bit-linux-valgrind-s2.xml m_gdbserver/64bit-linux.xml m_gdbserver/64bit-sse-valgrind-s1.xml m_gdbserver/64bit-sse-valgrind-s2.xml m_gdbserver/64bit-sse.xml m_gdbserver/amd64-avx-coresse-valgrind.xml m_gdbserver/amd64-avx-coresse.xml m_gdbserver/amd64-avx-linux-valgrind.xml m_gdbserver/amd64-avx-linux.xml m_gdbserver/amd64-coresse-valgrind.xml m_gdbserver/amd64-linux-valgrind.xml m_gdbserver/arm-core-valgrind-s1.xml m_gdbserver/arm-core-valgrind-s2.xml m_gdbserver/arm-core.xml m_gdbserver/arm-vfpv3-valgrind-s1.xml m_gdbserver/arm-vfpv3-valgrind-s2.xml m_gdbserver/arm-vfpv3.xml m_gdbserver/arm-with-vfpv3-valgrind.xml m_gdbserver/arm-with-vfpv3.xml m_gdbserver/i386-coresse-valgrind.xml m_gdbserver/i386-linux-valgrind.xml m_gdbserver/power64-core-valgrind-s1.xml m_gdbserver/power64-core-valgrind-s2.xml m_gdbserver/power64-core.xml m_gdbserver/power64-linux-valgrind-s1.xml m_gdbserver/power64-linux-valgrind-s2.xml m_gdbserver/power64-linux.xml m_gdbserver/power-altivec-valgrind-s1.xml m_gdbserver/power-altivec-valgrind-s2.xml m_gdbserver/power-altivec.xml m_gdbserver/power-core-valgrind-s1.xml m_gdbserver/power-core-valgrind-s2.xml m_gdbserver/power-core.xml m_gdbserver/power-fpu-valgrind-s1.xml m_gdbserver/power-fpu-valgrind-s2.xml m_gdbserver/power-fpu.xml m_gdbserver/power-linux-valgrind-s1.xml m_gdbserver/power-linux-valgrind-s2.xml m_gdbserver/power-linux.xml m_gdbserver/powerpc-altivec32l-valgrind.xml m_gdbserver/powerpc-altivec32l.xml m_gdbserver/powerpc-altivec64l-valgrind.xml m_gdbserver/powerpc-altivec64l.xml m_gdbserver/s390-acr-valgrind-s1.xml m_gdbserver/s390-acr-valgrind-s2.xml m_gdbserver/s390-acr.xml m_gdbserver/s390-fpr-valgrind-s1.xml m_gdbserver/s390-fpr-valgrind-s2.xml m_gdbserver/s390-fpr.xml m_gdbserver/s390x-core64-valgrind-s1.xml m_gdbserver/s390x-core64-valgrind-s2.xml m_gdbserver/s390x-core64.xml m_gdbserver/s390x-generic-valgrind.xml m_gdbserver/s390x-generic.xml m_gdbserver/s390x-linux64-valgrind-s1.xml m_gdbserver/s390x-linux64-valgrind-s2.xml m_gdbserver/s390x-linux64.xml m_gdbserver/mips-cp0-valgrind-s1.xml m_gdbserver/mips-cp0-valgrind-s2.xml m_gdbserver/mips-cp0.xml m_gdbserver/mips-cpu-valgrind-s1.xml m_gdbserver/mips-cpu-valgrind-s2.xml m_gdbserver/mips-cpu.xml m_gdbserver/mips-linux.xml m_gdbserver/mips-linux-valgrind.xml m_gdbserver/mips-fpu-valgrind-s1.xml m_gdbserver/mips-fpu-valgrind-s2.xml m_gdbserver/mips-fpu.xml m_gdbserver/mips64-cp0-valgrind-s1.xml m_gdbserver/mips64-cp0-valgrind-s2.xml m_gdbserver/mips64-cp0.xml m_gdbserver/mips64-cpu-valgrind-s1.xml m_gdbserver/mips64-cpu-valgrind-s2.xml m_gdbserver/mips64-cpu.xml m_gdbserver/mips64-linux.xml m_gdbserver/mips64-linux-valgrind.xml m_gdbserver/mips64-fpu-valgrind-s1.xml m_gdbserver/mips64-fpu-valgrind-s2.xml m_gdbserver/mips64-fpu.xml; do \
rm -f ../.in_place/$f; \
ln -f -s ../coregrind/$f ../.in_place; \
done
Making all in .
mkdir -p ./.in_place
rm -f ./.in_place/default.supp
ln -s ../default.supp ./.in_place
Making all in memcheck
Making all in .
../coregrind/link_tool_exe_linux 0x38000000 /Users/gausharm/Softwares/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc -Wno-long-long --sysroot=/Users/gausharm/Softwares/android-ndk-r10b/platforms/android-14/arch-arm -fno-stack-protector -o memcheck-arm-linux -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -marm -mcpu=cortex-a8 -O2 -static -nodefaultlibs -nostartfiles -u _start -Wl,-z,noexecstack memcheck_arm_linux-mc_leakcheck.o memcheck_arm_linux-mc_malloc_wrappers.o memcheck_arm_linux-mc_main.o memcheck_arm_linux-mc_translate.o memcheck_arm_linux-mc_machine.o memcheck_arm_linux-mc_errors.o ../coregrind/libcoregrind-arm-linux.a ../VEX/libvex-arm-linux.a -lgcc
/Users/gausharm/Softwares/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: ../coregrind/libcoregrind-arm-linux.a: no archive symbol table (run ranlib)
/Users/gausharm/Softwares/android-ndk-r10b/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: ../VEX/libvex-arm-linux.a: no archive symbol table (run ranlib)
mc_leakcheck.c:1878: error: undefined reference to 'vgPlain_umsg'
.'vgPlain_null_ExeContext'
mc_malloc_wrappers.c:305: error: undefined reference to 'vgPlain_record_ExeContext'
mc_malloc_wrappers.c:319: error: undefined reference to 'vgPlain_record_ExeContext'
mc_malloc_wrappers.c:438: error: undefined reference to 'vgPlain_memset'
mc_malloc_wrappers.c:112: error: undefined reference to 'vgPlain_free_queue_volume'
mc_malloc_wrappers.c:112: error: undefined reference to 'vgPlain_free_queue_length'
mc_malloc_wrappers.c:193: error: undefined reference to 'vgPlain_allocEltPA'
mc_malloc_wrappers.c:165: error: undefined reference to 'vgPlain_cli_free'
mc_malloc_wrappers.c:223: error: undefined reference to 'vgPlain_freeEltPA'
mc_malloc_wrappers.c:215: error: undefined reference to 'vgPlain_tool_panic'
mc_malloc_wrappers.c:139: error: undefined reference to 'vgPlain_free_queue_volume'
mc_malloc_wrappers.c:139: error: undefined reference to 'vgPlain_free_queue_length'
mc_malloc_wrappers.c:367: error: undefined reference to 'vgPlain_HT_add_node'
mc_malloc_wrappers.c:350: error: undefined reference to 'vgPlain_cli_malloc'
mc_malloc_wrappers.c:359: error: undefined reference to 'vgPlain_memset'
mc_malloc_wrappers.c:367: error: undefined reference to 'vgPlain_HT_add_node'
mc_malloc_wrappers.c:372: error: undefined reference to 'vgPlain_get_ECU_from_ExeContext'
mc_malloc_wrappers.c:355: error: undefined reference to 'vgPlain_memset'
mc_malloc_wrappers.c:367: error: undefined reference to 'vgPlain_HT_add_node'
mc_malloc_wrappers.c:388: error: undefined reference to 'vgPlain_clo_alignment'
mc_malloc_wrappers.c:398: error: undefined reference to 'vgPlain_clo_alignment'
mc_malloc_wrappers.c:408: error: undefined reference to 'vgPlain_clo_alignment'
mc_malloc_wrappers.c:429: error: undefined reference to 'vgPlain_clo_alignment'
mc_malloc_wrappers.c:481: error: undefined reference to 'vgPlain_HT_remove'
mc_malloc_wrappers.c:527: error: undefined reference to 'vgPlain_HT_remove'
mc_malloc_wrappers.c:545: error: undefined reference to 'vgPlain_cli_malloc'
mc_malloc_wrappers.c:574: error: undefined reference to 'vgPlain_memcpy'
mc_malloc_wrappers.c:607: error: undefined reference to 'vgPlain_memset'
mc_malloc_wrappers.c:581: error: undefined reference to 'vgPlain_memcpy'
mc_malloc_wrappers.c:586: error: undefined reference to 'vgPlain_get_ECU_from_ExeContext'
mc_malloc_wrappers.c:628: error: undefined reference to 'vgPlain_HT_lookup'
mc_malloc_wrappers.c:642: error: undefined reference to 'vgPlain_HT_lookup'
mc_malloc_wrappers.c:657: error: undefined reference to 'vgPlain_record_ExeContext'
mc_malloc_wrappers.c:658: error: undefined reference to 'vgPlain_get_ECU_from_ExeContext'
mc_malloc_wrappers.c:689: error: undefined reference to 'vgPlain_HT_lookup'
mc_malloc_wrappers.c:698: error: undefined reference to 'vgPlain_HT_construct'
mc_malloc_wrappers.c:686: error: undefined reference to 'vgPlain_get_running_tid'
mc_malloc_wrappers.c:686: error: undefined reference to 'vgPlain_get_and_pp_StackTrace'
mc_malloc_wrappers.c:707: error: undefined reference to 'vgPlain_tool_panic'
mc_malloc_wrappers.c:691: error: undefined reference to 'vgPlain_clo_verbosity'
mc_malloc_wrappers.c:724: error: undefined reference to 'vgPlain_HT_remove'
mc_malloc_wrappers.c:741: error: undefined reference to 'vgPlain_HT_destruct'
mc_malloc_wrappers.c:721: error: undefined reference to 'vgPlain_get_running_tid'
mc_malloc_wrappers.c:721: error: undefined reference to 'vgPlain_get_and_pp_StackTrace'
mc_malloc_wrappers.c:727: error: undefined reference to 'vgPlain_get_running_tid'
mc_malloc_wrappers.c:839: error: undefined reference to 'vgPlain_get_and_pp_StackTrace'
mc_malloc_wrappers.c:865: error: undefined reference to 'vgPlain_get_running_tid'
mc_malloc_wrappers.c:875: error: undefined reference to 'vgPlain_get_and_pp_StackTrace'
mc_malloc_wrappers.c:917: error: undefined reference to 'vgPlain_HT_to_array'
mc_malloc_wrappers.c:1108: error: undefined reference to 'vgPlain_clo_xml'
mc_main.c:6769: error: undefined reference to 'vgPlain_free_queue_length'
mc_main.c:6769: error: undefined reference to 'vgPlain_free_queue_volume'
mc_main.c:921: error: undefined reference to 'vgPlain_OSetGen_Create_With_Pool'
mc_main.c:1015: error: undefined reference to 'vgPlain_OSetGen_Lookup'
mc_main.c:1031: error: undefined reference to 'vgPlain_OSetGen_AllocNode'
mc_main.c:1039: error: undefined reference to 'vgPlain_OSetGen_Insert'
mc_main.c:943: error: undefined reference to 'vgPlain_OSetGen_ResetIter'
mc_main.c:944: error: undefined reference to 'vgPlain_OSetGen_Next'
mc_main.c:952: error: undefined reference to 'vgPlain_OSetGen_AllocNode'
mc_main.c:955: error: undefined reference to 'vgPlain_OSetGen_Insert'
mc_main.c:966: error: undefined reference to 'vgPlain_OSetGen_Destroy'
mc_main.c:971: error: undefined reference to 'vgPlain_percentify'
mc_main.c:5399: error: undefined reference to 'vgPlain_printf'
mc_main.c:5363: error: undefined reference to 'vgPlain_printf'
mc_main.c:6819: error: undefined reference to 'vgPlain_sizeRangeMap'
mc_main.c:6823: error: undefined reference to 'vgPlain_indexRangeMap'
mc_main.c:6791: error: undefined reference to 'vgPlain_clo_xml'
mc_main.c:6791: error: undefined reference to 'vgPlain_clo_stats'
mc_main.c:6579: error: undefined reference to 'vgPlain_track_new_mem_stack_4'
mc_main.c:6580: error: undefined reference to 'vgPlain_track_new_mem_stack_8'
mc_main.c:6581: error: undefined reference to 'vgPlain_track_new_mem_stack_12'
mc_main.c:6582: error: undefined reference to 'vgPlain_track_new_mem_stack_16'
mc_main.c:6583: error: undefined reference to 'vgPlain_track_new_mem_stack_32'
mc_main.c:6584: error: undefined reference to 'vgPlain_track_new_mem_stack_112'
mc_main.c:6585: error: undefined reference to 'vgPlain_track_new_mem_stack_128'
mc_main.c:6586: error: undefined reference to 'vgPlain_track_new_mem_stack_144'
mc_main.c:6587: error: undefined reference to 'vgPlain_track_new_mem_stack_160'
mc_main.c:6589: error: undefined reference to 'vgPlain_track_new_mem_stack'
mc_main.c:6590: error: undefined reference to 'vgPlain_track_new_mem_stack_signal'
mc_main.c:6646: error: undefined reference to 'vgPlain_track_new_mem_brk'
mc_main.c:6660: error: undefined reference to 'vgPlain_newPA'
mc_main.c:6668: error: undefined reference to 'vgPlain_track_pre_reg_read'
mc_main.c:2360: error: undefined reference to 'vgPlain_am_shadow_alloc'
mc_main.c:2414: error: undefined reference to 'vgPlain_OSetGen_Create'
mc_main.c:6644: error: undefined reference to 'vgPlain_track_new_mem_brk'
mc_main.c:6564: error: undefined reference to 'vgPlain_track_new_mem_stack_4_w_ECU'
mc_main.c:6565: error: undefined reference to 'vgPlain_track_new_mem_stack_8_w_ECU'
mc_main.c:6566: error: undefined reference to 'vgPlain_track_new_mem_stack_12_w_ECU'
mc_main.c:6567: error: undefined reference to 'vgPlain_track_new_mem_stack_16_w_ECU'
mc_main.c:6568: error: undefined reference to 'vgPlain_track_new_mem_stack_32_w_ECU'
mc_main.c:6569: error: undefined reference to 'vgPlain_track_new_mem_stack_112_w_ECU'
mc_main.c:6570: error: undefined reference to 'vgPlain_track_new_mem_stack_128_w_ECU'
mc_main.c:6571: error: undefined reference to 'vgPlain_track_new_mem_stack_144_w_ECU'
mc_main.c:6572: error: undefined reference to 'vgPlain_track_new_mem_stack_160_w_ECU'
mc_main.c:6574: error: undefined reference to 'vgPlain_track_new_mem_stack_w_ECU'
mc_main.c:6575: error: undefined reference to 'vgPlain_track_new_mem_stack_signal'
mc_main.c:2362: error: undefined reference to 'vgPlain_out_of_memory_NORETURN'
mc_main.c:6655: error: undefined reference to 'vgPlain_clo_xml'
mc_main.c:301: error: undefined reference to 'vgPlain_am_shadow_alloc'
mc_main.c:305: error: undefined reference to 'vgPlain_memcpy'
mc_errors.c:1000: error: undefined reference to 'vgPlain_addr_is_in_block'
mc_errors.c:1066: error: undefined reference to 'vgPlain_initThreadInfo'
mc_errors.c:1006: error: undefined reference to 'vgPlain_addr_is_in_block'
mc_errors.c:1229: error: undefined reference to 'vgPlain_initThreadInfo'
mc_errors.c:1072: error: undefined reference to 'vgPlain_describe_addr'
mc_errors.c:313: error: undefined reference to 'vgPlain_snprintf'
mc_errors.c:311: error: undefined reference to 'vgPlain_snprintf'
mc_errors.c:410: error: undefined reference to 'vgPlain_get_error_extra'
mc_errors.c:412: error: undefined reference to 'vgPlain_get_error_kind'
mc_errors.c:446: error: undefined reference to 'vgPlain_get_error_where'
mc_errors.c:459: error: undefined reference to 'vgPlain_get_error_where'
mc_errors.c:421: error: undefined reference to 'vgPlain_get_error_string'
mc_errors.c:479: error: undefined reference to 'vgPlain_get_error_string'
mc_errors.c:501: error: undefined reference to 'vgPlain_get_error_string'
mc_errors.c:546: error: undefined reference to 'vgPlain_get_error_where'
mc_errors.c:547: error: undefined reference to 'vgPlain_get_error_address'
mc_errors.c:547: error: undefined reference to 'vgPlain_pp_addrinfo_mc'
mc_errors.c:667: error: undefined reference to 'vgPlain_get_error_where'
mc_errors.c:668: error: undefined reference to 'vgPlain_get_error_address'
mc_errors.c:668: error: undefined reference to 'vgPlain_pp_addrinfo_mc'
mc_errors.c:643: error: undefined reference to 'vgPlain_get_error_string'
mc_errors.c:703: error: undefined reference to 'vgPlain_get_error_kind'
mc_errors.c:663: error: undefined reference to 'vgPlain_get_error_address'
mc_errors.c:668: error: undefined reference to 'vgPlain_pp_addrinfo_mc'
mc_errors.c:603: error: undefined reference to 'vgPlain_get_error_address'
mc_errors.c:739: error: undefined reference to 'vgPlain_is_watched'
mc_errors.c:742: error: undefined reference to 'vgPlain_get_SP'
mc_errors.c:753: error: undefined reference to 'vgPlain_maybe_record_error'
mc_errors.c:765: error: undefined reference to 'vgPlain_maybe_record_error'
mc_errors.c:776: error: undefined reference to 'vgPlain_maybe_record_error'
mc_errors.c:784: error: undefined reference to 'vgPlain_maybe_record_error'
mc_errors.c:843: error: undefined reference to 'vgPlain_initThreadInfo'
mc_errors.c:877: error: undefined reference to 'vgPlain_unique_error'
mc_errors.c:930: error: undefined reference to 'vgPlain_get_error_extra'
mc_errors.c:931: error: undefined reference to 'vgPlain_get_error_extra'
mc_errors.c:934: error: undefined reference to 'vgPlain_get_error_kind'
mc_errors.c:934: error: undefined reference to 'vgPlain_get_error_kind'
mc_errors.c:1081: error: undefined reference to 'vgPlain_pp_addrinfo_mc'
mc_errors.c:1099: error: undefined reference to 'vgPlain_get_error_extra'
mc_errors.c:1296: error: undefined reference to 'vgPlain_set_supp_kind'
mc_errors.c:1325: error: undefined reference to 'vgPlain_get_supp_kind'
mc_errors.c:1326: error: undefined reference to 'vgPlain_get_line'
mc_errors.c:1329: error: undefined reference to 'vgPlain_get_supp_kind'
mc_errors.c:1352: error: undefined reference to 'vgPlain_get_supp_kind'
mc_errors.c:1328: error: undefined reference to 'vgPlain_strdup'
mc_errors.c:1328: error: undefined reference to 'vgPlain_set_supp_string'
mc_errors.c:1337: error: undefined reference to 'vgPlain_set_supp_extra'
mc_errors.c:1338: error: undefined reference to 'vgPlain_get_line'
mc_errors.c:1342: error: undefined reference to 'vgPlain_isspace'
mc_errors.c:1356: error: undefined reference to 'vgPlain_get_line'
mc_errors.c:1360: error: undefined reference to 'vgPlain_strdup'
mc_errors.c:1363: error: undefined reference to 'vgPlain_strchr'
mc_errors.c:1367: error: undefined reference to 'vgPlain_strchr'
mc_errors.c:1371: error: undefined reference to 'vgPlain_set_supp_extra'
mc_errors.c:1382: error: undefined reference to 'vgPlain_get_supp_kind'
mc_errors.c:1393: error: undefined reference to 'vgPlain_get_supp_string'
mc_errors.c:1393: error: undefined reference to 'vgPlain_get_supp_string'
mc_errors.c:1442: error: undefined reference to 'vgPlain_get_supp_extra'
mc_errors.c:1426: error: undefined reference to 'vgPlain_get_supp_extra'
mc_errors.c:1521: error: undefined reference to 'vgPlain_snprintf'
mc_errors.c:1510: error: undefined reference to 'vgPlain_snprintf'
mc_errors.c:1533: error: undefined reference to 'vgPlain_get_supp_extra'
mc_errors.c:1551: error: undefined reference to 'vgPlain_get_supp_extra'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/config/arm/lib1funcs.S:1335: error: undefined reference to 'raise'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/unwind-arm-common.inc:289: error: undefined reference to 'abort'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/unwind-arm-common.inc:346: error: undefined reference to 'memcpy'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/unwind-arm-common.inc:376: error: undefined reference to 'memcpy'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/unwind-arm-common.inc:505: error: undefined reference to 'abort'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/config/arm/pr-support.c:378: error: undefined reference to 'abort'
/s/ndk-toolchain/src/build/../gcc/gcc-4.8/libgcc/config/arm/pr-support.c:384: error: undefined reference to 'abort'
collect2: error: ld returned 1 exit status
make[3]: *** [memcheck-arm-linux] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I am using following script to configure:
export NDK_HOME=$HOME/Softwares/android-ndk-r10b
export HWKIND=generic
export TOOLCHAIN=$NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/bin/arm-linux-androideabi
#export TOOLCHAIN=$NDK_HOME/toolchains/mipsel-linux-android-4.6/prebuilt/darwin-x86_64/bin/mipsel-linux-android
#export TOOLCHAIN=$NDK_HOME/toolchains/x86-4.6/prebuilt/darwin-x86_64/bin/i686-linux-android
export AR=$TOOLCHAIN-ar
export LD=$TOOLCHAIN-ld
export CC=$TOOLCHAIN-gcc
export CXX=$TOOLCHAIN-g++
#export CPP=$TOOLCHAIN-cpp
CPPFLAGS="--sysroot=$NDK_HOME/platforms/android-14/arch-arm -DANDROID_HARDWARE_$HWKIND" \
CFLAGS="--sysroot=$NDK_HOME/platforms/android-14/arch-arm" \
./configure CPP="$CPP" CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" --prefix=/data/local/Inst \
--host=armv7-unknown-linux --target=armv7-unknown-linux \
--with-tmpdir=/sdcard
Above script gives me following output:
Maximum build arch: arm
Primary build arch: arm
Secondary build arch:
Build OS: linux
Primary build target: ARM_LINUX
Secondary build target:
Platform variant: android
Primary -DVGPV string: -DVGPV_arm_linux_android=1
Default supp files: exp-sgcheck.supp xfree-3.supp xfree-4.supp bionic.supp

Compile Open SSL Dependent C Program with GCC

I have to compile a C program on linux(ubuntu) with gcc. Which is dependent to openssl libraries.
#include <openssl/crypto.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/bio.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/err.h>
I've downloaded libcrypto and libopenssl package from repository. But still I'm getting this error
root#kali:~/openssl# gcc opensslhello.c
/tmp/ccTahV7g.o: In function `pem2X509':
opensslhello.c:(.text+0x15): undefined reference to `BIO_s_mem'
opensslhello.c:(.text+0x1d): undefined reference to `BIO_new'
opensslhello.c:(.text+0x4e): undefined reference to `BIO_write'
opensslhello.c:(.text+0x71): undefined reference to `PEM_read_bio_X509'
opensslhello.c:(.text+0x7f): undefined reference to `BIO_free'
/tmp/ccTahV7g.o: In function `sendHelloFunction':
opensslhello.c:(.text+0xb9): undefined reference to `X509_STORE_new'
opensslhello.c:(.text+0xe2): undefined reference to `X509_STORE_add_cert'
opensslhello.c:(.text+0x106): undefined reference to `X509_STORE_add_cert'
opensslhello.c:(.text+0x113): undefined reference to `sk_new_null'
opensslhello.c:(.text+0x13c): undefined reference to `sk_push'
opensslhello.c:(.text+0x160): undefined reference to `sk_push'
opensslhello.c:(.text+0x187): undefined reference to `X509_STORE_CTX_new'
opensslhello.c:(.text+0x1b0): undefined reference to `X509_STORE_CTX_init'
opensslhello.c:(.text+0x1bf): undefined reference to `X509_verify_cert'
opensslhello.c:(.text+0x1d3): undefined reference to `X509_STORE_CTX_get_error'
opensslhello.c:(.text+0x1e3): undefined reference to `X509_STORE_CTX_get_error'
opensslhello.c:(.text+0x215): undefined reference to `X509_STORE_CTX_free'
opensslhello.c:(.text+0x220): undefined reference to `X509_free'
opensslhello.c:(.text+0x22b): undefined reference to `BIO_free'
opensslhello.c:(.text+0x233): undefined reference to `X509_free'
opensslhello.c:(.text+0x23e): undefined reference to `sk_pop_free'
opensslhello.c:(.text+0x249): undefined reference to `X509_STORE_free'
/tmp/ccTahV7g.o: In function `main':
opensslhello.c:(.text+0x291): undefined reference to `EVP_cleanup'
opensslhello.c:(.text+0x29d): undefined reference to `ERR_remove_state'
opensslhello.c:(.text+0x2a2): undefined reference to `ERR_free_strings'
collect2: error: ld returned 1 exit status
root#kali:~/openssl#
Can anyone please tell me what I should do to, get rid of this error.?
Thanks,
You haven't linked the crypto and openssl libraries:
gcc opensslhello.c -lssl -lcrypto

Resources