BUG: Cannot create shared object for Android x86_64

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG: Cannot create shared object for Android x86_64

Jeffrey Walton
When compiling and linking for Android x86_64, the linking of the
shared object libmp3lame.so.0.0.0 fails.

--sysroot was used to pass the header and library paths. --sysroot was
set in CPPFLAGS, CFLAGS and CXXFLAGS:

$ echo $CPPFLAGS
--sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
$ echo $CFLAGS
--sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
$ echo $CXXFLAGS
--sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64

--sysroot was used during configuration and compilation, and all the
object files were created successfully.

--sysroot was not present when creating the shared object, and the
shared object creation failed.

The invocation below needs to include CFLAGS so --sysroot is available
to the compiler driver.

**********

$ echo $ANDROID_SYSROOT
/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
$ ls $ANDROID_SYSROOT/usr/lib
crtbegin_dynamic.o    libGLESv3.so        liblog.so
crtbegin_so.o        libOpenMAXAL.so        libm.a
crtbegin_static.o    libOpenSLES.so        libm.so
crtend_android.o    libandroid.so        libmediandk.so
crtend_so.o        libc.a            libstdc++.a
libEGL.so        libc.so            libstdc++.so
libGLESv1_CM.so        libdl.so        libz.a
libGLESv2.so        libjnigraphics.so    libz.so

**********

libtool: link: x86_64-linux-android-gcc -shared  .libs/VbrTag.o
.libs/bitstream.o .libs/encoder.o .libs/fft.o .libs/gain_analysis.o
.libs/id3tag.o .libs/lame.o .libs/newmdct.o .libs/presets.o
.libs/psymodel.o .libs/quantize.o .libs/quantize_pvt.o
.libs/reservoir.o .libs/set_get.o .libs/tables.o .libs/takehiro.o
.libs/util.o .libs/vbrquantize.o .libs/version.o
.libs/mpglib_interface.o  -Wl,--whole-archive
../libmp3lame/vector/.libs/liblamevectorroutines.a
../mpglib/.libs/libmpgdecoder.a -Wl,--no-whole-archive  -lm
-Wl,-soname -Wl,libmp3lame.so.0 -o .libs/libmp3lame.so.0.0.0

/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
error: cannot open crtbegin_so.o: No such file or directory
/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
error: cannot open crtend_so.o: No such file or directory
/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
error: cannot find -lm
/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
error: cannot find -lc
/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
error: cannot find -ldl
collect2: error: ld returned 1 exit status
make[3]: *** [libmp3lame.la] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev
Reply | Threaded
Open this post in threaded view
|

Re: BUG: Cannot create shared object for Android x86_64

Jeffrey Walton
When running the failed command manually with $CC and $CFLAGS (and
forgoing that cursed tool known as libtool), I was able to create the
shared object manually:

ame-3.99.5$ cd libmp3lame
libmp3lame$ $CC $CFLAGS -shared  .libs/VbrTag.o .libs/bitstream.o
.libs/encoder.o .libs/fft.o .libs/gain_analysis.o .libs/id3tag.o
.libs/lame.o .libs/newmdct.o .libs/presets.o .libs/psymodel.o
.libs/quantize.o .libs/quantize_pvt.o .libs/reservoir.o
.libs/set_get.o .libs/tables.o .libs/takehiro.o .libs/util.o
.libs/vbrquantize.o .libs/version.o .libs/mpglib_interface.o
-Wl,--whole-archive ../libmp3lame/vector/.libs/liblamevectorroutines.a
../mpglib/.libs/libmpgdecoder.a -Wl,--no-whole-archive  -lm
-Wl,-soname -Wl,libmp3lame.so.0 -o .libs/libmp3lame.so.0.0.0
libmp3lame$
$ cd ..
ame-3.99.5$ find . -name libmp3lame.so.0.0.0
./libmp3lame/.libs/libmp3lame.so.0.0.0


On Mon, Jan 12, 2015 at 12:56 AM, Jeffrey Walton <[hidden email]> wrote:

> When compiling and linking for Android x86_64, the linking of the
> shared object libmp3lame.so.0.0.0 fails.
>
> --sysroot was used to pass the header and library paths. --sysroot was
> set in CPPFLAGS, CFLAGS and CXXFLAGS:
>
> $ echo $CPPFLAGS
> --sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
> $ echo $CFLAGS
> --sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
> $ echo $CXXFLAGS
> --sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64
>
> --sysroot was used during configuration and compilation, and all the
> object files were created successfully.
>
> --sysroot was not present when creating the shared object, and the
> shared object creation failed.
>
> The invocation below needs to include CFLAGS so --sysroot is available
> to the compiler driver.
>
> **********
>
> $ echo $ANDROID_SYSROOT
> /opt/android-ndk-r10d/platforms/android-21/arch-x86_64
> $ ls $ANDROID_SYSROOT/usr/lib
> crtbegin_dynamic.o    libGLESv3.so        liblog.so
> crtbegin_so.o        libOpenMAXAL.so        libm.a
> crtbegin_static.o    libOpenSLES.so        libm.so
> crtend_android.o    libandroid.so        libmediandk.so
> crtend_so.o        libc.a            libstdc++.a
> libEGL.so        libc.so            libstdc++.so
> libGLESv1_CM.so        libdl.so        libz.a
> libGLESv2.so        libjnigraphics.so    libz.so
>
> **********
>
> libtool: link: x86_64-linux-android-gcc -shared  .libs/VbrTag.o
> .libs/bitstream.o .libs/encoder.o .libs/fft.o .libs/gain_analysis.o
> .libs/id3tag.o .libs/lame.o .libs/newmdct.o .libs/presets.o
> .libs/psymodel.o .libs/quantize.o .libs/quantize_pvt.o
> .libs/reservoir.o .libs/set_get.o .libs/tables.o .libs/takehiro.o
> .libs/util.o .libs/vbrquantize.o .libs/version.o
> .libs/mpglib_interface.o  -Wl,--whole-archive
> ../libmp3lame/vector/.libs/liblamevectorroutines.a
> ../mpglib/.libs/libmpgdecoder.a -Wl,--no-whole-archive  -lm
> -Wl,-soname -Wl,libmp3lame.so.0 -o .libs/libmp3lame.so.0.0.0
>
> /opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
> error: cannot open crtbegin_so.o: No such file or directory
> /opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
> error: cannot open crtend_so.o: No such file or directory
> /opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
> error: cannot find -lm
> /opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
> error: cannot find -lc
> /opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/x86_64-linux-android/4.9/../../../../x86_64-linux-android/bin/ld:
> error: cannot find -ldl
> collect2: error: ld returned 1 exit status
> make[3]: *** [libmp3lame.la] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev