This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Using a native newlib application with shared libraries


I'm porting an embedded application that uses newlib to Linux. On
Linux I'm compiling it against a native newlib shared library. I'm
simulating the LCD using Xlib. The Xlib shared library is native to my
system and is built against glibc.

Before I realised that I had pulled in two different libcs to the same
binary, it actually worked for weeks! Of course, once I realised what
I'd done this Schrödinbug presented itself, and now my application
crashes upon calling XFillRectangle. In fact, I believe the problem
presented itself once I started using malloc in my embedded
application. Xlib is using malloc from glibc and the duelling mallocs
beat each other to death.

I'd prefer to avoid recompiling Xlib for newlib. Can I coax the two
libcs to cohabitate peacefully, or is this just asking for trouble?

I've tried using LD_PRELOAD=/usr/lib/libc-newlib.so.0 to hopefully
coerce Xlib to use newlib's malloc instead of glib's malloc. Although
I believe this is sound, the program still crashes.

I've tried compiling the application statically, but Xlib is missing
references to a number of symbols that appear to be glibc specific,
such as __errno_location and _IO_getc.

Thanks in advance if you can supply any brilliance. Regards,
Shaun    (please cc me in your reply)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]