Re: Missing Xlib for ARM board



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
.



Relevant Pages

  • Re: Carrying Libraries on Your Back...
    ... > Why not build on an installed based of assemblies, ... > than porting libraries around, ... download source code ... compile local source against header files ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using Lattice ispLEVER with VHDL libraries
    ... I am assuming there are some advantages to using the IDE rather than ... I also can't see to get Modelsim to work with ispLever, ... You will have to read about the tool you use to specify compile ... user defined libraries to get things to go under ispLever. ...
    (comp.arch.fpga)
  • Re: hid.dll & VC++ 6
    ... but never to compile code based upon any current WDK. ... I'm tasked with writing an application to communicate with a USB card ... missing ')' before identifier 'HIDP_REPORT_TYPE' ... pointed it at the headers and libraries and it worked for a bit until i ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Getting started on the HP49g+
    ... either the original HP extable lib ... extable2 lib from http://www.hpcalc.org/details.php?id=3940. ... ask again if you have any problem installing libraries. ... compile the string with ASM (listed in the development lib menu, ...
    (comp.sys.hp48)
  • Re: <ctype.h> toLower()
    ... If it's a free standing implimentation, then the scope of the standard is ... > considering portability if makes a heck of a big difference.. ... the code you write will work on /any/ machine you compile it for (if ... the platforms provide the same libraries or even the same program entry ...
    (alt.comp.lang.learn.c-cpp)