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].
Related
So I've installed gpp-compiler extension for Atom, I've put glut.h into my MinGW\include\GL directory as well as I've put libglu32.a file into my MinGW\lib directory and also I didn't forget to put glut32.dll,glu32.dll into C:\Windows\System32 and I've also put glu32.dll into C:\Windows\SysWOW64.
This is the compiler configuration I've got:
settings
And that's the compiling error I'm getting:
b:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lglut32
collect2.exe: error: ld returned 1 exit status
Looking forward to your answers :)
The linker is not able to find the library glut32.a.
You need to add the folder via
-L<folder containing glut32.a>
to your C++ compiler command line options, where you already declared the libs which shall be linked to your application.
I am getting the following error when trying to use
#include <vtkViewNode.h>
in my code. I didn't do anything else besides this. I am getting the following error message:
.../VTK-8.0.1/Rendering/SceneGraph/vtkViewNode.h:29:62: fatal error:vtkRenderingSceneGraphModule.h: No such file or directory
compilation terminated.
Everything else i tried so far is working like cylinders or parametric splines. I might be mistaken but if i try searching for "RenderingSceneGraph" on fossies.org there's no match. So to me it seems like it's not part of the VTK 8.0.1 in the first place.
It's needed for several classes according to their documentation. It's strange though since you can't access any information about it.
Any ideas?
Somebody had basically the same problem just the other day: Error C1083 Cannot open include file: 'vtkGUISupportQtOpenGLModule.h': No such file or directory
vtk****Module.h are files generated by CMake when you are configuring the project, that's why you can't find them in a file search of the source code. You have to enable them explicitly, they are among the "advanced" items in the CMake configuration list, then they will be created as you do CMake -> Generate.
It's not clear to me from your comments above whether you are building VTK on your own or if you are using some kind of precompiled package, but in the latter case, I am affraid your package might not be compiled with the vtkRenderingSceneGraph Module and you will have to compile it on your own. Luckily it's not a big problem, you can get some pointers here https://www.vtk.org/Wiki/VTK/Configure_and_Build but in general it's pretty smooth when you use CMake.
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.
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
I'm trying to use some of the functions that are in the /lib/libproc-3.2.6.so library in my Ubuntu distribution.
I have downloaded and installed the header files and they are defined in my source files.
Currently, this is all I'm trying to do, just for starters...
proc_t **read_proc = readproctab(0);
But I get the following compiler error:
/tmp/cclqMImG.o: In function `Sysmon::initialise_sysmon()':
sysmon.cpp:(.text+0x494): undefined reference to `readproctab'
collect2: ld returned 1 exit status
I'm aware I'm probably doing some wrong with the command I'm using to compile it, but due to lack of experience I'm not sure what I'm doing wrong. This is the g++ command I'm using to compile my cpp file:
g++ -o sysmon.o sysmon.cpp `pkg-config --libs --cflags gtk+-2.0`
Can someone please give me some pointers as to where I'm going wrong.
You are not linking your executable against libproc (that is a linker error message).
Try adding -lproc to the linker command.
You are not actually linking against the library that you wish to use, you are merely including its header files, therefor, the compiler will complain about undefined references.
You can read up on linking against shared libraries here.
A small suggestion, start using the build tool SCons, it can take care of linking to libraries for you, just add the ones you wish to use in the SConstruct file required by SCons and then you don't have to mess about with compiler specifics. You also gain lots of other good stuff that SCons provide. It's highly recommended.
Ubuntu 17.04
You probably want to use -lprocps instead of -lproc.