problem building 5.4.1 on macosx 10.8.2

90 views
Skip to first unread message

Greg Minshall

unread,
Dec 13, 2012, 10:08:22 AM12/13/12
to sage-s...@googlegroups.com
hi. the build fails compiling PARI/GP. it looks (see log bits below)
as if gcc isn't obeying its -I flags, since readline/readline.h appears
to be coming from /usr/include rather than from sage's local/include.

this is gcc 4.2 (llvm-based):
----
bash greg-minshalls-mbp: {500} gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
...
bash greg-minshalls-mbp: {1123} xcodebuild -version
Xcode 4.5.2
Build version 4G2008a
----

i'm fink-based, but moved /sw, /usr/local, (and my own ~/usr) out of the
way prior to building.

any suggestions?

cheers, Greg Minshall
----
gcc -c -I. -I../src/headers -I../src/language -I/Users/minshall/src/import/sage/sage-5.4.1/local/include -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -g -o gp_rl.o ../src/gp/gp_rl.c
../src/gp/gp_rl.c: In function 'change_state':
../src/gp/gp_rl.c:115:3: warning: implicit declaration of function 'rl_save_prompt' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c:116:3: warning: implicit declaration of function 'rl_message' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c:118:3: warning: implicit declaration of function 'rl_restore_prompt' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c:119:3: warning: implicit declaration of function 'rl_clear_message' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c: In function 'pari_rl_complete':
../src/gp/gp_rl.c:133:3: warning: implicit declaration of function 'rl_begin_undo_group' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c:139:3: warning: implicit declaration of function 'rl_end_undo_group' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c: In function 'pari_rl_forward_sexp':
../src/gp/gp_rl.c:260:7: warning: implicit declaration of function 'rl_ding' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c: In function 'rl_print_aide':
../src/gp/gp_rl.c:537:3: warning: implicit declaration of function 'rl_refresh_line' [-Wimplicit-function-declaration]
../src/gp/gp_rl.c: In function 'pari_completion':
../src/gp/gp_rl.c:584:16: error: 'rl_username_completion_function' undeclared (first use in this function)
../src/gp/gp_rl.c:584:16: note: each undeclared identifier is reported only once for each function it appears in
../src/gp/gp_rl.c: In function 'init_readline':
../src/gp/gp_rl.c:724:39: error: 'rl_completion_func_t' undeclared (first use in this function)
../src/gp/gp_rl.c:724:60: error: expected expression before ')' token
../src/gp/gp_rl.c:755:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c:756:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c:762:3: error: 'vi_movement_keymap' undeclared (first use in this function)
../src/gp/gp_rl.c:773:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c:774:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c:775:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c:776:3: warning: passing argument 2 of 'rl_bind_key_in_map' from incompatible pointer type [enabled by default]
/usr/include/readline/readline.h:214:7: note: expected 'int (*)(int, int)' but argument is of type 'int (*)(const char *, int)'
../src/gp/gp_rl.c: In function 'gp_add_history':
../src/gp/gp_rl.c:913:3: warning: implicit declaration of function 'append_history' [-Wimplicit-function-declaration]

Greg Minshall

unread,
Dec 13, 2012, 1:39:15 PM12/13/12
to sage-s...@googlegroups.com
i still don't know what causes this problem.  but, i created a new user on my machine with a very bland environment, and ran the build from there.  while the build is not yet finished, PARI/GP built just fine.

