gnupic: Compilation problems


Previous by date: 10 Mar 2009 08:08:00 -0000 Re: New release, David Barnett
Next by date: 10 Mar 2009 08:08:00 -0000 Establish Business Relationship, jeffrey
Previous in thread:
Next in thread:

Subject: Compilation problems
From: Marko Kohtala ####@####.####
Date: 10 Mar 2009 08:08:00 -0000
Message-Id: <9cfa10eb0903100106h14e16e7aueccaeec49d828f71@mail.gmail.com>

Hi all.

Would it be ok to commit some compilation fixes before release?

I tried to cross-compile with mingw and it ran into problems.

The problem is that the the autoconf file configure.ac has these
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC

but autoconf expects to have replacement functions if it can not find
these to work. In cross compilation it can not test these, so it tries
to use the replacement. Since we do not have the replacement rpl_
functions compilation fails with unresolved symbols at link time.

I've been looking at how to best fix this among these candidates:
- Adding a new lib/libcompat.a
- Adding to libiberty
- Removing the AC_FUNC_ macros from configure.ac
- Using gnulib

Currently I'm leaning towards adding a lib directory where a
libcompat.a is built for these replacement functions. I have some
simple functions already written.

I did not find rpl_malloc and rpl_realloc in libiberty so adding them
there would make it not conform to libiberty in gcc contrary to
request in libiberty/README. Also I feel uncertain about them because
they do not seem to integrate seamlessly with autoconf. memcmp and
alloca included unconditionally header that configure thinks may be
missing.

AC_FUNC_ALLOCA I removed because I did not find alloca() used anywhere.

AC_FUNC_MALLOC should not be removed unless we are sure we do not use
this pattern (from gplink/map.c):
  section_list = malloc(sizeof(gp_section_type *) * state.object->num_sections);
  if (!section_list) {
    fprintf(stderr, "error: out of memory\n");

On some hosts if num_sections is zero, malloc returns NULL and this
will think the allocation failed. (I did not find any place where
something really broke because of this, but I think it better be safe
than sorry.)

gnulib has lots of these replacement functions, but I found they
require adding quite a lot of other supporting stuff like m4 macros,
which seem overkill to me. Besides I'm not familiar enough with them
to know I've used them properly.

Now, if anyone read this far and has some insight to share, I'm interested.

Marko

Previous by date: 10 Mar 2009 08:08:00 -0000 Re: New release, David Barnett
Next by date: 10 Mar 2009 08:08:00 -0000 Establish Business Relationship, jeffrey
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.