Message from discussion
ndk-r8b cannot link to libjpeg
Received: by 10.224.219.144 with SMTP id hu16mr6758333qab.1.1352510370314;
Fri, 09 Nov 2012 17:19:30 -0800 (PST)
X-BeenThere: android-ndk@googlegroups.com
Received: by 10.224.200.69 with SMTP id ev5ls9307884qab.4.gmail; Fri, 09 Nov
2012 17:19:12 -0800 (PST)
Received: by 10.224.205.65 with SMTP id fp1mr6749818qab.4.1352510352533;
Fri, 09 Nov 2012 17:19:12 -0800 (PST)
Received: by 10.224.16.202 with SMTP id p10msqaa;
Wed, 7 Nov 2012 17:45:16 -0800 (PST)
Received: by 10.224.105.205 with SMTP id u13mr4545687qao.6.1352339116212;
Wed, 07 Nov 2012 17:45:16 -0800 (PST)
Received: by 10.224.105.205 with SMTP id u13mr4545685qao.6.1352339116193;
Wed, 07 Nov 2012 17:45:16 -0800 (PST)
Return-Path: <xumo...@gmail.com>
Received: from mail-qa0-f52.google.com (mail-qa0-f52.google.com [209.85.216.52])
by gmr-mx.google.com with ESMTPS id eb7si2069700qcb.3.2012.11.07.17.45.16
(version=TLSv1/SSLv3 cipher=OTHER);
Wed, 07 Nov 2012 17:45:16 -0800 (PST)
Received-SPF: pass (google.com: domain of xumo...@gmail.com designates 209.85.216.52 as permitted sender) client-ip=209.85.216.52;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of xumo...@gmail.com designates 209.85.216.52 as permitted sender) smtp.mail=xumo...@gmail.com; dkim=pass header...@gmail.com
Received: by mail-qa0-f52.google.com with SMTP id g14so1670707qab.11
for <android-ndk@googlegroups.com>; Wed, 07 Nov 2012 17:45:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=rC2MXpvZlmKDaRUW7gOO3f4cJ22XY4RHAx1M0LqU/p8=;
b=PafwjLA5uybZhGb9ngld+d5ui7KVnhER+otE4V98YIapEbINEi/pWgTFxexwJwUece
ZEjnVu1oa8xteeYuQSI4bTerI7LiJVvMUbRHx9QZaYgLmVAJ3hXz9UqqJgUqxB9mZQPP
dY0vTj0hD14PgNGoDTEPaaDi61ja1dSw4DcZo51iyK8rx3FPOH8wh4GfFBpQMZHGGYEz
DVDw+GAwq1Lc6S/xjKE9+EbU7kTpJFG/ax/n3UKfjs7TuNbrH8aF8W1UKITDPTDrSMaA
deFzz5Qu7n4ZAHIh+JaMTz300P3phaT2qokC6OKVDEB0s9u3wAHSh7QYCLSrBUy7uvv3
vc9A==
MIME-Version: 1.0
Received: by 10.224.194.134 with SMTP id dy6mr9841385qab.81.1352339116052;
Wed, 07 Nov 2012 17:45:16 -0800 (PST)
Received: by 10.49.109.101 with HTTP; Wed, 7 Nov 2012 17:45:15 -0800 (PST)
In-Reply-To: <cc6a14ce-adfd-4bc5-982f-4bd207e40892@googlegroups.com>
References: <509A9BB8.7080...@free.fr>
<cc6a14ce-adfd-4bc5-982f-4bd207e40892@googlegroups.com>
Date: Thu, 8 Nov 2012 09:45:15 +0800
Message-ID: <CANdRWkFyPkgEkAfAkTqvLOHB-VW5nKriod-Cu4bb1-M75Uu...@mail.gmail.com>
Subject: Re: ndk-r8b cannot link to libjpeg
From: Marcus Moran <xumo...@gmail.com>
To: android-ndk@googlegroups.com
Content-Type: multipart/alternative; boundary=20cf300fb271a0d1a604cdf1fc79
--20cf300fb271a0d1a604cdf1fc79
Content-Type: text/plain; charset=ISO-8859-1
You may want to take a look of the linaro project.
http://www.linaro.org/linux-on-arm/meet-the-team/tom-gall/
Tom can probably give you valuable help.
On Thu, Nov 8, 2012 at 2:23 AM, Onur Cinar <onur.ci...@gmail.com> wrote:
> Hi Fabien,
>
> In your Image.cpp, wrap the jpeglib.h include line with extern "C" like
> this:
>
> *extern "C" {
> *
> #include <jpeglib.h>
> *}
> *
>
> Give it a try, and possibly it should work fine now.
>
> If it works, the problem is actually in the jpeglib.h header file:
>
> * 30 #ifndef ANDROID*
> 31 #ifdef __cplusplus
> 32 #ifndef DONT_USE_EXTERN_C
> 33 extern "C" {
> 34 #endif
> 35 #endif
> 36 #endif
>
> I don't know why they did it this way. When you compile using NDK, this
> block never gets enabled, so the library won't link properly under C++ code.
>
> Best regards,
>
> -onur
>
>
> On Wednesday, November 7, 2012 9:35:10 AM UTC-8, Fabien R wrote:
>>
>> Hello,
>>
>> I'm trying to compile a JNI project using libjpeg-turbo.
>>
>> I successfully build the library thanks to this link
>> http://stackoverflow.com/**questions/12260149/libjpeg-**turbo-for-android<http://stackoverflow.com/questions/12260149/libjpeg-turbo-for-android>
>>
>> But my project can not compile on eclipse:
>>
>> /home/fabien/android/android-**ndk-r8b/ndk-build all
>> Compile++ thumb : effectsjni <= effectsjni.cpp
>> In file included from
>> jni/com_fabien_r_**testyourwebcam_opengl2_jni_**OpenGL2JniInterface.h:2:0,
>>
>> from jni/effectsjni.cpp:6:
>> /home/fabien/android/android-**ndk-r8b/platforms/android-14/**
>> arch-arm/usr/include/jni.h:**592:13:
>> note: the mangling of 'va_list' has changed in GCC 4.4
>> Compile++ thumb : effectsjni <= glutil.cpp
>> Compile++ thumb : effectsjni <= Image.cpp
>> Prebuilt : libstlport_static.a <=
>> <NDK>/sources/cxx-stl/stlport/**libs/armeabi/
>> Prebuilt : libjpeg.so <= jni/
>> SharedLibrary : libeffectsjni.so
>> ./obj/local/armeabi/objs/**effectsjni/gltools/Image.o: In function
>> `Image::savePicture()':
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:291:
>> undefined reference to `jpeg_std_error(jpeg_error_**mgr*)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:292:
>> undefined reference to `jpeg_CreateCompress(jpeg_**compress_struct*,
>> int,
>> unsigned int)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:293:
>> undefined reference to `jpeg_stdio_dest(jpeg_**compress_struct*,
>> __sFILE*)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:294:
>> undefined reference to `jpeg_set_defaults(jpeg_**compress_struct*)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:301:
>> undefined reference to `jpeg_set_quality(jpeg_**compress_struct*, int,
>> int)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:302:
>> undefined reference to `jpeg_start_compress(jpeg_**compress_struct*,
>> int)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:310:
>> undefined reference to `jpeg_write_scanlines(jpeg_**compress_struct*,
>> unsigned char**, unsigned int)'
>> /home/fabien/workspace/**TestYourWebcam/jni/gltools/**Image.cpp:313:
>> undefined reference to `jpeg_finish_compress(jpeg_**compress_struct*)'
>> collect2: ld returned 1 exit status
>> make: *** [obj/local/armeabi/**libeffectsjni.so] Error 1
>>
>> **** Build Finished ****
>>
>> I tried to link the static and the shared library using this Android.mk
>> file without success:
>> LOCAL_PATH := $(call my-dir)
>>
>> # JPEG support
>> include $(CLEAR_VARS)
>> LOCAL_MODULE := jpeg
>> #LOCAL_SRC_FILES := libjpeg.a
>> LOCAL_SRC_FILES := libjpeg.so
>> LOCAL_EXPORT_C_INCLUDES :=
>> /home/fabien/android/android-**sdk-linux/sources/external/**libjpeg-turbo
>>
>> #include $(PREBUILT_STATIC_LIBRARY)
>> include $(PREBUILT_SHARED_LIBRARY)
>>
>> include $(CLEAR_VARS)
>> LOCAL_MODULE := effectsjni
>> ### Add all source file names to be included in lib separated by a
>> whitespace
>> LOCAL_SRC_FILES := effectsjni.cpp gltools/glutil.cpp gltools/Image.cpp
>> #LOCAL_CFLAGS := -Werror
>> LOCAL_LDLIBS := -llog -lGLESv2
>> # Missing includes
>> LOCAL_C_INCLUDES += /home/fabien/android/spica/**sources/glm
>> # Link to JPEG
>> #LOCAL_STATIC_LIBRARIES := jpeg
>> LOCAL_SHARED_LIBRARIES := jpeg
>> include $(BUILD_SHARED_LIBRARY)
>>
>> Any hints ?
>>
>> -
>> Fabien
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "android-ndk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/android-ndk/-/fkK1I9CVkIcJ.
>
> To post to this group, send email to android-ndk@googlegroups.com.
> To unsubscribe from this group, send email to
> android-ndk+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/android-ndk?hl=en.
>
--20cf300fb271a0d1a604cdf1fc79
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
You may want to take a look of the linaro project.=A0<a href=3D"http://www.=
linaro.org/linux-on-arm/meet-the-team/tom-gall/">http://www.linaro.org/linu=
x-on-arm/meet-the-team/tom-gall/</a><div>Tom can probably give you valuable=
help.<br>
<div>=A0<br><br><div class=3D"gmail_quote">On Thu, Nov 8, 2012 at 2:23 AM, =
Onur Cinar <span dir=3D"ltr"><<a href=3D"mailto:onur.ci...@gmail.com" ta=
rget=3D"_blank">onur.ci...@gmail.com</a>></span> wrote:<br><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
padding-left:1ex">
Hi Fabien,<div><br></div><div>In your Image.cpp, wrap the jpeglib.h include=
line with extern "C" like this:</div><div><br></div><div><div><b=
>extern "C" {<br></b></div><div>#include <jpeglib.h><br>
</div><div><b>}<br></b></div><div><br></div><div>Give it a try, and possibl=
y it should work fine now.</div><div><br></div><div>If it works, the proble=
m is actually in the jpeglib.h header file:</div><div><br></div><div><div>
<b>=A0 =A0 =A030 #ifndef ANDROID</b></div><div>=A0 =A0 =A031 #ifdef __cplus=
plus</div><div>=A0 =A0 =A032 #ifndef DONT_USE_EXTERN_C</div><div>=A0 =A0 =
=A033 extern "C" {</div><div>=A0 =A0 =A034 #endif</div><div>=A0 =
=A0 =A035 #endif</div><div>=A0 =A0 =A036 #endif</div>
</div><div><br></div><div>I don't know why they did it this way. When y=
ou compile using NDK, this block never gets enabled, so the library won'=
;t link properly under C++ code.</div><div><br></div><div>Best regards,</di=
v>
<div><br></div><div>-onur</div><div><div class=3D"h5"><div><br></div><br>On=
Wednesday, November 7, 2012 9:35:10 AM UTC-8, Fabien R wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex">
Hello,
<br>
<br>I'm trying to compile a JNI project using libjpeg-turbo.
<br>
<br>I successfully build the library thanks to this link=20
<br><a href=3D"http://stackoverflow.com/questions/12260149/libjpeg-turbo-fo=
r-android" target=3D"_blank">http://stackoverflow.com/<u></u>questions/1226=
0149/libjpeg-<u></u>turbo-for-android</a>
<br>
<br>But my project can not compile on eclipse:
<br>
<br>/home/fabien/android/android-<u></u>ndk-r8b/ndk-build all
<br>Compile++ thumb =A0: effectsjni <=3D effectsjni.cpp
<br>In file included from=20
<br>jni/com_fabien_r_<u></u>testyourwebcam_opengl2_jni_<u></u>OpenGL2JniInt=
erface.h:2:0,
<br>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 from jni/effectsjni.cpp:6:
<br>/home/fabien/android/android-<u></u>ndk-r8b/platforms/android-14/<u></u=
>arch-arm/usr/include/jni.h:<u></u>592:13:=20
<br>note: the mangling of 'va_list' has changed in GCC 4.4
<br>Compile++ thumb =A0: effectsjni <=3D glutil.cpp
<br>Compile++ thumb =A0: effectsjni <=3D Image.cpp
<br>Prebuilt =A0 =A0 =A0 : libstlport_static.a <=3D=20
<br><NDK>/sources/cxx-stl/stlport/<u></u>libs/armeabi/
<br>Prebuilt =A0 =A0 =A0 : libjpeg.so <=3D jni/
<br>SharedLibrary =A0: libeffectsjni.so
<br>./obj/local/armeabi/objs/<u></u>effectsjni/gltools/Image.o: In function=
=20
<br>`Image::savePicture()':
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:291:=20
<br>undefined reference to `jpeg_std_error(jpeg_error_<u></u>mgr*)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:292:=20
<br>undefined reference to `jpeg_CreateCompress(jpeg_<u></u>compress_struct=
*, int,=20
<br>unsigned int)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:293:=20
<br>undefined reference to `jpeg_stdio_dest(jpeg_<u></u>compress_struct*, _=
_sFILE*)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:294:=20
<br>undefined reference to `jpeg_set_defaults(jpeg_<u></u>compress_struct*)=
'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:301:=20
<br>undefined reference to `jpeg_set_quality(jpeg_<u></u>compress_struct*, =
int, int)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:302:=20
<br>undefined reference to `jpeg_start_compress(jpeg_<u></u>compress_struct=
*, int)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:310:=20
<br>undefined reference to `jpeg_write_scanlines(jpeg_<u></u>compress_struc=
t*,=20
<br>unsigned char**, unsigned int)'
<br>/home/fabien/workspace/<u></u>TestYourWebcam/jni/gltools/<u></u>Image.c=
pp:313:=20
<br>undefined reference to `jpeg_finish_compress(jpeg_<u></u>compress_struc=
t*)'
<br>collect2: ld returned 1 exit status
<br>make: *** [obj/local/armeabi/<u></u>libeffectsjni.so] Error 1
<br>
<br>**** Build Finished ****
<br>
<br>I tried to link the static and the shared library using this Android.mk=
=20
<br>file without success:
<br>LOCAL_PATH :=3D $(call my-dir)
<br>
<br># JPEG support
<br>include $(CLEAR_VARS)
<br>LOCAL_MODULE =A0 =A0:=3D jpeg
<br>#LOCAL_SRC_FILES :=3D libjpeg.a
<br>LOCAL_SRC_FILES :=3D libjpeg.so
<br>LOCAL_EXPORT_C_INCLUDES :=3D=20
<br>/home/fabien/android/android-<u></u>sdk-linux/sources/external/<u></u>l=
ibjpeg-turbo
<br>#include $(PREBUILT_STATIC_LIBRARY)
<br>include $(PREBUILT_SHARED_LIBRARY)
<br>
<br>include $(CLEAR_VARS)
<br>LOCAL_MODULE =A0 =A0:=3D effectsjni
<br>### Add all source file names to be included in lib separated by a=20
<br>whitespace
<br>LOCAL_SRC_FILES :=3D effectsjni.cpp gltools/glutil.cpp gltools/Image.cp=
p
<br>#LOCAL_CFLAGS =A0 =A0:=3D -Werror
<br>LOCAL_LDLIBS =A0 =A0:=3D -llog -lGLESv2
<br># Missing includes
<br>LOCAL_C_INCLUDES +=3D /home/fabien/android/spica/<u></u>sources/glm
<br># Link to JPEG
<br>#LOCAL_STATIC_LIBRARIES :=3D jpeg
<br>LOCAL_SHARED_LIBRARIES :=3D jpeg
<br>include $(BUILD_SHARED_LIBRARY)
<br>
<br>Any hints ?
<br>
<br>-
<br>Fabien
<br>
<br></blockquote></div></div></div><div><div class=3D"h5">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;android-ndk" group.<br></div></div>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msg/android-ndk/-/fkK1I9CVkIcJ" target=3D"_blank">https://groups.googl=
e.com/d/msg/android-ndk/-/fkK1I9CVkIcJ</a>.<div class=3D"HOEnZb"><div class=
=3D"h5">
<br>=20
To post to this group, send email to <a href=3D"mailto:android-ndk@googlegr=
oups.com" target=3D"_blank">android-ndk@googlegroups.com</a>.<br>
To unsubscribe from this group, send email to <a href=3D"mailto:android-ndk=
%2Bunsubscribe@googlegroups.com" target=3D"_blank">android-ndk+unsubscribe@=
googlegroups.com</a>.<br>
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/android-ndk?hl=3Den" target=3D"_blank">http://groups.google.com/group/=
android-ndk?hl=3Den</a>.<br>
</div></div></blockquote></div><br></div></div>
--20cf300fb271a0d1a604cdf1fc79--