Adb for Raspberry pi

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Update: trevd has managed to make a proper adb 1.0.29 frm source. For those who wish to simply use the binary, you can download it here http://forum.xda-developers.com/attachment.php?attachmentid=1392336&d=1349930509


From trevd:
If anyone wants to hack on this I've setup an armv6 device tree on github to use the with AOSP source you can clone it to <aosp_sources>/device/generic/armv6 then do
Code:
lunch mini_armv6-userdebug && make -j4
......
more here http://forum.xda-developers.com/showpost.php?p=32632468&postcount=41






--- OLD ----
I'm trying to build ADB 1.0.28 or higher for the Raspberry Pi. I found a guide here: http://lackingrhoticity.blogspot.com/2010/02/how-to-build-adb-android-debugger.html but it's out of date since we can no longer access kernel.org directly. So, I'm trying to find a new way.

I spoke to Entropy512 and he suggested using the Cyanogenmod repository. So, here's what I have so far.

Code:
sudo apt-get install build-essential libncurses5-dev openjdk-7-jre openjdk-7-jdk bison
mkdir adb
cd adb
git clone git://github.com/CyanogenMod/android_system_core.git system/core
git clone git://github.com/CyanogenMod/android_build.git build
git clone git://github.com/CyanogenMod/android_external_zlib.git external/zlib
git clone git://github.com/CyanogenMod/android_bionic.git bionic
echo "include build/core/main.mk" >Makefile

I edited the adb/build/core/main.mk to reflect the version of JDK and JRE I have on my system. I'm not sure if they are even required at this point... Anyway, I modified the grep statements to find OpenJDK IcedTea instead of Oracle's version. Here's some snippits from the build/core/main.mk file.. make these match the values for your system's "java -version" and "javac -version"

build/core/main.mk
Code:
.
.
.
# Check for the correct version of java
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
#Removed the next 3 lines


.

# Check for the correct version of javac
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
So this puts me here:
Code:
[email protected] ~/adb $ make out/host/linux-x86/bin/adb
^[[A^[[B============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================
build/core/tasks/kernel.mk:68: **********************************************************
build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined  *
build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your   *
build/core/tasks/kernel.mk:71: * BoardConfig.mk file                                    *
build/core/tasks/kernel.mk:72: **********************************************************
host C: adb <= system/core/adb/adb.c
cc1: error: unrecognized command line option ‘-m32’
make: *** [out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb.o] Error 1
[email protected] ~/adb $
I'm still working on the rest. help would be appreciated. I can't get it to build on my desktop either. I really need help with this.
 
Last edited:

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I found a build of Android4.0 for the Raspberry pi. I know that Android ICS and higher come with adb installed on the device for use with USB Host Mode on the device. So I yanked a copy and installed to an sdcard. Then I pulled the binary from /system/bin/adb. however when run it acts like it's not there even though it is.

Code:
[email protected] ~ $ sudo chmod 777 /usr/bin/adb
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ file /usr/bin/adb
/usr/bin/adb: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[email protected] ~ $ readelf -d /usr/bin/adb

Dynamic section at offset 0x1708c contains 24 entries:
  Tag        Type                         Name/Value
 0x00000003 (PLTGOT)                     0x1f198
 0x00000002 (PLTRELSZ)                   768 (bytes)
 0x00000017 (JMPREL)                     0x9048
 0x00000014 (PLTREL)                     REL
 0x00000011 (REL)                        0x9348
 0x00000012 (RELSZ)                      16 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000006 (SYMTAB)                     0x8488
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000005 (STRTAB)                     0x8bd8
 0x0000000a (STRSZ)                      1135 (bytes)
 0x00000004 (HASH)                       0x8128
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000020 (PREINIT_ARRAY)              0x1f000
 0x00000021 (PREINIT_ARRAYSZ)            0x8
 0x00000019 (INIT_ARRAY)                 0x1f008
 0x0000001b (INIT_ARRAYSZ)               8 (bytes)
 0x0000001a (FINI_ARRAY)                 0x1f010
 0x0000001c (FINI_ARRAYSZ)               8 (bytes)
 0x0000001e (FLAGS)                      
 0x00000000 (NULL)                       0x0
I can see there are shared libraries required (libc.so, libstdc++.so and libm.so) , so I added those to /usr/lib/ chmod'd 777 and still nothing changed. What is required for a non-statically compiled binary to run? Did I install those libs properly? Why is that file saying it's not found?

I usually deal with hardware and java. these system binaries are like greek to me.
 

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
203
Seattle, WA
bhundven.github.io
I find dynamic dependencies this way (sgh-i717 rild for instance):
Code:
[email protected]:~/build/vendor/samsung/quincyatt/proprietary/bin$ ~/arm-2009q3/bin/arm-none-linux-gnueabi-objdump -x rild | grep NEEDED
  NEEDED               liblog.so
  NEEDED               libcutils.so
  NEEDED               libril.so
  NEEDED               libdl.so
  NEEDED               libc.so
  NEEDED               libstdc++.so
  NEEDED               libm.so
EDIT: I just re-read about you finding NEEDED. At that point you have to do the same thing to each of those libraries, and find out what they depend on.

EDIT2: Do you have prebuilt/ ?
 
Last edited:
  • Like
Reactions: AdamOutler

cdesai

Inactive Recognized Developer
Jan 16, 2011
2,296
4,088
0
IN YOUR HEAD
You can try compiling it statically, sync the AOSP master to get the latest code, then you'll have to edit system/core/*something*(probably adb)/Android.mk and tell it to link the target binary statically.

I'll link the exact file when on a pc.

Sent from my GT-P1000
 
  • Like
Reactions: AdamOutler

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
203
Seattle, WA
bhundven.github.io
You can try compiling it statically, sync the AOSP master to get the latest code, then you'll have to edit system/core/*something*(probably adb)/Android.mk and tell it to link the target binary statically.

I'll link the exact file when on a pc.

Sent from my GT-P1000
Right:
Code:
LOCAL_FORCE_STATIC_EXECUTABLE := true
where host adb is defined in system/core/adb/Android.mk
 
  • Like
Reactions: AdamOutler

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
203
Seattle, WA
bhundven.github.io
That would be great! How do you compile statically for arm? I put in about 12 hours trying to do this today.
It was my assumption from the original link you posted that this was being built on the r-pi.

Without the prebuilts being part of the environment, linux-x86 directory would be the host gcc. In this case on r-pi debian, arm gcc.

Edit: From the original build you had a problem with -m32 not being a valid argument.
You could comment out lines 48 and 49 of: build/core/combo/HOST_linux-x86.mk
and see what happens.

irc?
 
Last edited:
  • Like
Reactions: AdamOutler

trevd

Inactive Recognized Developer
Jul 19, 2011
894
1,269
123
Hull
I put in about 12 hours trying to do this today.
Seems like your fighting a losing battle there, for that length of time you might as well have sync'd the full lot and done a full build to begin with, It really is the path of least resistance when It comes to android. Otherwise you end up chasing shadows as you get deeper into the build system.

What are you trying to achieve with this? do you want to connect to other devices from the RaspPi or is the Rasp meant to be on the receiving end?
because obviously you'll need to build the daemonized version if the Rasp is your target, that lives in /sbin/adbd normally on the device.

I had a quick look at that guide. Googles sources now live at android.googlesource.com which can be used instead of the old kernel.org address
i.e
Code:
[B]git clone git://android.git.kernel.org/platform/system/core.git system/core[/B]
becomes

Code:
 [B]git clone https://android.googlesource.com/platform/system/core.git system/core[/B]
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Seems like your fighting a losing battle there, for that length of time you might as well have sync'd the full lot and done a full build to begin with, It really is the path of least resistance when It comes to android. Otherwise you end up chasing shadows as you get deeper into the build system.

What are you trying to achieve with this? do you want to connect to other devices from the RaspPi or is the Rasp meant to be on the receiving end?
because obviously you'll need to build the daemonized version if the Rasp is your target, that lives in /sbin/adbd normally on the device.

I had a quick look at that guide. Googles sources now live at android.googlesource.com which can be used instead of the old kernel.org address
i.e
Code:
[B]git clone git://android.git.kernel.org/platform/system/core.git system/core[/B]
becomes

Code:
 [B]git clone https://android.googlesource.com/platform/system/core.git system/core[/B]
Are you sure that will compile on ARM host? I don't want to spend 24 hours downloading and compiling on a 700 MHz processor. The resulting adb binary must run on an arm linux host.
 
  • Like
Reactions: djkidy123

E:V:A

Inactive Recognized Developer
Dec 6, 2011
1,449
2,212
0
-∇ϕ
... Then I pulled the binary from /system/bin/adb. however when run it acts like it's not there even though it is.

Code:
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
Looks to me as you forgot to add your /usr/bin to your PATH variable (which also need to be exported to shell.)
Until you do that you need to use the source operator ".":
Code:
$ [B].[/B]/usr/bin/adb
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Looks to me as you forgot to add your /usr/bin to your PATH variable (which also need to be exported to shell.)
Until you do that you need to use the source operator ".":
Code:
$ [B].[/B]/usr/bin/adb
good thinking.. but it didn't work.. cannot execute binary file.
Code:
[email protected] ~ $ export PATH=/usr/bin:$PATH
[email protected] ~ $ adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ /usr/bin/adb
bash: /usr/bin/adb: No such file or directory
[email protected] ~ $ . /usr/bin/adb
bash: .: /usr/bin/adb: cannot execute binary file
[email protected] ~ $
I have an older copy of ADB 1.0.26, but I need 1.0.28. What is the difference here aside from the shared objects which I've already put into /usr/lib.
Code:
[email protected] ~ $ file /usr/bin/adb #new version
/usr/bin/adb: setuid setgid ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
[email protected] ~ $ file /bin/adb  #old version
/bin/adb: setuid setgid ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, BuildID[sha1]=0x8ffd8c80a0705dc113149612e3067931208bfd70, not stripped
 
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
It was my assumption from the original link you posted that this was being built on the r-pi.

Without the prebuilts being part of the environment, linux-x86 directory would be the host gcc. In this case on r-pi debian, arm gcc.

Edit: From the original build you had a problem with -m32 not being a valid argument.
You could comment out lines 48 and 49 of: build/core/combo/HOST_linux-x86.mk
and see what happens.

irc?
I did this. I got most of the way through compiling.

Code:
[email protected] ~/adb $ make out/host/linux-x86/bin/adb
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================
build/core/tasks/kernel.mk:68: **********************************************************
build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined  *
build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your   *
build/core/tasks/kernel.mk:71: * BoardConfig.mk file                                    *
build/core/tasks/kernel.mk:72: **********************************************************
host C: adb <= system/core/adb/adb.c
system/core/adb/adb.c: In function ‘connect_device’:
system/core/adb/adb.c:998:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
host C: adb <= system/core/adb/console.c
host C: adb <= system/core/adb/transport.c
host C: adb <= system/core/adb/transport_local.c
system/core/adb/transport_local.c: In function ‘local_init’:
system/core/adb/transport_local.c:321:8: warning: extra tokens at end of #endif directive [enabled by default]
host C: adb <= system/core/adb/transport_usb.c
host C: adb <= system/core/adb/commandline.c
host C: adb <= system/core/adb/adb_client.c
host C: adb <= system/core/adb/sockets.c
host C: adb <= system/core/adb/services.c
host C: adb <= system/core/adb/file_sync_client.c
host C: adb <= system/core/adb/get_my_path_linux.c
host C: adb <= system/core/adb/usb_linux.c
host C: adb <= system/core/adb/utils.c
host C: adb <= system/core/adb/usb_vendors.c
host C: adb <= system/core/adb/fdevent.c
host C: libzipfile <= system/core/libzipfile/centraldir.c
host C: libzipfile <= system/core/libzipfile/zipfile.c
host StaticLib: libzipfile (out/host/linux-x86/obj/STATIC_LIBRARIES/libzipfile_intermediates/libzipfile.a)
host C: libunz <= external/zlib/adler32.c
host C: libunz <= external/zlib/crc32.c
host C: libunz <= external/zlib/zutil.c
host C: libunz <= external/zlib/inflate.c
host C: libunz <= external/zlib/inftrees.c
host C: libunz <= external/zlib/inffast.c
host StaticLib: libunz (out/host/linux-x86/obj/STATIC_LIBRARIES/libunz_intermediates/libunz.a)
host C: liblog <= system/core/liblog/logd_write.c
system/core/liblog/logd_write.c: In function ‘__write_to_log_kernel’:
system/core/liblog/logd_write.c:90:9: warning: implicit declaration of function ‘fakeLogWritev’ [-Wimplicit-function-declaration]
system/core/liblog/logd_write.c: In function ‘__write_to_log_init’:
system/core/liblog/logd_write.c:103:9: warning: implicit declaration of function ‘fakeLogOpen’ [-Wimplicit-function-declaration]
system/core/liblog/logd_write.c:112:13: warning: implicit declaration of function ‘fakeLogClose’ [-Wimplicit-function-declaration]
host C: liblog <= system/core/liblog/logprint.c
host C: liblog <= system/core/liblog/event_tag_map.c
host C: liblog <= system/core/liblog/fake_log_device.c
host StaticLib: liblog (out/host/linux-x86/obj/STATIC_LIBRARIES/liblog_intermediates/liblog.a)
host C: libcutils <= system/core/libcutils/atomic.c
In file included from system/core/include/cutils/atomic-inline.h:47:0,
                 from system/core/libcutils/atomic.c:19:
system/core/include/cutils/atomic-arm.h:21:34: fatal error: machine/cpu-features.h: No such file or directory
compilation terminated.
make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/atomic.o] Error 1
[email protected] ~/adb $
Not sure what I need to do to fix system/core/libcutils/atomic.c Maybe I need to get the machine/ repo.
 
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
I was able to link some libraries around and ended up here..
Code:
[email protected] ~/adb $ make out/host/linux-x86/bin/adb
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=IMM76L
============================================
build/core/tasks/kernel.mk:68: **********************************************************
build/core/tasks/kernel.mk:69: * Kernel source found, but no configuration was defined  *
build/core/tasks/kernel.mk:70: * Please add the TARGET_KERNEL_CONFIG variable to your   *
build/core/tasks/kernel.mk:71: * BoardConfig.mk file                                    *
build/core/tasks/kernel.mk:72: **********************************************************
host C: libcutils <= system/core/libcutils/atomic.c
host C: libcutils <= system/core/libcutils/array.c
host C: libcutils <= system/core/libcutils/hashmap.c
host C: libcutils <= system/core/libcutils/native_handle.c
host C: libcutils <= system/core/libcutils/buffer.c
host C: libcutils <= system/core/libcutils/socket_inaddr_any_server.c
host C: libcutils <= system/core/libcutils/socket_local_client.c
host C: libcutils <= system/core/libcutils/socket_local_server.c
host C: libcutils <= system/core/libcutils/socket_loopback_client.c
host C: libcutils <= system/core/libcutils/socket_loopback_server.c
host C: libcutils <= system/core/libcutils/socket_network_client.c
host C: libcutils <= system/core/libcutils/sockets.c
host C: libcutils <= system/core/libcutils/config_utils.c
host C: libcutils <= system/core/libcutils/cpu_info.c
host C: libcutils <= system/core/libcutils/load_file.c
host C: libcutils <= system/core/libcutils/list.c
host C: libcutils <= system/core/libcutils/open_memstream.c
host C: libcutils <= system/core/libcutils/strdup16to8.c
host C: libcutils <= system/core/libcutils/strdup8to16.c
host C: libcutils <= system/core/libcutils/record_stream.c
host C: libcutils <= system/core/libcutils/process_name.c
host C: libcutils <= system/core/libcutils/properties.c
host C: libcutils <= system/core/libcutils/threads.c
host C: libcutils <= system/core/libcutils/sched_policy.c
host C: libcutils <= system/core/libcutils/iosched_policy.c
host C: libcutils <= system/core/libcutils/str_parms.c
host C: libcutils <= system/core/libcutils/abort_socket.c
host C: libcutils <= system/core/libcutils/mspace.c
host C: libcutils <= system/core/libcutils/selector.c
host C: libcutils <= system/core/libcutils/tztime.c
system/core/libcutils/tztime.c: In function ‘differ_by_repeat’:
system/core/libcutils/tztime.c:303:2: warning: comparison is always false due to limited range of data type [-Wtype-limits]
system/core/libcutils/tztime.c: In function ‘localsub’:
system/core/libcutils/tztime.c:1267:24: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
host C: libcutils <= system/core/libcutils/zygote.c
host C: libcutils <= system/core/libcutils/ashmem-host.c
host C: libcutils <= system/core/libcutils/tzstrftime.c
system/core/libcutils/tzstrftime.c: In function ‘_fmt’:
system/core/libcutils/tzstrftime.c:360:7: warning: implicit declaration of function ‘sprintf’ [-Wimplicit-function-declaration]
system/core/libcutils/tzstrftime.c:360:14: warning: incompatible implicit declaration of built-in function ‘sprintf’ [enabled by default]
system/core/libcutils/tzstrftime.c: In function ‘_conv’:
system/core/libcutils/tzstrftime.c:628:9: warning: incompatible implicit declaration of built-in function ‘sprintf’ [enabled by default]
host C: libcutils <= system/core/libcutils/dlmalloc_stubs.c
host StaticLib: libcutils (out/host/linux-x86/obj/STATIC_LIBRARIES/libcutils_intermediates/libcutils.a)
host Executable: adb (out/host/linux-x86/obj/EXECUTABLES/adb_intermediates/adb)
true
host C: acp <= build/tools/acp/acp.c
host C++: libhost <= build/libs/host/pseudolocalize.cpp
host C: libhost <= build/libs/host/CopyFile.c
host StaticLib: libhost (out/host/linux-x86/obj/STATIC_LIBRARIES/libhost_intermediates/libhost.a)
host Executable: acp (out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp)
true
Install: out/host/linux-x86/bin/acp
Notice file: system/core/adb/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//bin/adb.txt
Notice file: system/core/libzipfile/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libzipfile.a.txt
Notice file: system/core/liblog/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/liblog.a.txt
Notice file: system/core/libcutils/NOTICE -- out/host/linux-x86/obj/NOTICE_FILES/src//lib/libcutils.a.txt
target arm C: libc <= bionic/libc/bionic/pthread.c
target thumb C: libc <= bionic/libc/arch-arm/bionic/exidx_dynamic.c
target thumb C: libc <= bionic/libc/unistd/sysconf.c
target thumb C: libc <= bionic/libc/bionic/__errno.c
target thumb C: libc <= bionic/libc/bionic/dlmalloc.c
target thumb C: libc <= bionic/libc/bionic/malloc_debug_common.c
target thumb C: libc <= bionic/libc/bionic/libc_init_dynamic.c
target thumb C: libdl <= bionic/libdl/libdl.c
cc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -o out/target/product/generic/obj/lib/crtbegin_so.o -c bionic/libc/arch-arm/bionic/crtbegin_so.S
cc -mthumb-interwork -Ibionic/libc/private -DCRT_LEGACY_WORKAROUND -o out/target/product/generic/obj/lib/crtend_so.o -c bionic/libc/arch-arm/bionic/crtend_so.S
target SharedLib: libdl (out/target/product/generic/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so)
/usr/bin/ld: unrecognized option '--icf=safe'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/libdl_intermediates/LINKED/libdl.so] Error 1
so I did a
Code:
[email protected] ~/adb $ grep -r 'icf=safe' ./*
./build/core/combo/TARGET_linux-arm.mk:			-Wl,--icf=safe \
and I removed that icf parameter.
 
Last edited:
  • Like
Reactions: djkidy123

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
ok, so i've been hacking around on this quite a bit... I don't know how to work through this final linking part. here's a pastebin...

http://pastebin.com/pb8F7raB


how do i fix undefined references? I've been hacking it up by linking files where they should be linkd. I don't know how to fix this. Like I said before... I don't work at this level usually. I work on Java, shell, and hardware. C and middle-ware is not my thing.
 
  • Like
Reactions: djkidy123

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
203
Seattle, WA
bhundven.github.io
ok, so i've been hacking around on this quite a bit... I don't know how to work through this final linking part. here's a pastebin...

http://pastebin.com/pb8F7raB


how do i fix undefined references? I've been hacking it up by linking files where they should be linkd. I don't know how to fix this. Like I said before... I don't work at this level usually. I work on Java, shell, and hardware. C and middle-ware is not my thing.
Try adding:
Code:
--with-float=soft
to LOCAL_CFLAGS

EDIT: You might also need to add
Code:
-lgcc
to the LOCAL_LDFLAGS
 
Last edited:

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Try adding:
Code:
--with-float=soft
to LOCAL_CFLAGS

EDIT: You might also need to add
Code:
-lgcc
to the LOCAL_LDFLAGS
Thanks. I'm not sure where to add it though
Code:
[email protected] ~/adb $ grep -R  LOCAL_CFLAGS ./*
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS+= \
./bionic/libc/Android.mk:LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Jamfile:        local LOCAL_CFLAGS LOCAL_DEFINES LOCAL_INCLUDES LOCAL_SRC NO_LOCAL_SRC ;
./bionic/libc/Jamfile:        CFLAGS   += $(LOCAL_CFLAGS) ;
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DVM_SPLIT_2G
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DPRELINK
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DANDROID_ARM_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DANDROID_X86_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/arch-x86/bionic
./bionic/linker/Android.mk:      LOCAL_CFLAGS += -DANDROID_SH_LINKER
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=1
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./build/tools/rgb2565/Android.mk:LOCAL_CFLAGS += -O2 -Wall -Wno-unused-parameter
./build/buildspec.mk.default:# will be added to LOCAL_CFLAGS when building the module.
./build/core/clear_vars.mk:LOCAL_CFLAGS:=
./build/core/build-system.html:LOCAL_CFLAGS += -DNDEBUG=1
./build/core/build-system.html:<h4>LOCAL_CFLAGS</h4>
./build/core/build-system.html:<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
./build/core/build-system.html:<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code>
./build/core/build-system.html:<code>LOCAL_CFLAGS</code>.
./build/core/build-system.html:<code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and
./build/core/native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
./build/core/host_native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
./build/core/binary.mk:  LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
./build/core/binary.mk:LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
./build/core/binary.mk:$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP
./system/core/libsysutils/Android.mk:LOCAL_CFLAGS := 
./system/core/charger/Android.mk:LOCAL_CFLAGS += -DBATTERY_DEVICE_NAME=\"$(BOARD_BATTERY_DEVICE_NAME)\"
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(hostSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)'
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND_CLEAR_REASON
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DTEST_STR_PARMS
./system/core/libusbhost/Android.mk:LOCAL_CFLAGS := -g -DUSE_LIBLOG
./system/core/sh/Android.mk:LOCAL_CFLAGS += -DSHELL -DWITH_LINENOISE
./system/core/sh/Android.mk:make_ash_files: PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./system/core/libdiskconfig/Android.mk:LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS := -Wall
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/adb/Android.mk:LOCAL_CFLAGS += -g -DADB_HOST=1  -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS := -g -DADB_HOST=0 -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS += -DANDROID_GADGET=1
./system/core/adb/Android.mk:	LOCAL_CFLAGS += -DBOARD_ALWAYS_INSECURE
./system/core/adb/Android.mk:LOCAL_CFLAGS := \
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS += -DWITH_LIB_HARDWARE
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 
./system/core/liblog/Android.mk:LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1
./system/core/init/Android.mk:LOCAL_CFLAGS    += -DBOOTCHART=1
./system/core/init/Android.mk:LOCAL_CFLAGS += -DNO_INITLOGO
./system/core/init/Android.mk:    $(eval LOCAL_CFLAGS += -D$(system_core_init_define)=\"$($(system_core_init_define))\") \
[email protected] ~/adb $
This is all very confusing.

I pushed my source to dev host for anyone interested. http://d-h.st/wmN

I will make sure to hit that thanks button once I get to a desktop. This RPI takes too long to scroll and I'm using the web from it.
 
  • Like
Reactions: djkidy123

bhundven

Inactive Recognized Developer
Aug 8, 2009
2,076
4,495
203
Seattle, WA
bhundven.github.io
Thanks. I'm not sure where to add it though
Code:
[email protected] ~/adb $ grep -R  LOCAL_CFLAGS ./*
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS+= \
./bionic/libc/Android.mk:LOCAL_CFLAGS += -DCRT_LEGACY_WORKAROUND
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags) \
./bionic/libc/Android.mk:LOCAL_CFLAGS := $(libc_common_cflags)
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Android.mk:LOCAL_CFLAGS := \
./bionic/libc/Jamfile:        local LOCAL_CFLAGS LOCAL_DEFINES LOCAL_INCLUDES LOCAL_SRC NO_LOCAL_SRC ;
./bionic/libc/Jamfile:        CFLAGS   += $(LOCAL_CFLAGS) ;
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DVM_SPLIT_2G
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DPRELINK
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_TEXT_BASE=$(LINKER_TEXT_BASE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_AREA_SIZE=$(LINKER_AREA_SIZE)
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
./bionic/linker/Android.mk:LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/private
./bionic/linker/Android.mk:LOCAL_CFLAGS += -DANDROID_ARM_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -DANDROID_X86_LINKER
./bionic/linker/Android.mk:    LOCAL_CFLAGS += -I$(LOCAL_PATH)/../libc/arch-x86/bionic
./bionic/linker/Android.mk:      LOCAL_CFLAGS += -DANDROID_SH_LINKER
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=0
./bionic/linker/README.TXT:    LOCAL_CFLAGS += -DLINKER_DEBUG=1
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./bionic/libstdc++/Android.mk:LOCAL_CFLAGS := $(libstdc++_cflags)
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/tools/acp/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./build/tools/rgb2565/Android.mk:LOCAL_CFLAGS += -O2 -Wall -Wno-unused-parameter
./build/buildspec.mk.default:# will be added to LOCAL_CFLAGS when building the module.
./build/core/clear_vars.mk:LOCAL_CFLAGS:=
./build/core/build-system.html:LOCAL_CFLAGS += -DNDEBUG=1
./build/core/build-system.html:<h4>LOCAL_CFLAGS</h4>
./build/core/build-system.html:<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
./build/core/build-system.html:<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code>
./build/core/build-system.html:<code>LOCAL_CFLAGS</code>.
./build/core/build-system.html:<code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and
./build/core/native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING
./build/core/host_native_test.mk:LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
./build/core/binary.mk:  LOCAL_CFLAGS += $(TARGET_FDO_CFLAGS)
./build/core/binary.mk:LOCAL_CFLAGS += -DGOOGLE_PROTOBUF_NO_RTTI
./build/core/binary.mk:$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DWIN32_EXE
./build/libs/host/Android.mk:LOCAL_CFLAGS += -DMACOSX_RSRC
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP $(zlib_arm_flags)
./external/zlib/Android.mk:LOCAL_CFLAGS += -O3 -DUSE_MMAP
./system/core/libsysutils/Android.mk:LOCAL_CFLAGS := 
./system/core/charger/Android.mk:LOCAL_CFLAGS += -DBATTERY_DEVICE_NAME=\"$(BOARD_BATTERY_DEVICE_NAME)\"
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(hostSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DHAVE_MEMSET16 -DHAVE_MEMSET32
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND='$(TARGET_RECOVERY_PRE_COMMAND)'
./system/core/libcutils/Android.mk:    LOCAL_CFLAGS += -DRECOVERY_PRE_COMMAND_CLEAR_REASON
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += $(targetSmpFlag)
./system/core/libcutils/Android.mk:LOCAL_CFLAGS += -DTEST_STR_PARMS
./system/core/libusbhost/Android.mk:LOCAL_CFLAGS := -g -DUSE_LIBLOG
./system/core/sh/Android.mk:LOCAL_CFLAGS += -DSHELL -DWITH_LINENOISE
./system/core/sh/Android.mk:make_ash_files: PRIVATE_CFLAGS := $(LOCAL_CFLAGS)
./system/core/libdiskconfig/Android.mk:LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS := -Wall
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP
./system/core/debuggerd/Android.mk:LOCAL_CFLAGS += -DWITH_VFP_D32
./system/core/adb/Android.mk:LOCAL_CFLAGS += -g -DADB_HOST=1  -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS := -g -DADB_HOST=0 -Wall -Wno-unused-parameter
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -D_XOPEN_SOURCE -D_GNU_SOURCE
./system/core/adb/Android.mk:LOCAL_CFLAGS += -DANDROID_GADGET=1
./system/core/adb/Android.mk:	LOCAL_CFLAGS += -DBOARD_ALWAYS_INSECURE
./system/core/adb/Android.mk:LOCAL_CFLAGS := \
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/adb/Android.mk:LOCAL_CFLAGS += -O2
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/nexus/Android.mk:LOCAL_CFLAGS := 
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS)
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS += -DWITH_LIB_HARDWARE
./system/core/libpixelflinger/Android.mk:LOCAL_CFLAGS := $(PIXELFLINGER_CFLAGS) 
./system/core/liblog/Android.mk:LOCAL_CFLAGS := -DFAKE_LOG_DEVICE=1
./system/core/init/Android.mk:LOCAL_CFLAGS    += -DBOOTCHART=1
./system/core/init/Android.mk:LOCAL_CFLAGS += -DNO_INITLOGO
./system/core/init/Android.mk:    $(eval LOCAL_CFLAGS += -D$(system_core_init_define)=\"$($(system_core_init_define))\") \
[email protected] ~/adb $
This is all very confusing.

I pushed my source to dev host for anyone interested. http://d-h.st/wmN

I will make sure to hit that thanks button once I get to a desktop. This RPI takes too long to scroll and I'm using the web from it.
Try build/core/combo/TARGET_linux-arm.mk
 
  • Like
Reactions: AdamOutler

AdamOutler

Retired Senior Recognized Developer
Feb 18, 2011
5,224
9,808
0
Miami, Fl̨̞̲̟̦̀̈̃͛҃҅͟orida
Try build/core/combo/TARGET_linux-arm.mk
I added
Code:
LOCAL_CFLAGS += --with-float=soft
LOCAL_LDFLAGS += -lgcc
to both the TARGET you suggested and HOST_linux_x86. I got the same error.

I'm compiling this on the Raspberry Pi itself because i need the statically linked host binary. I'm using the x86 host because there is no arm host available. this should be irrelevant because i'm using the native build tools. Anyway.. I convinced it to use x86 and now the linking seems to be the final challenge.
 
Last edited: