Re: gcc command works, GnuStep makefile fails
David Ayers <[email protected]>
| Newsgroups | gmane.comp.lib.gnustep.user |
|---|---|
| Message-ID | <[email protected]> |
Sergei Gnezdov wrote:
> The following command compiles a simple Hello world program (yes, I
> want to include mysql):
>
> gcc Source.m -lobjc -lpthread -lmysqlclient -lz -L/usr/local/lib/mysql
>
> The following GNUmakefile compiles the same file, but application
> crashes. It started to crash, when I added mysql to GNUmakefile:
>
> -----
> include ${GNUSTEP_MAKEFILES}/common.make
>
> ADDITIONAL_OBJCFLAGS= -Wno-import -Wall
>
> TOOL_NAME = app
> app_OBJC_FILES = Source.m
> app_INCLUDE_DIRS = -I/usr/local/include/mysql
> app_TOOL_LIBS = -lecgi -lmysqlclient -lz
> app_LIB_DIRS = -L/usr/local/lib/mysql
>
> include ${GNUSTEP_MAKEFILES}/tool.make
> -----
>
> Error message:
>
> Bus error (core dumped)
>
> Another problem is that I have no clue what kind of command line
> GNUmakefile generates.
I had a similar crash with mysqlclient. My problem was, that libobjc
and libmysqlclient both export hash_next functions and the libobjc was
calling into the mysql version during class initialization. You could
either "work around" this by ordering the linked libraries in way that
happens to work (I don't know whether this can be done with
gnustep-make) or you can try creating another C wrapper library for
mysqlclient and avoid linking -lobjc and -lmysqlclient in the same
executable which seems to work around the issue for us currently.
GCC 4.0 will call new objc_ prefixed hash functions but even 4.1 will
probably still have the original version for binary compatibility, so
you still run the risk that the mysqlclient may call into the objc
version :-/.
If you have the possibility of building your own libobjc then you could
apply similar patches and remove the non-prefixed versions.
For more information see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19024
Cheers,
David Ayers