Jason Schmidlapp | 1 Jul 2008 03:15
Picon

Linker errors about ctype


I'm working with Agar on the PSP platform.  I have the library building 
successfully, but am running into a problem when I try to link the
Agar library with a simple test application.  I get a number of errors
similar to the following:

/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libag_gui.a
  (keymap_ascii.o): In function `EmulateShiftUSKBD':
keymap_ascii.c:(.text+0x300): undefined reference to `__ctype_b_loc'
keymap_ascii.c:(.text+0x410): undefined reference to `__ctype_toupper_loc'

All of the errors relate to ctype - the other Agar symbols link OK.  Has 
anyone run into anything similar before?  The Agar library and the test 
app are being built with exactly the same toolchain and support 
libraries (clib, etc).

Thanks!

--Jason
Julien Nadeau | 4 Jul 2008 03:45
Favicon

Re: Linker errors about ctype

On Mon, Jun 30, 2008 at 01:19:05AM +0000, Jason Schmidlapp wrote:
> 
> I'm working with Agar on the PSP platform.  The library compiles OK, 
> but I get some errors when I go to link it with a simple test 
> application  of mine.  Here is an example of the errors I get:
> 
> usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib    
>      /libag_gui.a(keymap_ascii.o):
> In function `EmulateShiftUSKBD':
> keymap_ascii.c:(.text+0x300): undefined reference to 
>     `__ctype_b_loc'
> keymap_ascii.c:(.text+0x410): undefined reference to 
>     `__ctype_toupper_loc'
> 
> It also occurs in text.c and file_dlg.c
> 
> These are the only linker errors I get, so I'm assuming that the 
> other Agar API calls are being correctly linked.  My test app and 
> the Agar library are being built with the same version of the
> toolchain, same support libraries, etc. 
> 
> Any ideas?  I'm stumped...

Can you successfully compile and link a test program which uses some
ctype functions? Maybe it is a problem with libc. I think toupper(),
etc. is normally inline, but __ctype_b_loc is a global array which
should be defined in libc.
Jason Schmidlapp | 5 Jul 2008 15:38
Picon

Re: Linker errors about ctype

Julien Nadeau <vedge <at> ...> writes:

> 
> On Mon, Jun 30, 2008 at 01:19:05AM +0000, Jason Schmidlapp wrote:
> > 
> > I'm working with Agar on the PSP platform.  The library compiles OK, 
> > but I get some errors when I go to link it with a simple test 
> > application  of mine.  Here is an example of the errors I get:
> > 
> > usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib    
> >      /libag_gui.a(keymap_ascii.o):
> > In function `EmulateShiftUSKBD':
> > keymap_ascii.c:(.text+0x300): undefined reference to 
> >     `__ctype_b_loc'
> > keymap_ascii.c:(.text+0x410): undefined reference to 
> >     `__ctype_toupper_loc'
> > 
....
> 
> Can you successfully compile and link a test program which uses some
> ctype functions? Maybe it is a problem with libc. I think toupper(),
> etc. is normally inline, but __ctype_b_loc is a global array which
> should be defined in libc.
> 

I figured out the problem.  The ctype.h that was being included 
was NOT the one for my target (PSP) toolchain 
[/usr/local/pspdev/include/ctype.h], but rather my local host
 copy [/usr/include/ctype.h].

(Continue reading)

ADI64 | 20 Jul 2008 11:01

Agar seems to compile without OpenGL [win / msys]

Hey all,

I compiled the agar library under windows with msys ( --enable-threads
--with-freetype --with-gl ).
Configure checked for OpenGL32, found it and said it's working and compiled the
library.
In my project, I use parts of the glview.c example in a c++ project.
The code part is:

--------------------------------
AG_Window *gui;
AG_GLView *glv;
AG_HBox *hb;

....

gui = AG_WindowNew(AG_WINDOW_PLAIN);
hb = AG_HBoxNew(gui, AG_HBOX_EXPAND);
AG_LabelNewString(gui, 0, "Heyho, let's go");
// Create the AG_GLView widget.
glv = AG_GLViewNew(hb, AG_GLVIEW_EXPAND);
--------------------------------

Everything compiles and links fine, but the AG_GLViewNew function seems to make
problems.
The Error output is:

--------------------------------
||=== SDLtest, Debug ===|
obj\Debug\engine.o||In function `_ZN7TEngine14T3D_OpenWindowEiib':|
(Continue reading)

Julien Nadeau | 20 Jul 2008 11:28
Favicon

Re: Agar seems to compile without OpenGL [win / msys]


I doubt these linker errors are specific to OpenGL. You're also getting
an undefined reference to AG_WidgetParentWindow() which is a standard GUI
routine. It looks like your header files may be out of sync with the
installed libraries.

On Sun, Jul 20, 2008 at 09:01:55AM +0000, ADI64 wrote:
> Hey all,
> 
> I compiled the agar library under windows with msys ( --enable-threads
> --with-freetype --with-gl ).
> Configure checked for OpenGL32, found it and said it's working and compiled the
> library.
> In my project, I use parts of the glview.c example in a c++ project.
> The code part is:
> 
> --------------------------------
> AG_Window *gui;
> AG_GLView *glv;
> AG_HBox *hb;
> 
> .....
> 
> gui = AG_WindowNew(AG_WINDOW_PLAIN);
> hb = AG_HBoxNew(gui, AG_HBOX_EXPAND);
> AG_LabelNewString(gui, 0, "Heyho, let's go");
> // Create the AG_GLView widget.
> glv = AG_GLViewNew(hb, AG_GLVIEW_EXPAND);
> --------------------------------
> 
(Continue reading)

