Can not find -lann and -lcvm - g++

I can't figure it out this problem while compiling from qmake /usr/bin/ld: cannot find -lann
/usr/bin/ld: cannot find -lcvm
I have been through a lot of similar questions but still no luck.
I don't have .so library instead got /home/dhiren/ann_1.1.2/include/ANN/ANN.h and
libGeneralUtils/cvmlib/include/cvm.h
Thank you.

Related

Why am I getting this particular Mach-O linker problem?

I’ve looked at all the Mach-0 Linker questions on SO but can’t find any that seem specific to my problem. My app was compiling without issues for weeks in the debugger and this seemed to come out of the blue. Problem seems to be pointing to two source files (keypad.o and setoutput.o). Previous Mach-O errors have usually told me that so-and-so can’t be referenced from ‘some file’.o, but no such easy clues in this case. Error shown below:
ld "/Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Products/Debug/MacOS Cover.app/Contents/MacOS/MacOS Cover" normal x86_64
cd "/Users/Administrator/Desktop/MacOS Cover"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/clang -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Products/Debug -F/Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Products/Debug -filelist "/Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Intermediates/MacOS Cover.build/Debug/MacOS Cover.build/Objects-normal/x86_64/MacOS Cover.LinkFileList" -mmacosx-version-min=10.6 -framework Cocoa -o "/Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Products/Debug/MacOS Cover.app/Contents/MacOS/MacOS Cover"
ld: duplicate symbol _required in /Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Intermediates/MacOS Cover.build/Debug/MacOS Cover.build/Objects-normal/x86_64/keypad.o and /Users/Administrator/Library/Developer/Xcode/DerivedData/MacOS_Cover-aemdqkcjvuomtjfhkycsyowsgisn/Build/Intermediates/MacOS Cover.build/Debug/MacOS Cover.build/Objects-normal/x86_64/setoutput.o for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Command /Developer/usr/bin/clang failed with exit code 1
I’ve tried throwing away all the derived data files etc (which seem to spring right back a second later). I’d appreciate if anyone could help me resolve this please.
Those two object files are each exporting a symbol with the same name (required; the underscore is an artifact of the compiler). Depending on exactly what you intend for those two, you might need to: a) rename one or both; or b) make one or both have internal linkage, usually by marking them static.
There's a good chance you think there's just one such symbol because you declared it in a header that both source files include. But, you may have unintentionally defined the symbol in the header, rather than just declaring it. Then, it's defined in every source file that includes it. You would have to show your source code with the declaration/definition of required and how it's brought into each source file.

CMAKE - find_library find_path find_file all not working

So I have a library here /path/to/CMSIS/libarm_cortexM4lf_math.a
I can't seem to find it using find_library with Cmake. Further more I can't find a simple text file with find_file or find_path.
I've tried the following (and many iterations thereof):
find_library(CMSIS_LIB libarm_cortexM4lf_math.a PATHS /path/to/CMSIS)
So then I thought I'd do something more simple and saved a file to /home/user/happy.txt and tried to
find_path(TEST_FILE happy.txt /home/user)
In all cases my variables are NOTFOUND.
I've read the cmake documentation for find_library, most of find_path, and skimmed find_file. They all seem to work the same way and I can't get any of them to work.
What am I missing here?

How do I link PCL library properly for use within an objective-C app compiled in Xcode?

