Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 509458 - sci-mathematics/Macaulay2-1.6 fails to build with boehm-gc-7.4
Summary: sci-mathematics/Macaulay2-1.6 fails to build with boehm-gc-7.4
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Kahle (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-03 12:41 UTC by Martin von Gagern
Modified: 2014-05-25 17:17 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (sci-mathematics:Macaulay2-1.6.emerge--info,6.67 KB, text/plain)
2014-05-03 12:41 UTC, Martin von Gagern
Details
Simple fix (gentoo509458a.patch,1.27 KB, patch)
2014-05-03 15:52 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2014-05-03 12:41:35 UTC
Created attachment 376276 [details]
emerge --info

make[2]: Entering directory '/var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/libraries/gc'
/usr/bin/install -c -d /var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/BUILD/tarfiles
error: for the third-party library or program source "gc"
       the source code is not present in the file "/var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/BUILD/tarfiles/gc-7.2d.tar.gz"
       so either download a "fat" tar file of the Macaulay2 source code
       or rerun the Macaulay2 "configure" command with the added option "--enable-download"
       to enable automatic downloading of the source code over the internet
../Makefile.library:168: recipe for target '/var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/BUILD/tarfiles/gc-7.2d.tar.gz' failed
make[2]: *** [/var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/BUILD/tarfiles/gc-7.2d.tar.gz] Error 1
make[2]: Leaving directory '/var/tmp/portage/sci-mathematics/Macaulay2-1.6/work/M2-release-1.6-stable-20130514/M2/libraries/gc'
Makefile:7: recipe for target 'fetch-in-gc' failed
make[1]: *** [fetch-in-gc] Error 2

Earlier, from configure:

checking for library containing GC_free... -lgc
checking gc/gc.h usability... yes
checking gc/gc.h presence... yes
checking for gc/gc.h... yes
checking atomic_ops.h usability... yes
checking atomic_ops.h presence... yes
checking for atomic_ops.h... yes
checking whether libgc is recent enough... no, version at least 7.2 is required (gc will be built from downloaded sources)

I have dev-libs/boehm-gc-7.4.0 installed, so there is something wrong with the autodetection in configure. Looking at the config.log:

configure:9685: checking whether libgc is recent enough
configure:9706: x86_64-pc-linux-gnu-gcc -o conftest -march=amdfam10 -ggdb -pipe -O0  -I/usr/include/frobby -DNDEBUG -Wl,--as-needed conftest.c -lgc -lmpfr -lfrobby -lpari -lmpirxx -lmpir -lreadline -lncurses -lpthread -ldl -L/usr/lib64/blas/reference -llapack -lblas  >&5
[…]/temp/ccad0k5A.o: In function `main':
[…]/M2/conftest.c:105: undefined reference to `GC_version'
[…]/M2/conftest.c:106: undefined reference to `GC_version'
[…]/M2/conftest.c:107: undefined reference to `GC_version'
collect2: error: ld returned 1 exit status
configure:9706: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
[…]
| 
| #include <stdio.h>
| main () {
|     extern unsigned GC_version;
|     FILE *msg = fdopen(6,"w");
|     unsigned major, minor, alpha;
|     major = GC_version >> 16;
|     minor = (GC_version >> 8) & 0xff;
|     alpha = GC_version & 0xff;
|     if (alpha == 0xff) fprintf(msg,"(version %d.%d found) ", major, minor);
|     else fprintf(msg,"(version %d.%d alpha %d found) ", major, minor, alpha);
|     return !( major > 7 || major == 7 && minor >= 2); }
configure:9710: result: no, version at least 7.2 is required (gc will be built from downloaded sources)

Looking at objdump -T /usr/lib/libgc.so, it seems that global variable might now be replaced by a function called GC_get_version.
https://github.com/ivmai/bdwgc/commit/40a9f147990ed4668870100c897a8ded4754ba1f from 2009 introduces the function (since gc 7.2 alpha 4), while 
https://github.com/ivmai/bdwgc/commit/d6f15183b4064af11ce78cbf8a55edb04ad4a672 makes symbols like GC_version hidden by default (since 7.3 alpha 2).

I guess the Macaulay configure script should be modified to use GC_get_version.
Comment 1 Martin von Gagern 2014-05-03 13:18:25 UTC
Reported upstream at https://github.com/Macaulay2/M2/issues/130
Comment 2 Thomas Kahle (RETIRED) gentoo-dev 2014-05-03 15:26:34 UTC
Thanks for reporting it upstream.  I'm changing the title because it was misleading.  We try to use as few bundled libraries as possible.
Comment 3 Martin von Gagern 2014-05-03 15:52:45 UTC
Created attachment 376302 [details, diff]
Simple fix

This patch is a kind of mixed approach fix: it uses preprocessor macros instead of data from the library, but it still runs the conftest program, instead of checking the condition at compile time. I'm not sure I'd code it that way for upstream, but for now, this fixes the issue and allows me to actually emerge the package.
Comment 4 Thomas Kahle (RETIRED) gentoo-dev 2014-05-03 15:54:39 UTC
OK, thanks.
I'll wait a few days before I commit this, to see if Dan Grayson has any opinion on this.  Macaulay2 has been very sensitive to switching boehm-gc versions in the past.
Comment 5 Thomas Kahle (RETIRED) gentoo-dev 2014-05-07 20:48:09 UTC
The problem with this patch is that it breaks gc detection with earlier versions.  Is there any mechanism that works for both?
Comment 6 Daniel R. Grayson 2014-05-25 15:30:29 UTC
I wouldn't mind applying the suggested patch upstream, but it might be slightly better not to.  The code in gc-7.4.0's file alloc.c that defines GC_version is this:

#ifndef GC_NO_VERSION_VAR
  const unsigned GC_version = ((GC_VERSION_MAJOR << 16) |
                        (GC_VERSION_MINOR << 8) | GC_VERSION_MICRO);
#endif

I've verified that Macaulay2's current gc presence test works with gc 7.4.0, as the symbol GC_version still gets defined.

The string GC_NO_VERSION_VAR appears nowhere else, so the code is always compiled.  Did the gentoo developers decide to define that macro variable when building gc?  If so, why not revert that instead, for backward compatibility?
Comment 7 Thomas Kahle (RETIRED) gentoo-dev 2014-05-25 16:05:48 UTC
(In reply to Daniel R. Grayson from comment #6)
> I wouldn't mind applying the suggested patch upstream, but it might be
> slightly better not to.  The code in gc-7.4.0's file alloc.c that defines
> GC_version is this:
> 
> #ifndef GC_NO_VERSION_VAR
>   const unsigned GC_version = ((GC_VERSION_MAJOR << 16) |
>                         (GC_VERSION_MINOR << 8) | GC_VERSION_MICRO);
> #endif
> 
> I've verified that Macaulay2's current gc presence test works with gc 7.4.0,
> as the symbol GC_version still gets defined.
> 
> The string GC_NO_VERSION_VAR appears nowhere else, so the code is always
> compiled.  Did the gentoo developers decide to define that macro variable
> when building gc?  If so, why not revert that instead, for backward
> compatibility?

Hmm, I don't understand what's going on.  As far as I can tell Gentoo's gc has not set GC_NO_VERSION_VAR and the header gc_version.h is present and included in gc.h.  From looking at it, this part of the code is also unchanged between 7.2 which is detected by M2's configure on Gentoo and 7.4 which is not detected.
Comment 8 Thomas Kahle (RETIRED) gentoo-dev 2014-05-25 16:12:20 UTC
(In reply to Thomas Kahle from comment #7)
> (In reply to Daniel R. Grayson from comment #6)
> > I wouldn't mind applying the suggested patch upstream, but it might be
> > slightly better not to.  The code in gc-7.4.0's file alloc.c that defines
> > GC_version is this:
> > 
> > #ifndef GC_NO_VERSION_VAR
> >   const unsigned GC_version = ((GC_VERSION_MAJOR << 16) |
> >                         (GC_VERSION_MINOR << 8) | GC_VERSION_MICRO);
> > #endif
> > 
> > I've verified that Macaulay2's current gc presence test works with gc 7.4.0,
> > as the symbol GC_version still gets defined.
> > 
> > The string GC_NO_VERSION_VAR appears nowhere else, so the code is always
> > compiled.  Did the gentoo developers decide to define that macro variable
> > when building gc?  If so, why not revert that instead, for backward
> > compatibility?
> 
> Hmm, I don't understand what's going on.  As far as I can tell Gentoo's gc
> has not set GC_NO_VERSION_VAR and the header gc_version.h is present and
> included in gc.h.  From looking at it, this part of the code is also
> unchanged between 7.2 which is detected by M2's configure on Gentoo and 7.4
> which is not detected.

Maybe one difference between your installation of gc and Gentoo's is --fvisibility-hidden when compiling gc ?
Comment 9 Daniel R. Grayson 2014-05-25 16:44:05 UTC
Good point: that visibility option kicks in for you but not
for me: I build gc with enable-static and disable-shared.  You
probably do the opposite, and the configure script of gc makes
the visibility conditional on those options.

I'll patch upstream as suggested.
Comment 10 Thomas Kahle (RETIRED) gentoo-dev 2014-05-25 16:48:51 UTC
Alright, thanks.
Comment 11 Daniel R. Grayson 2014-05-25 17:17:12 UTC
Applied upstream at https://github.com/Macaulay2/M2/commit/eca1bacffcd8bb6f12a0f4e539e8cc87edfc5b9e