I am trying to build a library file of g729 codec.i have source of this codec and trying to build using Android NDK.Almost all object files are built but at last i am getting this error.
But i am stuck with this error. can anyone explain the meaning of this error and what should i do to solve this?
./obj/local/armeabi-v7a/objs/g729_jni/g729/cod_ld8a.o: In function `Coder_ld8a':
/root/g729/jni/g729/cod_ld8a.c:267: undefined reference to `Pitch_ol_fast'
/root/g729/jni/g729/cod_ld8a.c:325: undefined reference to `Pitch_fr3_fast'
/root/g729/jni/g729/cod_ld8a.c:328: undefined reference to `Enc_lag3'
/root/g729/jni/g729/cod_ld8a.c:344: undefined reference to `G_pitch'
collect2: ld returned 1 exit status
Thanks
Edit
I have solved this error but is it feasible?
I have added this line in Android.mk
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
If you are compiling the sources and you want to link the resulting library you can use one of the following variables in your Android.mk file
LOCAL_STATIC_LIBRARIES:
The list of static libraries modules (built with BUILD_STATIC_LIBRARY)
that should be linked to this module. This only makes sense in
shared library modules.
LOCAL_SHARED_LIBRARIES:
The list of shared libraries modules this module depends on at runtime.
This is necessary at link time and to embed the corresponding information
in the generated file.
For more details have a look at the android NDK documentation that you can find in the ndk folder.
Otherwise if you have to link a prebuilt library there is a section in the Android NDK documentation that tells you how to achieve the result. An on-line version of these documents is also here(PREBUILTS).
UPDATE 09/01/2017
Documentation about Prebuilt libraries can be found here
Related
I'm studying Stroustrup Programming principles and practice and have a problem with using FLTK library with netbeans
What I've done:
downloaded library
In netbeans: New project with existing sources (used path where I saved this lib), compiled it without errors.
In my test project: Properties->C compiler->Include directories added path to library, the same for C++ compiler
Properties->Linker->Additional Library Directories added path to .a files
Libraries->Add Library added all 7 libraries from fltk/lib/*.a
Now when I try to compile my project I get a pile of errors like that:
../../../workspace/Study/fltk-1.3.4-2/lib/libfltk.a(screen_xywh.o): In function `screen_cb':
c:...\fltk-1.3.4-2\src/screen_xywh.cxx:72: undefined reference to `CreateDCA#16'
c:...\fltk-1.3.4-2\src/screen_xywh.cxx:74: undefined reference to `GetDeviceCaps#8'
c:...\fltk-1.3.4-2\src/screen_xywh.cxx:75: undefined reference to `GetDeviceCaps#8'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/studystr.exe] Error 1
I have no idea how to fix that(((
I've found solution to this problem: adding './fltk-config --compile' to Linker additional options in project's properties helped.
Also this article was usefull: http://www.fltk.org/articles.php?L598+I140+T+P1+Q
I'm trying to use the GetDIBits function with C++ (with QtCreator) on Windows. The code compiles but can not link with the error
undefined reference to _imp__GetDIBits#28
I tried to link add
LIBS = C:/MinGW/lib/libws2_32.a
to my .pro file but nothing changed.
is it the correct library or another one ? Thank you
Link with Gdi32.lib.
In general, to figure out which library to link with, look up the API on msdn.microsoft.com and then scroll to the bottom of the page for the headers and lib requirements.
Example here
I am trying to link some propetary code on eLux 5 (works on eLux 4) a special Linux distribution.
The command line is very long and contains: -ludev -lpenDriverApi (both dynamic libraries, penDriverApi ist the propetary code which depends on udev).
Now the linker tolds me that various references are undefined from udev like 'udev_monitor_unref'. With "nm" I verified that these references are available within the udev shared object - so this error messages are really strange to me.
Because I also tried various verbose/debug settings for the linker I am now at a point without having a clou how to find out what went wrong during linking of my cmake project.
Hopefully this picture is readable, because the damned vmware would allow copy/paste which is enabled (maybe the elux config is bad).
udev Version on eLux 4 is 0.6.1
udev Version in eLux 5 is 1.3.5
The solution to this problem was, that the third party shared library libpenDriverApi.so required recompilation with a libudev.so.1 as well as a change to the linker, so that ldd -r also shows the dependency to libudev.
In the linkage sequence any object file or library that requires symbol
definitions must appear before the library that provides the definitions,
or undefined reference errors will ensure. This is because the
linker by default will search a library only to find definitions of
symbols that it has observed are referenced, but not defined, in earlier
files.
So if libpenDriverApi depends on libudev then you have to link in the order:
-lpenDriverApi -ludev
Sometimes when compiling the errors output the name of a header file that is missing, and the package it comes from can be tracked down using the Linux package manager.
But how to find the missing dependency when the error is of the sort below, where it doesn't give you the name of the missing header file?
make[2]: *** [examples/undocumented/libshogun/base_map_parameters] Error 1
CMakeFiles/Makefile2:916: recipe for target 'examples/undocumented/libshogun/CMakeFiles/base_map_parameters.dir/all' failed
make[1]: *** [examples/undocumented/libshogun/CMakeFiles/base_map_parameters.dir/all] Error 2
../../../src/shogun/libshogun.so.17.1: undefined reference to `SZ_BufftoBuffDecompress'
../../../src/shogun/libshogun.so.17.1: undefined reference to `SZ_encoder_enabled'
../../../src/shogun/libshogun.so.17.1: undefined reference to `SZ_BufftoBuffCompress'
collect2: error: ld returned 1 exit status
examples/undocumented/libshogun/CMakeFiles/base_migration_dropping_and_new.dir/build.make:129: recipe for target 'examples/undocumented/libshogun/base_migration_dropping_and_new' failed
The header file example you present is a compile time error. The compiler knows about the files and can present you with what is missing. The error you are presenting above is a link time error.
The one you present is a common one and it is that a symbol is not defined. Usually this happens because a library was excluded from the linker line. Another common source of this error is that the library you are linking to is older than the one expected for the program.
Usually I find myself trolling Google for articles like this one when presented with such errors. The packaging manager does not track function level details when accounting for files or libraries. I always thought it would be nice enhancement to inspect libraries with the nm command and put that meta data into packaging systems.
(This is not a generic answer, but) In this case, googling SZ_BufftoBuffDecompress gave, among others, the link to https://github.com/PacificBiosciences/blasr/issues/4, where it is suggested
It seems that the hdf5 library is not correctly installed. The hdf5 lib that you used requires szip library. So you may need to install szip lib first and then re-make your hdf5 package (linking it with the szip lib, -lsz).
So it seems as though the missing dependency is szip.
As for general searching, #Thomas Padron-McCarthy's comment sensibly advises to
perhaps add the program name
and
on Ubuntu I might also add apt-get and install, to directly find instructions on how to install the missing parts!
If you only need the software, and do not feel the need to compile it yourself, have a look at the github post. Another poster
suggest[s] using Homebrew and Linuxbrew to install science software on Mac and Linux, repsectively[sic].
I'm using CodeBlocks (the latest version, I'm not sure what that is at the moment)
I'm trying to use fallahn's SFML Tiled map loader, and so far I've successfully statically linked SFML and included the map loader files in my source as well as added it to my search directories, however, I'm having trouble linking zlib (which the map loader uses)
I'm gonna go ahead and walk you through how I linked zlib because I'm not even sure which step I messed up on:
obviously, I went on over to http://zlib.net and grabbed the latest version (1.2.8)
I unzipped it to my desktop
I went into my project's build options and initially i thought "I'll just globally set up my search directories like before" (for SFML and the map loader, there was an 'include' and 'lib' folder, i put 'include' in the compiler search directory, and 'lib' in the linker search directory), except there were no folders named 'include' or 'lib' in the folder that i got from unzipping. This is where I simply included the whole folder I unzipped (I'm pretty sure that's terrible practice but I wasn't sure what else to do)
I compiled an example from the Map loader's source files, and got an error along the lines of 'undefined reference to inflate' on 4 different occasions. I already figured at this point that I made an error while linking, so that's when I took to google. Most answers were simply "add -lz" or "link libz"
Well, I don't know what "add -lz" means.. like at all, so I just linked "libz", then my compiler gave me the error "ld.exe cannot find -lz", which led me to the assumption that linking libz and adding -lz are the same thing.
Here are some things I don't understand at all, and if you can't explain what they are, please at least explain how to blindly do it:
1. Compiling a library
2. Anything to do with make files, I don't know what they are or what they do at all
3. Adding commands to the project command-line.
Build messages:
C:/Documents and Settings/Brenda/Desktop/sfml-tmxloader-master/src/MapLoaderPrivate.cpp:834: undefined reference to inflateInit2_'
C:/Documents and Settings/Brenda/Desktop/sfml-tmxloader-master/src/MapLoaderPrivate.cpp:843: undefined reference toinflate'
C:/Documents and Settings/Brenda/Desktop/sfml-tmxloader-master/src/MapLoaderPrivate.cpp:852: undefined reference to inflateEnd'
C:/Documents and Settings/Brenda/Desktop/sfml-tmxloader-master/src/MapLoaderPrivate.cpp:881: undefined reference toinflateEnd'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 10 seconds)
4 errors, 0 warnings (0 minutes, 10 seconds)
The issue is, that zlib doesn't provide binaries for MinGW directly, they only provide *.lib, *.def and *.dll files, but in order to link with MinGW/GCC, you'll need an *.a file.
Since zlib is a C library the ABI will be identical and thus you can "simply" convert it, for instance with the help of lib2a. While this should work, it might still be better to download the source code and build zlib yourself, since it ships with a CMake file, it's rather easy to build.