porting CUPS to android

1,146 views
Skip to first unread message

Charlie

unread,
Nov 22, 2010, 6:58:15 AM11/22/10
to android-porting
Hi,

I'm trying to port CUPS to android (i.e. running CUPS on an android-
based printer).

I build CUPS as a statically linked executable using the codesourcery
distribution, along the lines of the guy who built the bash shell for
android.
(http://www.kbrandt.com/2009/06/how-to-cross-compile-the-bash-shell-
for-android-15.html)

I got it to build, but it would not run (I got a cryptic "not found"
message when running "./cupsd" - the file is there). Checking the
executable "cupsd" with file, claims that it is dynamically linked. I
run the codesourcery ldd and it claims the file is statically linked
(which it does when I build it to use shared libraries - the tool
appears to be broken).

I strongly suspect that there is some library dependency that I need
to resolve, or to include in the static build, but I'm at a loss as to
how to find it since ldd doesn't appear to work right.

Just to be sure that cups can be built statically, I did it on my
desktop system, and no problem running it.

Here are the steps I went through to build it:
export CC=/host/home-ext/bin/arm-none-linux-gnueabi-gcc
export CXX=/host/home-ext/bin/arm-none-linux-gnueabi-g++
export LD=/host/home-ext/bin/arm-none-linux-gnueabi-ld
export MANTOHTML=~/cups/cups-1.4.4/man/mantohtml
export GENSTRINGS=~/cups/cups-1.4.4/ppdc/genstrings
export CFLAGS="-fPIC -static"
export LDFLAGS="-static"

change line in install-sh:
stripprog="/host/home-ext/bin/arm-none-linux-gnueabi-strip"

./configure --prefix=/opt/arm_cups -host=arm-linux --disable-dbus --
enable-static-link --disable-shared

A couple of minor edits to get it to build - cups builds and runs some
tools as part of the make process, not very good for a cross compiling
environment.
Makefile - removed "all" from install & install-exec target
ppdc/Makefile - changed ./genstrings to $(GENSTRINGS)
man/Makefile
- changed ./mantohtml to $(MANTOHTML)

make
make install
adb push /opt/arm_cups /data



if anyone has any suggestions on how to debug this, I'd appreciate it.

Charlie

Chris Stratton

unread,
Nov 22, 2010, 12:00:32 PM11/22/10
to android-porting
You may want to try (ab)using the ndk's gcc compiler to build your
program against bionic rather than using codesourcery gcc. A web
search will turn up instructions for how to make an executable rather
than a library.

If you stick with the non-android gcc, first try building a simple
hello world program and making sure that can be executed on the
device. And make sure you are installing the binary someplace that
isn't mounted noexec.

Chih-Wei

unread,
Nov 25, 2010, 8:43:41 PM11/25/10
to android-porting
Not related to your question but you may be interesting.
You can take a look at OESF's EM2.
They have added Printer Manager to Android.

http://developer.oesf.biz/em/developer/

Charlie Hamilton

unread,
Dec 4, 2010, 3:13:04 PM12/4/10
to cwh...@linux.org.tw, android-porting
I have an update on this. I have cupsd running after building it using bionic and the ndk tools.
Currently I have some do-nothing stubs for libs used by cups that aren't in bionic (POSIX,
the crypt library, and a few others).

It's a pain in the neck because the ndk tools and autoconf don't work together very well.

I'm going to clean it up and post the instructions here when it's done.

Charlie


David Chkhikvadze

unread,
Dec 19, 2010, 11:24:51 AM12/19/10
to android-porting
> I'm going to clean it up and post the instructions here when it's done.
I would be very thankful, I am basically trying to accomplish the very
same goal.

Is there any chance you would share binaries too?
> > unsubscribe: android-porti...@googlegroups.com<android-porting%2Bunsubscribe@­googlegroups.com>
> > website:http://groups.google.com/group/android-porting

sang tan

unread,
Jan 25, 2011, 11:38:32 PM1/25/11
to android-porting
Hi all,

We OESF Vietnam Lab has successfully ported CUPS to Android. Some classes and screens are also added to framework and apps to simplify printing programming.

You can see the demo here:
http://www.youtube.com/watch?v=WzL5mzMNNkU

Enjoy!
TQSang

chandrashekar

unread,
Aug 3, 2011, 7:46:17 AM8/3/11
to android...@googlegroups.com
Charlie Hamilton <charleeh1112@...> writes:

>
>
> I have an update on this. I have cupsd running after building it using
bionic and the ndk tools.
> Currently I have some do-nothing stubs for libs used by cups that aren't in
bionic (POSIX,
> the crypt library, and a few others).
> It's a pain in the neck because the ndk tools and autoconf don't work
together very well.
> I'm going to clean it up and post the instructions here when it's done.
> Charlie

> On Thu, Nov 25, 2010 at 8:43 PM, Chih-Wei <cwhuang-
Xh+NVF5n0LI...@public.gmane.org> wrote:
> Not related to your question but you may be interesting.
> You can take a look at OESF's EM2.
> They have added Printer Manager to
Android.http://developer.oesf.biz/em/developer/
>
>
>
> --

> unsubscribe: android-porting+unsubscribe-
/JYPxA39Uh5...@public.gmane.org
> website: http://groups.google.com/group/android-porting
>

