cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

flint doesn't build in gentoo-prefix #52

Closed burcin closed 13 years ago

burcin commented 13 years ago

When building flint-1.5.2 in gentoo-prefix, we run into problems like this:

x86_64-pc-linux-gnu-gcc -fPIC -std=c99 -O2 -pipe -I/usr/include -c fmpz.c -o fmpz.o
In file included from fmpz.c:32:
fmpz.h:39:29: error: zn_poly/zn_poly.h: No such file or directory

because the include directories of the prefix are not searched. I suppose this has something to do with the way FLINT_CPP is set using:

    FLINT_CPP=$(tc-getCXX)
kiwifb commented 13 years ago

flint and genus2reduction used to build fine on prefix (linux-x86/amd64 and macos-x86/x64). From what I see the wrong compiler may be picked or possibly there is a dependency problem. I will investigate this further. I would like the following info:

burcin commented 13 years ago

zn_poly was installed. The host system is also gentoo amd64.

It looks like the CPPFLAGS are being ignore when FLINT picks a compiler. I was in a hurry so I took some shortcuts by putting sys-devel/gcc-4.4.5 in packages.provided. Could this be the problem?

I worked around the problem by changing the CFLAGS variable in make.conf to:

CFLAGS="-O2 -pipe ${CPPFLAGS}"

Here is emerge --info:

Portage 2.2.01.18213-prefix (prefix/linux/amd64, gcc-4.4.5, unavailable, 2.6.37-tuxonice x86_64)
=================================================================
System uname: Linux-2.6.37-tuxonice-x86_64-Intel-R-_Core-TM-_i7_CPU_Q_740_@_1.73GHz-with-gentoo-1.12.14
Timestamp of tree: Wed, 30 Mar 2011 21:39:03 +0000
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11-r2
dev-lang/python:     2.6.6-r2::sage-on-gentoo, 2.7.1-r1
sys-devel/autoconf:  2.13, 2.68
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.21.51.0.6
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:   2.4-r1
sys-devel/make:      3.82
Repositories: gentoo_prefix sage-on-gentoo preflocal
Installed sets: 
ACCEPT_KEYWORDS="~amd64-linux"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -I/home/burcin/sage/gentoo_prefix/usr/include"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/portage /etc/terminfo"
CPPFLAGS="-I/home/burcin/sage/gentoo_prefix/usr/include"
CXXFLAGS="-O2 -pipe -I/home/burcin/sage/gentoo_prefix/usr/include"
DISTDIR="/home/burcin/sage/gentoo_prefix/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks fixlafiles fixpackages parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-L/home/burcin/sage/gentoo_prefix/usr/lib -Wl,-rpath=/home/burcin/sage/gentoo_prefix/usr/lib -L/home/burcin/sage/gentoo_prefix/lib -Wl,-rpath=/home/burcin/sage/gentoo_prefix/lib"
MAKEOPTS="-j4"
PKGDIR="/home/burcin/sage/gentoo_prefix/usr/portage/packages"
PORTAGE_CONFIGROOT="/home/burcin/sage/gentoo_prefix/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/home/burcin/sage/gentoo_prefix/var/tmp"
PORTDIR="/home/burcin/sage/gentoo_prefix/usr/portage"
PORTDIR_OVERLAY="/home/burcin/sage/gentoo_prefix/var/lib/layman/sage-on-gentoo /home/burcin/sage/gentoo_prefix/var/portage/local"
SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"
USE="amd64 bootstrap bzip2 cli cracklib crypt cxx dri iconv ipv6 mmx modules mudflap ncurses nptl nptlonly openmp perl pppd prefix readline session sse sse2 sysfs tcpd unicode xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
kiwifb commented 13 years ago

gcc in package provided is definitely a problem. In prefix gcc is compiled with path to the prefix install hardcoded. By using gcc from the system your compiler doesn't see the prefix install.. You could probably try to add appropriate -I and -L to your C(XX)/LD/FLAGS and see if that works.

burcin commented 13 years ago

OK. It works when I install gcc in the prefix.

I needed to install several packages over Sage to test something (polymake, which depends on perl and a whole lot of other things which already have ebuilds) and I thought that gentoo prefix might be a quick solution to this problem. Having to install gcc, etc. is a deal breaker though.

Do you think it would be feasible to adapt the gentoo build system & prefix to replace the sage build system? Maybe we should move this discussion to gentoo-science?

kiwifb commented 13 years ago

Either in gentoo-science or sage-devel, although there will be some resistance on sage-devel. Note that currently "relocating" a prefix is a dark art.

cschwan commented 13 years ago

What do you exactly mean by "replacing the sage build system" ? Effectively, I think we already did that. Using the prefix mechanism one can (in theory) install Sage on nearly every unix/linux without working with SPKGs and having portage as a real package manager. Convincing the Sage developers to switch is another question, of course ;). In my opinion switching from SPKGs to ebuilds wouldnt be that much problematic (duck). In the end both are shell scripts and apply patches to unpacked tarballs from upstream.

On the downside, Prefix means that you have to install a self-consistent system, e.g. GCC which you mentioned (but I know there were discussions of shipping GCC in Sage). I have prepared a list containing a minimum number of packages that are needed for a prefix, see https://gist.github.com/913307# . These are 83 packages, including

Altogether, this prefix needs 1.6 Gigs.

burcin commented 13 years ago

I meant providing the necessary configuration options to avoid those packages that Sage doesn't already ship. This would involve

You're right that the sage-on-gentoo overlay does most of the work by providing ebuilds equivalent to the Sage packages. But there is a little more left to actually use this to distribute Sage, especially while keeping the size within reasonable limits.

cschwan commented 13 years ago

Thats an interesting idea!

Enabling parallel builds is simple and done on the prefix side by correctly setting MAKEOPTS="-jN" in make.conf.

There is a similar discussion I found on gentoo-alt: http://www.mail-archive.com/gentoo-alt@lists.gentoo.org/msg05560.html

kiwifb commented 13 years ago

We shouldn't continue the discussion here but at least its documented. Yes you can relocate a prefix on some platform (I am not sure you can easily on aix but we are not too concerned by that).

But I think if we want to replace the spkg system by ebuilds we could go some other ways.

The main difficulty becomes the bootstraping we need to get a working prefixed python in a seamless fashion.

There are other issues. The current overlay provides an alternate way of building sage already but it is not as lightweight as you'd like. Aside from that it is not as developer friendly as vanilla sage. You cannot apply a patch and do "sage -b". Effectively to apply a patch I change the ebuild and do the equivalent of "sage -ba". On the other hand upgrade always works :)