ADI64 | 20 Jul 2008 14:25

Re: Agar seems to compile without OpenGL [win / msys]

Julien Nadeau <vedge <at> ...> writes:

> 
> 
> I doubt these linker errors are specific to OpenGL. You're also getting
> an undefined reference to AG_WidgetParentWindow() which is a standard GUI
> routine. It looks like your header files may be out of sync with the
> installed libraries.
> 

Thanks for your fast reply!

How can I fix my headers if they are wrong?
I built agar like that:

../configure --enable-threads --with-freetype --with-gl
make depend
make
make install

and then I copied the include, lib and bin files from the msys\local\[include |
lib | bin] directory in my own directories used by GCC / CodeBlocks.

Is there anything I missed during the build process?
Or how can I check whether my includes are out of sync with the library?

Thanks for your help,
ADI64
Julien Nadeau | 20 Jul 2008 15:32
Favicon

Re: Agar seems to compile without OpenGL [win / msys]

On Sun, Jul 20, 2008 at 12:25:38PM +0000, ADI64 wrote:
> Julien Nadeau <vedge <at> ...> writes:
> 
> > 
> > 
> > I doubt these linker errors are specific to OpenGL. You're also getting
> > an undefined reference to AG_WidgetParentWindow() which is a standard GUI
> > routine. It looks like your header files may be out of sync with the
> > installed libraries.
> > 
> 
> Thanks for your fast reply!
> 
> How can I fix my headers if they are wrong?
> I built agar like that:
> 
> .../configure --enable-threads --with-freetype --with-gl
> make depend
> make
> make install
> 
> and then I copied the include, lib and bin files from the msys\local\[include |
> lib | bin] directory in my own directories used by GCC / CodeBlocks.
> 
> Is there anything I missed during the build process?
> Or how can I check whether my includes are out of sync with the library?

Couldn't you mount the directories used by GCC / CodeBlocks directly by
adding them to /etc/fstab? This way you don't have to bother copying files
over and keeping them in sync.
(Continue reading)

ADI64 | 21 Jul 2008 13:53

Re: Agar seems to compile without OpenGL [win / msys]

Julien Nadeau <vedge <at> ...> writes:

> 
> On Sun, Jul 20, 2008 at 12:25:38PM +0000, ADI64 wrote:
> > 
> > Thanks for your fast reply!
> > 
> > How can I fix my headers if they are wrong?
> > I built agar like that:
> > 
> > .../configure --enable-threads --with-freetype --with-gl
> > make depend
> > make
> > make install
> > 
> > and then I copied the include, lib and bin files from the
> > msys\local\[include | lib | bin] directory in my own directories
> > used by GCC / CodeBlocks.
> > 
> > Is there anything I missed during the build process?
> > Or how can I check whether my includes are out of sync with the library?
> 
> Couldn't you mount the directories used by GCC / CodeBlocks directly by
> adding them to /etc/fstab? This way you don't have to bother copying files
> over and keeping them in sync.
> 

Well as in the first post said I use windows and not linux.
My friend, who is developing this project with me, uses linux and it compiles,
links and works without problems at him.
(Continue reading)

Julien Nadeau | 21 Jul 2008 14:42
Favicon

Re: Agar seems to compile without OpenGL [win / msys]

On Mon, Jul 21, 2008 at 11:53:19AM +0000, ADI64 wrote:
> > On Sun, Jul 20, 2008 at 12:25:38PM +0000, ADI64 wrote:
> > > 
> > > Thanks for your fast reply!
> > > 
> > > How can I fix my headers if they are wrong?
> > > I built agar like that:
> > > 
> > > .../configure --enable-threads --with-freetype --with-gl
> > > make depend
> > > make
> > > make install
> > > 
> > > and then I copied the include, lib and bin files from the
> > > msys\local\[include | lib | bin] directory in my own directories
> > > used by GCC / CodeBlocks.
> > > 
> > > Is there anything I missed during the build process?
> > > Or how can I check whether my includes are out of sync with the library?
> > 
> > Couldn't you mount the directories used by GCC / CodeBlocks directly by
> > adding them to /etc/fstab? This way you don't have to bother copying files
> > over and keeping them in sync.
> > 
> 
> Well as in the first post said I use windows and not linux.

I meant the "/etc/fstab" inside msys. It allows you to add entries such that
arbitrary directories are mapped to specific locations in your msys tree,
saving you the trouble of copying files from your msys installation to your
(Continue reading)

ADI64 | 21 Jul 2008 19:52

Re: Agar seems to compile without OpenGL [win / msys]

Julien Nadeau <vedge <at> ...> writes:

> I meant the "/etc/fstab" inside msys. It allows you to add entries such that
> arbitrary directories are mapped to specific locations in your msys tree,
> saving you the trouble of copying files from your msys installation to your
> CodeBlocks directories.
> 
> [...]
> 
> I suggest you remove your currently installed Agar libs/include, recompile,
> and reinstall them.
> 

Yeah that combination did the trick!
Thanks very much for your help and your patience! :D

Gmane