Hi charlie,

I built the cups via shared library and when i try to run cupsd i am hitting
segmentation fault i think i am missing some library, can you please help me
in finding the missing library. I think you have successfully ported.

I followed the below steps

export
LD_LIBRARY_PATH=/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_la
test/out/target/product/generic/obj/lib

./configure --prefix=/system/cups_shared -host=arm-eabi AR=arm-eabi-ar LD=arm-
eabi-ld STRIP=arm-eabi-strip CXX=arm-eabi-g++ CC=arm-eabi-gcc CPPFLAGS="-
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/system/cor
e/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/hardware/l
ibhardware/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/hardware/r
il/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/dalvik/lib
nativehelper/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/frameworks
/base/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/external/s
kia/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/platforms/
android-8/arch-arm/usr/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
c/arch-arm/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
c/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
stdc++/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
c/kernel/common -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
c/kernel/arch-arm -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
m/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
m/include/arch/arm -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
thread_db/include -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
m/arm -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/bionic/lib
m -
I/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/out/target
/product/generic/obj/SHARED_LIBRARIES/libm_intermediates" CFLAGS="-
D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -
DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale -msoft-
float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-
tables -fstack-protector -fmessage-length=0" LDFLAGS="-nostdlib -Wl,-
T,/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/prebuilt/
linux-x86/toolchain/arm-eabi-4.4.0/arm-eabi/lib/ldscripts/armelf.x -Wl,-
T,/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/prebuilt/
linux-x86/toolchain/arm-eabi-4.4.0/arm-eabi/lib/ldscripts/armelf.xsc -Wl,-
dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-shared,-Bsymbolic -
Wl,-rpath-
link=/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/out/ta
rget/product/generic/obj/lib -
L/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/out/target
/product/generic/obj/lib -Wl,--no-whole-archive -lc -lstdc++ -lm -Wl,--no-
undefined /home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/p
rebuilt/linux-x86/toolchain/arm-eabi-4.4.0/lib/gcc/arm-
eabi/4.4.0/interwork/libgcc.a -Wl,-f-whole-archive" --enable-shared CUPSDLIBS=-
L/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/out/target
/product/generic/obj/lib -ldbus " DBUS_NOTIFIERLIBS="-
L/home/lfs/Froyo_No_Changes/IMPORT/GALab/GoogleOrg/OPEN/froyo_latest/out/target
/product/generic/obj/lib -ldbus" --disable-gssapi


wei ke

unread,
Sep 20, 2013, 10:06:52 PM9/20/13
to android...@googlegroups.com, cwh...@linux.org.tw
Dear All,

I have ported  USB Printer framework from OESF to Android(ICS), but I don't know how to get .ppd file

like HP-LaserJet-P1006.ppd. this is the laster step to make my printer work. after that  I shall  share  every detail about my work

在 2013年2月23日星期六UTC+8上午4时00分00秒,Felipe Nipo写道:
I have experienced problems with port linux-package to android. I tried port "vim" linux-package to run on android-linux layer.
I got compile with codesourcery g++-lite, than couple libc to executable using a "-static" flag on gcc compile command, being no longer necessary the bionic.
However the executable not run, had the same problem you described.

If you could, i am eagerly waiting for your reply.
I think it would be possible to build a cross-compile environment able to easily port any linux package to android-linux, specifically for ARM platforms.

see ya.

doron sandroy

unread,
Nov 28, 2013, 12:35:17 PM11/28/13
to android...@googlegroups.com, cwh...@linux.org.tw

hi all
i need CUPS build for android 4.xx.
wear i can download files.
thinks doron.
בתאריך יום שבת, 21 בספטמבר 2013 05:06:52 UTC+3, מאת wei ke:

mz

unread,
Dec 11, 2013, 1:55:01 AM12/11/13
to android...@googlegroups.com, cwh...@linux.org.tw
where do you start to port cups to android?

diana ludovice

unread,
Jul 31, 2017, 10:28:21 AM7/31/17
to android-porting, cwh...@linux.org.tw, mzamm...@gmail.com
Hi All, 

I would like to port CUPS on my android device RK3399. If you have any info on how to get this done, please share. I am also willing to work with you and share new knowledge. Thanks.

Satish Patel

unread,
Aug 1, 2017, 1:22:54 AM8/1/17
to dianal...@gmail.com, android-porting, cwh...@linux.org.tw, mzamm...@gmail.com
Hi Diana,

I am not sure, if you would like to try this app, which claims support for CUPS

Otherwise, steps could be
- take CUPS source 
- Need to implement GUI portion in that - which is compatible to Android
- Https calls should be replaced by Android APIs
- Fixing build errors for Android tool chain

Good to start open source project on that :)

--
satish

On Mon, Jul 31, 2017 at 3:16 PM, diana ludovice <dianal...@gmail.com> wrote:
Hi All, 

I would like to port CUPS on my android device RK3399. If you have any info on how to get this done, please share. I am also willing to work with you and share new knowledge. Thanks.

--
--
unsubscribe: android-porting+unsubscribe@googlegroups.com
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porting+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards,
satish patel
Reply all
Reply to author
Forward
0 new messages