Re: Missing Xlib for ARM board
- From: hns <hns@xxxxxxxxxxxx>
- Date: Thu, 3 Jan 2008 04:08:11 -0800 (PST)
On 3 Jan., 04:24, ---@--- (Robert Scott) wrote:
I am still trying to figure out how to write to the LCD on an Embest SCB210-II.
Now I am trying to compile and Xlib tutorial program I downloaded. But when I
do the compile, I get link errors because of missing libraries. Here is the
program:
#include <X11/Xlib.h> // Every Xlib program must include this
#include <assert.h> // I include this to test return values the lazy way
#include <unistd.h> // So we got the profile for 10 seconds
#define NIL (0) // A name for the void pointer
main()
{
GC gc;
int blackColor,whiteColor;
Window w;
Display *dpy = XOpenDisplay(NIL);
blackColor = BlackPixel(dpy, DefaultScreen(dpy));
whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
w = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0,
200, 100, 0, blackColor, blackColor);
XSelectInput(dpy, w, StructureNotifyMask);
XMapWindow(dpy, w);
gc = XCreateGC(dpy, w, 0, NIL);// Create a Graphics Context
XSetForeground(dpy, gc, whiteColor);
for(;;) {
XEvent e;
XNextEvent(dpy, &e);
if (e.type == MapNotify)
break;
}
XDrawLine(dpy, w, gc, 10, 60, 180, 20);
XFlush(dpy);
sleep(10);
}
-----------------------------------------------------------------
Here are the errors:
/tmp/cckio3Hm.o: In function `main':
/tmp/cckio3Hm.o(.text+0x14): undefined reference to `XOpenDisplay'
/tmp/cckio3Hm.o(.text+0xf8): undefined reference to `XCreateSimpleWindow'
/tmp/cckio3Hm.o(.text+0x110): undefined reference to `XSelectInput'
/tmp/cckio3Hm.o(.text+0x11c): undefined reference to `XMapWindow'
/tmp/cckio3Hm.o(.text+0x130): undefined reference to `XCreateGC'
/tmp/cckio3Hm.o(.text+0x148): undefined reference to `XSetForeground'
/tmp/cckio3Hm.o(.text+0x158): undefined reference to `XNextEvent'
/tmp/cckio3Hm.o(.text+0x1a4): undefined reference to `XDrawLine'
/tmp/cckio3Hm.o(.text+0x1ac): undefined reference to `XFlush'
collect2: ld returned 1 exit status
make: *** [wer] Error 1
The arm gcc cross compiler supplied by Embest searches the
/usr/local/arm/2.95.3/.../inlcude directory for include files. But there was no
Xlib.h in that path. So I used the -I option to force it to look at
/usr/local/include where I have an Xlib from a desktop GTK+ installation. Of
course I can't use the desktop libraries as well since my target is ARM and the
desktop libraries are for a Pentium. So where should I look in my ARM files for
a library that will satisfy the linker errors?
Robert Scott
Ypsilanti, Michigan
1. you have to add -L in addition to -I. This instructs the linker to
search for additional library.
2. I think you have to compile the full X sources (from X.org) using
your cross compiler to get libraries that match your ARM system. You
*could* successfully take libX11.so etc. from e.g. the Sharp Zaurus
but probability is low that it matches all other dependencies. Or, you
can look at Open Embedded.
-- hns
.
- Prev by Date: Re: NFS trouble?
- Next by Date: Re: Missing Xlib for ARM board
- Previous by thread: question on Ethernet Devicedriver
- Next by thread: Re: Missing Xlib for ARM board
- Index(es):
Relevant Pages
|