Question: How do I use PCL in the context of an Objective-C Cocoa (OSX, not iOS) app?
Tearing my hair out over this one.I can't get libpcl to link properly with my Objective C project in Xcode. I have checked and re-checked everything I can possibly think of. Probably doing something dumb, but I'm stumped.
Actual error is linker:
Undefined symbols for architecture x86_64:
"pcl::PassThrough<pcl::PointXYZ>::applyFilterIndices(std::__1::vector<int, std::__1::allocator<int> >&)", referenced from:
pcl::PassThrough<pcl::PointXYZ>::applyFilter(std::__1::vector<int, std::__1::allocator<int> >&) in PCLProcess.o
ld: symbol(s) not found for architecture x86_64
The code I'm trying to compile is the standard tutorial code available here:
http://pointclouds.org/documentation/tutorials/passthrough.php#passthrough
I CAN get it to work without Xcode (using Cmake and command line compiling exactly as in the tutorial)
I CAN create a "command line" project and compile and link a one-off CPP file using Xcode
The issue is the same no matter what version of PCL I've tried. Macports, binary distro, self-compiled 1.6 and trunk. All the same result.
I've tried several different machines, OSX 10.7 and 10.8, same issue on both.
I've even run nm against the dylib to verify the missing symbols are in the library I'm linking (filters in this case)
Any thoughts much appreciated, I've lost half a week to this.
See this screenshot for a detailed error message.
Here is the code in question:
//PCLProcess.h
#import <Foundation/Foundation.h>
#interface PCLProcess : NSObject
#end
//PCLProcess.mm
#import "PCLProcess.h"
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>
#implementation PCLProcess
-(void)tryThis{
// Code cut and pasted from tutoral (see link above)
}
#end
Update
Here is one more clue. I am in over my head with respect to compilers/linkers and how they work, but now I think I know what is happening but not why (or how to fix it).
I ran the linker tool manually, and out of desperation I started plugging in obsolete flags just to see what the results were. The previous error (above) identifies the missing symbols as ""pcl::PassThrough::applyFilterIndices(std::__1::vector >&)" but ld -y gave me this:
ld: warning: option -y is obsolete and being ignored
Undefined symbols for architecture x86_64:"__ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndicesERNSt3__16vectorIiNS3_9allocatorIiEEEE", referenced from:__ZN3pcl11PassThroughINS_8PointXYZEE11applyFilterERNSt3__16vectorIiNS3_9allocatorIiEEEE in PCLProcess.o
ld: symbol(s) not found for architecture x86_64
So then I went looking for that symbol and, sure enough, it's missing (or different):
nm /opt/local/lib/libpcl_filters.dylib | grep __ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndices
00000000000a0fa0
T __ZN3pcl11PassThroughINS_8PointXYZEE18applyFilterIndicesERSt6vectorIiSaIiEE
I suspect name mangling? But again, I'm not really sure what I'm talking about at this point or (more importantly) how to fix it.
Short answer:
Two Build settings under "Build Options":
C++ Language Dialect: GNU++98[-std=gnu++98]
C++ Standard Library: libstdc++ (GNU C++ standard library)
This second setting (C++ Standard Library) is the crucial one; Using libc++ will produce the "undefined symbols" linker errors shown in the question above.
Details for anyone trying this:
This works with Xcode 4.62, llvm4.2, libpcl 1.7 (currently dev, I compiled from trunk) and boost 1.53. Along the way I ran into a known issue with Boost and Cocoa involving the use of nil (see this link:https://svn.boost.org/trac/boost/ticket/5010) and also some strangeness with boost traits (see this:c++: Boost 1.48 type traits and Cocoa inclusion weirdness) Consequently I ended up including PCL headers as follows:
#define nil Boost_nil
#define Nil Boost_Nil
#ifdef check
#undef check
#endif
#include <pcl/pcl_base.h>
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>
#undef Nil
#undef nil

error using wxWidgets libraries for arm cross-compilation using codelite in linux

I have added the cross compiler arm-linux-gnueabi into codelite and successfully cross-compiled a sample C program.
Now I'm trying to cross-compile a wxwidget sample program.
Initially it was throwing me errors in setup.h.
I created a link for /usr/lib/wx/include/gtk2-unicode-release-2.8/wx/setup.h with /usr/include/wx/setup.h. Now its giving me around 159 errors. I give you some of them for your reference.
/usr/include/wx/defs.h:42:13: error: #error "No Target! You should use wx-config program for compilation flags!"
In file included from /usr/include/wx/cursor.h:24:0,
from /usr/include/wx/event.h:22,
from /usr/include/wx/wx.h:25,
from main.cpp:14:
/usr/include/wx/gtk/cursor.h:40:5: error: ‘GdkCursor’ does not name a type
In file included from /usr/include/wx/app.h:570:0,
from /usr/include/wx/wx.h:26,
from main.cpp:14:
/usr/include/wx/gtk/app.h:55:5: error: ‘guint’ does not name a type
/usr/include/wx/gtk/app.h:65:5: error: ‘GdkVisual’ does not name a type
When I add wx-config --libs wx-config --cxxflags to my build command it gives me in compatible library errors..
These are the erros I'm stuck on with..
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_richtext-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_aui-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_xrc-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_qa-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_html-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_adv-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_gtk2u_core-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_baseu_xml-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_baseu_net-2.8
/usr/lib/gcc/arm-linux-gnueabi/4.6/../../../../arm-linux-gnueabi/bin/ld: cannot find -lwx_baseu-2.8
collect2: ld returned 1 exit status
I think I'm doing something wrong in linking libraries for cross compiler. Can anyone help me on this.. I would appreciate any help..
-Thanks in advance
It looks like you didn't cross-compile wxWidgets itself. Or didn't install it if you did.
The thing to keep in mind is that you absolutely shouldn't need to manually create any links. In particular, the one you already made for wx/setup.h will almost certainly break your other builds, don't do this. Just use the correct wx-config for the cross-build.

Trying to find a shared library using CMake

I'm trying to find the avformat library for my project using CMake. My first option was to use a FIND_PACKAGE(...) but I couldn't find any CMake Module for it in $CMAKE_ROOT/Modules. Now I'm trying to find it using FIND_LIBRARY(...).
The library is in /usr/lib/libavformat.so.52.
This is my CMake code for finding it:
find_library(AVFORMAT_LIBRARY avformat PATHS /usr/lib DOC "avformat library")
if(NOT AVFORMAT_LIBRARY)
message(FATAL_ERROR "Library avformat required, but not found!")
endif(NOT AVFORMAT_LIBRARY)
However, I can't find it. Why do you think that is?
I could type the specific library name (i.e. libavformat.so.52), but that would tie the code to that specific version, which I wouldn't want.
EDIT: I just tried typing the exact library name libavformat.so.52 and that didn't work either. :S
What are your suggestions?
Thank you.
So I found what the problem was.
If you do a search for 'avformat' in aptitude/synaptic you get a couple results but no libavformat-dev. So I thought there was none! However, if you search for 'libavformat' then the library appears! I swear I thought that aptitude/synaptic did a regular expression search, not just for the beginning. -.-
Now it all works! :D