(as i said, i *did* move fink, etc., out of the way, but the build still failed.  so, something else in my environment, perhaps -- though they shouldn't -- C_INCLUDE_PATH or CPLUS_INCLUDE_PATH were being searched before the -I<dir>s.)

Justin C. Walker

unread,
Dec 13, 2012, 5:02:59 PM12/13/12
to sage-s...@googlegroups.com
Hi, Greg,

On Dec 13, 2012, at 10:39 , Greg Minshall wrote:

> i still don't know what causes this problem. but, i created a new user on
> my machine with a very bland environment, and ran the build from there.
> while the build is not yet finished, PARI/GP built just fine.

Everything in the compile line looks fine, so something in your environment...

> (as i said, i *did* move fink, etc., out of the way, but the build still
> failed. so, something else in my environment, perhaps -- though they
> shouldn't -- C_INCLUDE_PATH or CPLUS_INCLUDE_PATH were being searched
> before the -I<dir>s.)

may be getting in the way. In addition to making your PATH "plain vanilla", you might try nullifying a few of those _PATH variables.

I don't know that this problem has been seen before, but let us know if that clears it up with your login.

What apps use the above variables?

Thanks,

Justin

PS: on my 10.8.2 system, I have the "stock" readline includes in place, and they did not cause a problem with the build.

--
Justin C. Walker, Curmudgeon at Large
Director
Institute for the Enhancement of the Director's Income
-----------
Nobody knows the trouble I've been
-----------



Jeroen Demeyer

unread,
Dec 14, 2012, 2:45:15 AM12/14/12
to sage-s...@googlegroups.com
On 2012-12-13 22:08, Greg Minshall wrote:
> hi. the build fails compiling PARI/GP. it looks (see log bits below)
> as if gcc isn't obeying its -I flags, since readline/readline.h appears
> to be coming from /usr/include rather than from sage's local/include.

Could you list your environment variables within Sage?

Start a Sage shell:
$ ./sage --sh

And now ask for all environment variables:
$ env

Greg Minshall

unread,
Dec 14, 2012, 9:17:15 AM12/14/12
to sage-s...@googlegroups.com
Jeroen Demeyer <jdem...@cage.ugent.be> writes:
> Could you list your environment variables within Sage?

Script started on Fri Dec 14 09:12:28 2012
bash greg-minshalls-mbp: {500} ./sage -sh

Starting subshell with Sage environment variables set. Don't forget
to exit when you are done. Beware:
* Do not do anything with other copies of Sage on your system.
* Do not use this for installing Sage packages using "sage -i" or for
running "make" at Sage's root directory. These should be done
outside the Sage shell.

Bypassing shell configuration files...

Note: SAGE_ROOT=/Users/minshall/src/import/sage/binaries/sage-5.4.1
(sage-sh)minshall@greg-minshalls-mbp:sage-5.4.1$ env
CPLUS_INCLUDE_PATH=/Users/minshall/usr/lib:/usr/local/include:/sw/include:/usr/include:/usr/X11R6/include
AS=as
MANPATH=/Users/minshall/usr/emacs/share/man:/Users/minshall/usr/man:/usr/local/man:/usr/local/share/man:/usr/local/nmh/share/man:/sw/share/man:/usr/share/man:/usr/X11/man:/usr/X11/share/man:/usr/X11R6/man:/usr/X11R6/share/man:/usr/man:/usr/pkg/man
LDFLAGS=-L/usr/local/lib -L/sw/lib -L/usr/X11R6/lib
AR=ar
SAGE_LOGS=/Users/minshall/src/import/sage/binaries/sage-5.4.1/spkg/logs
TERM_PROGRAM=Apple_Terminal
RHOME=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/R
GNUPLOT_DEFAULT_GDFONT=Arial
XDG_DATA_HOME=/Users/minshall/.local/share
UNAME=Darwin
ECLDIR=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/ecl/
SHELL=/bin/bash
TERM=xterm-r6
SAGE_SERVER=http://www.sagemath.org/
SAGE_ORIG_LD_LIBRARY_PATH_SET=True
OBJC=/usr/bin/cc
OBJCXX=/usr/bin/c++
SAGE_DATA=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share
TMPDIR=/var/folders/qc/gxydc5q150qbr2mndftfyrmw0000gn/T/
SAGE_ENV_SOURCED=2
HGENCODING=utf8
Apple_PubSub_Socket_Render=/tmp/launch-hXQNyX/Render
PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin
LIBRARY_PATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib
MKDIR=mkdir
TERM_PROGRAM_VERSION=309
GS_LIB=/usr/local1/lib/ghostscript
CVSROOT=:ext:freebsd...@anoncvs.FreeBSD.org:/home/ncvs
WINDOWID=33554445
MORE=-ce
QTDIR=/sw/lib/qt3
TERM_SESSION_ID=A9F59889-B9C8-4E35-843A-3844F7E4B9AC
ac_cv_path_INTLTOOL_PERL=/usr/bin/perl
SAGE_NUM_THREADS=1
XAPPLRESDIR=/sw/etc/app-defaults/
DOT_SAGE=/Users/minshall/.sage/
XTERM_SHELL=/bin/bash
USER=minshall
SGML_CATALOG_FILES=/sw/etc/sgml/catalog
SINGULAR_EXECUTABLE=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/bin/Singular
LD_LIBRARY_PATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib:/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/R/lib
COMMAND_MODE=unix2003
GDFONTPATH=/Library/Fonts
GDK_USE_XFT=1
fspl=(frame :number 0 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 0 :dedicated 0),
HGPLAIN=yes
SAGE_ORIG_DYLD_LIBRARY_PATH_SET=True
SSH_AUTH_SOCK=/tmp/launch-6bXNpm/Listeners
PPASCL_IGNORE=CLKP. is at X state. Cell corrupted.|.CLK is at X state. Cell corrupted.|RDWRT is at X state.|Vera: Loading|Vera Loader: Extending code size|Vera Warning: Unused name
CPATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/include
Apple_Ubiquity_Message=/tmp/launch-xhI6an/Apple_Ubiquity_Message
__CF_USER_TEXT_ENCODING=0x1F5:0:0
SAGE_LOCAL=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local
MPLCONFIGDIR=/Users/minshall/.sage//matplotlib-1.1.0
MAXIMA_PREFIX=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local
CXXFLAGS=
PAGER=less
WORKON_HOME=/Users/minshall/.virtualenvs
XDG_CONFIG_DIRS=/sw/etc/xdg
SAGE_EXTCODE=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share/sage/ext
SAGE_STARTUP_FILE=/Users/minshall/.sage//init.sage
CPP=cpp
PATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/spkg/bin:/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/bin:/Users/minshall/usr/bin/bin-darwin-x86_64:/Users/minshall/usr/bin/bin-scripts:/usr/local/bin:/sw/bin:/sw/sbin:/bin:/usr/bin:/usr/X11/bin:/usr/X11R6/bin:/usr/games:/usr/ucb:/usr/local/nmh/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/nmh/lib
_=/usr/bin/env
XML_CATALOG_FILES=/sw/etc/xml/catalog
C_INCLUDE_PATH=/Users/minshall/usr/lib:/usr/local/include:/sw/include:/usr/include:/usr/X11R6/include
LD=ld
PWD=/Users/minshall/src/import/sage/binaries/sage-5.4.1
MV=mv
EDITOR=emacs
LANG=en_US.UTF-8
__sage__=
F95=gfortran
RATPOISON=ratpoison
wspc=10
SAGE_ROOT=/Users/minshall/src/import/sage/binaries/sage-5.4.1
PYTHONHOME=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local
SAGE_SHARE=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share
SAGE_PACKAGES=/Users/minshall/src/import/sage/binaries/sage-5.4.1/spkg
F77=gfortran
PS1=(sage-sh)\u@\h:\W$
CP=cp
wspl=8
fspl10=(frame :number 0 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 20971533 :last-access 707 :dedicated 0),
LN=ln
XTERM_LOCALE=en_US.UTF-8
XTERM_VERSION=XTerm(281)
CXX=g++
TEXINPUTS=:/sw/share/texmf-dist/tex:/Users/minshall/usr/share/texmf
HOME=/Users/minshall
SHLVL=7
XDG_CONFIG_HOME=/Users/minshall/.config
MAKE=make
DYLD_LIBRARY_PATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib:/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/R/lib::/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/R/lib
FC=gfortran
XDG_CACHE_HOME=/Users/minshall/.cache
LOGNAME=minshall
LESS=-c -e -i
PYTHONPATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/python
MACOSX_DEPLOYMENT_TARGET=10.8
SAGE_ORIG_LD_LIBRARY_PATH=
CVS_RSH=ssh
GPHELP=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/bin/gphelp
SAGE_ORIG_DYLD_LIBRARY_PATH=
DBUS_SESSION_BUS_ADDRESS=launchd:env=DBUS_FINK_SESSION_BUS_SOCKET
XDG_DATA_DIRS=/sw/share
fspl9=(frame :number 0 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 29360154 :last-access 712 :dedicated 0),
SOFFICE=/Users/minshall/soffice51
fspl8=(frame :number 0 :x 0 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 33554445 :last-access 735 :dedicated 0),(frame :number 1 :x 640 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 37748749 :last-access 734 :dedicated 0),
SAGE_DOC=/Users/minshall/src/import/sage/binaries/sage-5.4.1/devel/sage/doc
PKG_CONFIG_PATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/lib/pkgconfig
R_HOME=/sw/Library/Frameworks/R.framework/Resources
EXMHTMPDIR=/var/tmp
fspl7=(frame :number 0 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 732 :dedicated 0),
RANLIB=ranlib
INFOPATH=/usr/local/share/info:/sw/share/info:/usr/share/info:/Users/minshall/usr/share/info
fspl6=(frame :number 1 :x 0 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 375 :dedicated 0),(frame :number 0 :x 640 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 373 :dedicated 0),
DISPLAY=:0
XDG_RUNTIME_DIR=/var/folders/qc/gxydc5q150qbr2mndftfyrmw0000gn/C/
fspl5=(frame :number 1 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 25165837 :last-access 710 :dedicated 0),
SINGULARPATH=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share/singular
CC=gcc
fspl4=(frame :number 0 :x 0 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 453 :dedicated 0),(frame :number 1 :x 640 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 469 :dedicated 0),
CHMOD=chmod
SAGE_NUM_THREADS_PARALLEL=4
fspl3=(frame :number 0 :x 0 :y 0 :width 1280 :height 778 :screenw 1280 :screenh 778 :window 0 :last-access 4 :dedicated 0),
GP_DATA_DIR=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share/pari
SAGE_TESTDIR=/Users/minshall/.sage//tmp
fspl2=(frame :number 0 :x 0 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 14680077 :last-access 736 :dedicated 1),(frame :number 1 :x 640 :y 0 :width 640 :height 778 :screenw 1280 :screenh 778 :window 16777229 :last-access 12 :dedicated 1),
TOUCH=touch
fspl1=(frame :number 0 :x 0 :y 0 :width 1171 :height 778 :screenw 1280 :screenh 778 :window 10485786 :last-access 737 :dedicated 0),(frame :number 1 :x 1171 :y 0 :width 109 :height 778 :screenw 1280 :screenh 778 :window 10485889 :last-access 643 :dedicated 0),
GPDOCDIR=/Users/minshall/src/import/sage/binaries/sage-5.4.1/local/share/pari/doc
SAGE64=no
(sage-sh)minshall@greg-minshalls-mbp:sage-5.4.1$ exit
Exited Sage subshell.

Volker Braun

unread,
Dec 14, 2012, 9:56:27 AM12/14/12
to sage-s...@googlegroups.com
C_INCLUDE_PATH / CPLUS_INCLUDE_PATH are overriding the default gcc header search path. This is why compilation is failing. Did fink put in these system-wide environment variables? Thats seriously effed up.




Greg Minshall

unread,
Dec 14, 2012, 10:13:06 AM12/14/12
to sage-s...@googlegroups.com
Volker,

> C_INCLUDE_PATH / CPLUS_INCLUDE_PATH are overriding the default gcc header
> search path. This is why compilation is failing. Did fink put in these
> system-wide environment variables? Thats seriously effed up.

no, they come from my .bashrc. they've been "there" since 2008. sadly,
i no longer remember (nor documented) the reason they ended up there.

the gcc man page is a bit ambiguous:
----
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH

Each variable's value is a list of directories separated by a special
character, much like PATH, in which to look for header files. The
special character, "PATH_SEPARATOR", is target-dependent and
determined at GCC build time. For Microsoft Windows-based targets it
is a semicolon, and for almost all other targets it is a colon.

CPATH specifies a list of directories to be searched as if specified
with -I, but after any paths given with -I options on the command
line. This environment variable is used regardless of which language
is being preprocessed.

The remaining environment variables apply only when preprocessing the
particular language indicated. Each specifies a list of directories
to be searched as if specified with -isystem, but after any paths
given with -isystem options on the command line.
----
but i read (past and present tense) this as saying that C_INCLUDE_PATH
is searched *after* any -I<dir> statements on the command lines (in
which case, the -I<dir> statements Sage puts on the command line would
have had the local directories searched before these). do you know, are
they, in fact, search *before* the -I<dir>? that would certainly
explain it.

cheers, Greg

Volker Braun

unread,
Dec 14, 2012, 10:25:03 AM12/14/12
to sage-s...@googlegroups.com
No its first -I<dir>, then *_INCLUDE_PATH, then the path thats hard-wired into the compiler. But since Sage builds its own compiler you are effectively overriding the search path.

Greg Minshall

unread,
Dec 14, 2012, 2:58:35 PM12/14/12
to sage-s...@googlegroups.com
Volker,


No its first -I<dir>, then *_INCLUDE_PATH, then the path thats hard-wired into the compiler. But since Sage builds its own compiler you are effectively overriding the search path.

however, this doesn't explain the failure i was having, where

----
gcc  -c -I. -I../src/headers -I../src/language
-I/Users/minshall/src/import/sage/sage-5.4.1/local/include -O3 -Wall
-fno-strict-aliasing -fomit-frame-pointer  -g   -o gp_rl.o
../src/gp/gp_rl.c
----
(i.e., with -I<...>/sage-5.4.1/local/include is on the command line)
appears to have picked up the <readline/readline.h> from /usr/include,
rather than from <...>/sage-5.4.1/local/include.

or, am i missing something?  (maybe i don't understand your second sentence?)

Greg

Volker Braun

unread,
Dec 14, 2012, 3:56:21 PM12/14/12
to sage-s...@googlegroups.com
If the directory is already in the built-in search path (like /Users/minshall/src/import/sage/sage-5.4.1/local/include if you use the gcc that Sage compiled) then the -I option is ignored. 

-Idir
Add the directory dir to the head of the list of directories to be searched for header files. This can be used to override a system header file, substituting your own version, since these directories are searched before the system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files (use -isystem for that). If you use more than one -I option, the directories are scanned in left-to-right order; the standard system directories come after.
If a standard system include directory, or a directory specified with -isystem, is also specified with -I, the -I option will be ignored. The directory will still be searched but as a system directory at its normal position in the system include chain. This is to ensure that GCC's procedure to fix buggy system headers and the ordering for the include_next directive are not inadvertently changed. If you really need to change the search order for system directories, use the -nostdinc and/or -isystem options. 

Greg Minshall

unread,
Dec 14, 2012, 5:01:38 PM12/14/12
to sage-s...@googlegroups.com
Volker,

> If the directory is already in the built-in search path (like
> /Users/minshall/src/import/sage/sage-5.4.1/local/include if you use
> the gcc that Sage compiled) then the -I option is ignored.

ah! got it. so, the Sage-compiled gcc includes .../local/include as
"a standard system directory" (and, is also on the command line via
-I). that explains it.

thanks!

Greg
Reply all
Reply to author
Forward
0 new messages