billmccord / OpenCV-Android

A project for porting and optimizing OpenCV for Google's Android OS
http://billmccord.github.com/OpenCV-Android/
444 stars 162 forks source link

Unable to build on Windows #18

Open akulapid opened 13 years ago

akulapid commented 13 years ago

I'm trying to build this on Windows using cygwin with ndk r5 and sdk 2.1/2.2. I have OpenCV 2.2 installed and in PATH as well. I get the following error.

StaticLibrary  : libcvhighgui.a
SharedLibrary  : libopencv.so
E:/dev/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld.exe: cannot find - lcxcore
collect2: ld returned 1 exit status
make: *** [/cygdrive/e/code/droid/billmcord/first-push/OpenCV-Android/obj/local/armeabi/libopencv.so] Error 1
billmccord commented 13 years ago

Having OpenCV 2.2. installed and in PATH is irrelevant. We use OpenCV 1.1 pre for this project and the source is already included and built when you build. Someone else has also reported the same problem you are running into, but unfortunately I don't have a Windows machine to debug this. The other person eventually gave up and used Linux to build. If that isn't an option for you, then I would appreciate your help investigating. Here are the instructions I gave to the other person:

Everything built except for the opencv module which requires linking to all of the other libraries. The only thing I can guess is that one of two things is happening:

* On your machine TARGET_OUT is not pointing to [ROOT OF OPENCV PRJ]/obj/local/armeabi
      o You might try hard-coding the path in there and removing -L$(TARGET_OUT).  See if that works.  If it doesn't then the other problem might be...
* ld.exe isn't respecting that -lcxcore is a reference to libcxcore.a
      o You might try reading the documentation for ld.exe and see if there are some rules that are different about the Windows implementation from the Linux / Mac implementation.

Let me know if you make any progress as I would like to warn others.

brnhffmnn commented 13 years ago

I struggled with this for way to long now and finally it worked. Setting the search path with -L to an absolute path instead of TARGET_OUT helped.

LOCAL_LDLIBS := -L $(SYSROOT)/usr/lib -l dl -l log \
        -L "D:\OpenCV-Android\obj\local\armeabi" \
        -l cxcore -l cv -l cvaux -l cvml -l cvhighgui
Xirus commented 13 years ago

Hello I had the same problem and this solution helped me out... I just wonder if is there a neater way to do it... thanks

billmccord commented 13 years ago

Xirus,

I'm stuck on Android 1.6 platform because the project I am working on requires it for now. You might want to look at the official OpenCV project by Willow Garage if you are able to use newer versions of Android. http://opencv.willowgarage.com/wiki/Android

Xirus commented 13 years ago

Thanks - I will have a look. Another problem: I am trying the open the OpenCVSample project with eclipse. I just started with Android so perhaps I am doing something wrong. Thanks Jay

-----Original Message----- From: billmccord [mailto:reply@reply.github.com] Sent: Sunday, August 07, 2011 1:49 AM To: gdsadan@gmail.com Subject: Re: [OpenCV-Android] Unable to build on Windows (#18)

Xirus,

I'm stuck on Android 1.6 platform because the project I am working on requires it for now. You might want to look at the official OpenCV project by Willow Garage if you are able to use newer versions of Android. http://opencv.willowgarage.com/wiki/Android

Reply to this email directly or view it on GitHub: https://github.com/billmccord/OpenCV-Android/issues/18#issuecomment-1747546

billmccord commented 13 years ago

You haven't described the problem you are seeing? You are trying to open the OpenCVSample and ... what?