How to compile perl with DEBUG_LEAKING_SCALARS? - perl
I am trying to install perl with -DDEBUG_LEAKING_SCALARS
perlbrew install perl-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS --as perl-debug-5.24.1
but without success:
$ perl -V | perl -MData::Dumper -e 'local $/; $_ = <>; $h{$1} = $2 while /(-(?:DDEBUGGING|DDEBUG_LEAKING_SCALARS))(?:=(.*?))?(?=\s|$)/g; print Dumper \%h'
$VAR1 = {
'-DDEBUGGING' => undef,
'-DDEBUG_LEAKING_SCALARS' => undef
};
kes#work ~/work/projects/github-forks/perl5 $ perl -V
Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
Platform:
osname=linux, osvers=4.4.0-57-generic, archname=x86_64-linux
uname='linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion='', gccversion='5.4.0 20160609', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.23'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
USE_PERLIO USE_PERL_ATOF
Locally applied patches:
Devel::PatchPerl 1.38
Built under linux
Compiled at Mar 9 2017 15:21:39
%ENV:
PERL5LIB="/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5"
PERLBREW="command perlbrew"
PERLBREW_BASHRC_VERSION="0.76"
PERLBREW_HOME="/home/kes/.perlbrew"
PERLBREW_LIB="debug"
PERLBREW_MANPATH="/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/man:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/man"
PERLBREW_PATH="/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/bin:/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin"
PERLBREW_PERL="perl-debug-5.24.1"
PERLBREW_ROOT="/home/kes/perl5/perlbrew"
PERLBREW_VERSION="0.76"
PERL_LOCAL_LIB_ROOT="/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug"
PERL_MB_OPT="--install_base /home/kes/.perlbrew/libs/perl-debug-5.24.1#debug"
PERL_MM_OPT="INSTALL_BASE=/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug"
#INC:
/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5/x86_64-linux
/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5
/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux
/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1
/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux
/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1
.
Also this show that perl is not compiled with required option:
$ perl -MConfig::Perl::V -MDDP -E 'p %{ Config::Perl::V::myconfig() }'
{
build {
options {
DEBUGGING 1,
DEBUG_LEAKING_SCALARS 0,
DEBUG_LEAKING_SCALARS_FORK_DUMP 0,
DECCRTL_SOCKETS 0,
FAKE_THREADS 0,
FCRYPT 0,
HAS_TIMES 1,
HAVE_INTERP_INTERN 0,
MULTIPLICITY 0,
MYMALLOC 0,
NO_HASH_SEED 0,
NO_MATHOMS 0,
NO_TAINT_SUPPORT 0,
PERL_BOOL_AS_CHAR 0,
PERL_COPY_ON_WRITE 1,
PERL_DEBUG_READONLY_COW 0,
PERL_DEBUG_READONLY_OPS 0,
PERL_DISABLE_PMC 0,
PERL_DONT_CREATE_GVSV 1,
PERL_EXTERNAL_GLOB 0,
PERL_GLOBAL_STRUCT 0,
PERL_GLOBAL_STRUCT_PRIVATE 0,
PERL_HASH_FUNC_DJB2 0,
PERL_HASH_FUNC_MURMUR3 0,
PERL_HASH_FUNC_ONE_AT_A_TIME 0,
PERL_HASH_FUNC_ONE_AT_A_TIME_HARD 1,
PERL_HASH_FUNC_ONE_AT_A_TIME_OLD 0,
PERL_HASH_FUNC_SDBM 0,
PERL_HASH_FUNC_SIPHASH 0,
PERL_HASH_FUNC_SUPERFAST 0,
PERL_IMPLICIT_CONTEXT 0,
PERL_IMPLICIT_SYS 0,
PERLIO_LAYERS 1,
PERL_IS_MINIPERL 0,
PERL_MAD 0,
PERL_MALLOC_WRAP 1,
PERL_MEM_LOG 0,
PERL_MEM_LOG_ENV 0,
PERL_MEM_LOG_ENV_FD 0,
PERL_MEM_LOG_NOIMPL 0,
PERL_MEM_LOG_STDERR 0,
PERL_MEM_LOG_TIMESTAMP 0,
PERL_MICRO 0,
PERL_NEED_APPCTX 0,
PERL_NEED_TIMESBASE 0,
PERL_NEW_COPY_ON_WRITE 0,
PERL_OLD_COPY_ON_WRITE 0,
PERL_PERTURB_KEYS_DETERMINISTIC 0,
PERL_PERTURB_KEYS_DISABLED 0,
PERL_PERTURB_KEYS_RANDOM 0,
PERL_POISON 0,
PERL_PRESERVE_IVUV 1,
PERL_RELOCATABLE_INCPUSH 0,
PERL_SAWAMPERSAND 0,
PERL_TRACK_MEMPOOL 0,
PERL_USE_DEVEL 0,
PERL_USE_SAFE_PUTENV 0,
PERL_USES_PL_PIDSTATUS 0,
PL_OP_SLAB_ALLOC 0,
THREADS_HAVE_PIDS 0,
UNLINK_ALL_VERSIONS 0,
USE_ATTRIBUTES_FOR_PERLIO 0,
USE_FAST_STDIO 0,
USE_HASH_SEED_EXPLICIT 0,
USE_IEEE 0,
USE_ITHREADS 0,
USE_LARGE_FILES 1,
USE_LOCALE 1,
USE_LOCALE_COLLATE 1,
USE_LOCALE_CTYPE 1,
USE_LOCALE_NUMERIC 1,
USE_LOCALE_TIME 1,
USE_LONG_DOUBLE 0,
USE_NO_REGISTRY 0,
USE_PERL_ATOF 1,
USE_PERLIO 1,
USE_QUADMATH 0,
USE_REENTRANT_API 0,
USE_SFIO 0,
USE_SITECUSTOMIZE 0,
USE_SOCKS 0,
USE_64_BIT_ALL 1,
USE_64_BIT_INT 1,
VMS_DO_SOCKETS 0,
VMS_SHORTEN_LONG_SYMBOLS 0,
VMS_SYMBOL_CASE_AS_IS 0
},
osname "linux",
patches [
[0] "Devel::PatchPerl 1.38"
],
stamp "Mar 9 2017 15:21:39"
},
config {
alignbytes 8,
api_subversion 0,
api_version 24,
api_versionstring "5.24.0",
archlibexp "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux",
archname "x86_64-linux",
bincompat5005 undef,
byteorder 12345678,
cc "cc",
cccdlflags "-fPIC",
ccdlflags "-Wl,-E",
ccflags "-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
ccversion "",
config_args "-de -Dprefix=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1 -DDEBUGGING -DDEBUG_LEAKING_SCALARS -Aeval:scriptdir=/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
cppflags "-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include",
d_dlsymun undef,
dlext "so",
d_longdbl "define",
d_longlong "define",
dlsrc "dl_dlopen.xs",
dont_use_nlink undef,
doublesize 8,
d_readlink "define",
d_sfio undef,
d_sigaction "define",
d_symlink "define",
exe_ext "",
gccosandvers "",
gccversion "5.4.0 20160609",
git_branch "",
git_commit_id "",
git_commit_id_title "",
git_describe "",
git_snapshot_date undef,
git_uncommitted_changes "",
gnulibc_version 2.23,
hint "recommended",
inc_version_list " ",
intsize 4,
ivsize 8,
ivtype "long",
ld "cc",
lddlflags "-shared -O2 -g -L/usr/local/lib -fstack-protector-strong",
ldflags " -fstack-protector-strong -L/usr/local/lib",
ldlibpthname "LD_LIBRARY_PATH",
libc "libc-2.23.so",
libperl "libperl.a",
libpth "/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64",
libs "-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc",
longdblsize 16,
longlongsize 8,
longsize 8,
lseeksize 8,
lseektype "off_t",
myuname "linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux ",
nvsize 8,
nvtype "double",
optimize "-O2 -g",
osname "linux",
osvers "4.4.0-57-generic",
package "perl5",
patchlevel 24,
path_sep ":",
perllibs "-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc",
perl_patchlevel "",
privlibexp "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1",
prototype "define",
ptrsize 8,
revision 5,
scriptdir "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
sitearchexp "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux",
sitelibexp "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1",
so "so",
subversion 1,
useithreads undef,
uselargefiles "define",
uselongdouble undef,
usemultiplicity undef,
usemymalloc "n",
useperlio "define",
useposix "true",
useshrplib "false",
usesocks undef,
usevendorprefix undef,
use64bitall "define",
use64bitint "define",
version "5.24.1",
version_patchlevel_string "version 24 subversion 1"
},
derived {
Off_t "off_t",
patch "",
uname "linux work 4.4.0-57-generic #78-ubuntu smp fri dec 9 23:50:32 utc 2016 x86_64 x86_64 x86_64 gnulinux "
},
environment {
PERLBREW "command perlbrew",
PERLBREW_BASHRC_VERSION 0.76,
PERLBREW_HOME "/home/kes/.perlbrew",
PERLBREW_LIB "debug",
PERLBREW_MANPATH "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/man:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/man",
PERLBREW_PATH "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/bin:/home/kes/perl5/perlbrew/bin:/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/bin",
PERLBREW_PERL "perl-debug-5.24.1",
PERLBREW_ROOT "/home/kes/perl5/perlbrew",
PERLBREW_VERSION 0.76,
PERL_LOCAL_LIB_ROOT "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug",
PERL_MB_OPT "--install_base /home/kes/.perlbrew/libs/perl-debug-5.24.1#debug",
PERL_MM_OPT "INSTALL_BASE=/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug",
PERL5LIB "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5"
},
inc [
[0] "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5/x86_64-linux",
[1] "/home/kes/.perlbrew/libs/perl-debug-5.24.1#debug/lib/perl5",
[2] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1/x86_64-linux",
[3] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/site_perl/5.24.1",
[4] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1/x86_64-linux",
[5] "/home/kes/perl5/perlbrew/perls/perl-debug-5.24.1/lib/5.24.1",
[6] "."
]
}
How to compile perl with DEBUG_LEAKING_SCALARS?
The doc has error. To compile perl with this option on you should use next command:
perlbrew install perl-5.24.1 -DDEBUGGING -Accflags=-DDEBUG_LEAKING_SCALARS -j9 --as perl-debug-5.24.1
I have found this info from this commit
UPD
DOC was fixed at commit #b49862865 by David Mitchell. Thanks
Related
How to install Perl-5.8.9 on Ubuntu
I have a legacy Perl 5.8.9 project which I need to run in a docker environment. Since I new it worked on Ubuntu I tried compiling it on an Ubuntu 16.1 and FROM ubuntu RUN apt-get update \ && apt-get install -y curl \ && apt-get install -y wget \ && apt-get install -y perlbrew NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)" Images since I couldn't find the version on perlbrew, I tried compiling from perl-5.8.9.tar.bz2 which I downloaded Compilation failed having something to do with miniperl. perlio.c:515:2: note: in expansion of macro 'PerlLIO_write' PerlLIO_write(dbg, s, len); ^~~~~~~~~~~~~ perlio.c: In function 'PerlIO_parse_layers': perlio.c:995:11: warning: this statement may fall through [-Wimplicit- fallthrough=] if (*e++) { ^ perlio.c:1001:4: note: here case '\0': ^~~~ In file included from perl.h:3169:0, from perlio.c:57: perlio.c: In function 'S_more_refcounted_fds': iperlsys.h:762:39: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result] #define PerlLIO_write(fd, buf, count) write((fd), (buf), (count)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ perlio.c:2307:2: note: in expansion of macro 'PerlLIO_write' PerlLIO_write(PerlIO_fileno(Perl_error_log), ^~~~~~~~~~~~~ `sh cflags "optimize='-O2'" perlapi.o` perlapi.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -DPERL_GCC_PEDANTIC `sh cflags "optimize='-O2'" numeric.o` numeric.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC `sh cflags "optimize='-O2'" mathoms.o` mathoms.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC `sh cflags "optimize='-O2'" locale.o` locale.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC `sh cflags "optimize='-O2'" pp_pack.o` pp_pack.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC pp_pack.c: In function 'S_pack_rec': pp_pack.c:2716:7: warning: variable 'was_utf8' set but not used [- Wunused-but-set-variable] U32 was_utf8; ^~~~~~~~ `sh cflags "optimize='-O2'" pp_sort.o` pp_sort.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe - I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC `sh cflags "optimize='-O2'" opmini.o` -DPERL_EXTERNAL_GLOB opmini.c CCCMD = cc -DPERL_CORE -c -fno-strict-aliasing -pipe -vI/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -std=c89 - O2 -Wall -ansi -pedantic -W -Wextra -Wdeclaration-after-statement -Wendif- labels -Wc++-compat -DPERL_GCC_PEDANTIC opmini.c: In function 'Perl_list': opmini.c:977:5: warning: this statement may fall through [-Wimplicit- fallthrough=] if (!o->op_next && cUNOPo->op_first->op_type == OP_FLOP) { ^ opmini.c:981:5: note: here case OP_LIST: ^~~~ opmini.c: In function 'Perl_mod': opmini.c:1277:11: warning: this statement may fall through [-Wimplicit-v fallthrough=] PL_hints |= HINT_BLOCK_SCOPE; opmini.c:1278:5: note: here case OP_SASSIGN: ^~~~ opmini.c: In function 'Perl_fold_constants': opmini.c:2119:40: warning: argument 'o' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] Perl_fold_constants(pTHX_ register OP *o) ^ cc -L/usr/local/lib -o miniperl \ `echo gv.o toke.o perly.o op.o pad.o regcomp.o dump.o util.o mg.o reentr.o hv.o av.o perl.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o | sed 's/ op.o / /'` \ miniperlmain.o opmini.o pp.o: In function `Perl_pp_pow': pp.c:(.text+0x2d84): undefined reference to `pow' pp.o: In function `Perl_pp_modulo': pp.c:(.text+0x3b80): undefined reference to `fmod' pp.o: In function `Perl_pp_atan2': pp.c:(.text+0x8884): undefined reference to `atan2' pp.o: In function `Perl_pp_sin': pp.c:(.text+0x8978): undefined reference to `sqrt' pp.c:(.text+0x8a23): undefined reference to `log' pp.c:(.text+0x8a4e): undefined reference to `cos' pp.c:(.text+0x8afb): undefined reference to `sin' pp.c:(.text+0x8b13): undefined reference to `exp' collect2: error: ld returned 1 exit status makefile:313: recipe for target 'miniperl' failed make: *** [miniperl] Error 1 Is there a ready docker image? If not how do I install on ubuntu or preferably on alpine or another light container.
Run the following commands in the terminal one after another. sudo apt-get install perlbrew perlbrew available perlbrew install perl-5.8.9 If it fails to download, create a directory as shown below mkdir -p perl5/perlbrew/dists Try again the following command perlbrew install perl-5.8.9 For more info , please refer this: https://askubuntu.com/questions/425427/how-to-install-perl-php-mysql-and-ruby-packages-on-ubuntu
In case you don't want to use perlbrew, here is another way- From https://stackoverflow.com/a/44441545/2001559 In your docker file - RUN apt-get install -y gcc ADD http://www.cpan.org/src/5.0/perl-5.8.9.tar.gz /shared RUN tar -xzf perl-5.8.9.tar.gz WORKDIR /shared/perl-5.8.9 RUN ./Configure -des -Dprefix=/opt/perl-5.8.9/localperl RUN make RUN make test RUN make install
perl-5.8.0 I solved the issue when created 2 directories: mkdir -p /home/<username>/perl5/perlbrew/dists/ mkdir -p /home/<username>/perl5/perlbrew/build/perl-5.8.0 Gave rwx-rwx-rwx (to avoid any problems with the access): chmod -Rf 0777 /home/<username>/perl5/perlbrew/dists chmod -Rf 0777 /home/<username>/perl5/perlbrew/build/perl-5.8.0
MATLAB gives "undefined reference" errors trying to use gfortran on Windows
I'm trying to use MinGW gfortran with MATLAB R2019a on Windows 10 by writing a mexopts XML file based on existing XML files. I have cygwin installed with MinGW gcc, and I've been able to run mex -setup referencing the XML file successfully. When I try to compile the timestwo.F file to test the setup (using mex -R2018a timestwo.F90), I get a bunch of errors: Building with 'cygwin MinGW64 Compiler (Fortran)'. C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -I"C:\Program Files\MATLAB\R2019a\extern\include" -I"C:\Program Files\MATLAB\R2019a\simulink\include" -I"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer -O3 -mtune=native "C:\cygwin64\home\user\MATLAB\timestwo.F90" -o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o f951: Warning: Nonexistent include directory ‘C:\Program Files\MATLAB\R2019a\simulink\include’ [-Wmissing-include-dirs] C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -I"C:\Program Files\MATLAB\R2019a\extern\include" -I"C:\Program Files\MATLAB\R2019a\simulink\include" -I"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer -O3 -mtune=native "C:\Program Files\MATLAB\R2019a\extern\version\fortran_mexapi_version.F" -o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o f951: Warning: Nonexistent include directory ‘C:\Program Files\MATLAB\R2019a\simulink\include’ [-Wmissing-include-dirs] C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -pthread -shared -O3 -mtune=native -Wl,--version-script,"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64\fortran_exportsmexfileversion.map" C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o -Wl,-L"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -L"C:\cygwin64\lib\gcc\x86_64-w64-mingw32\7.4.0" -lgfortran -o timestwo.mexw64 Error using mex C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x47): undefined reference to `mxisnumeric800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x6a): undefined reference to `mexerrmsgidandtxt800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x72): undefined reference to `mxgetdoubles800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x7d): undefined reference to `mxgetm800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x8c): undefined reference to `mxgetn800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0xa6): undefined reference to `mxcopyptrtoreal8800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0xba): undefined reference to `mxcreatedoublematrix800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0xc4): undefined reference to `mxgetdoubles800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0xe5): undefined reference to `mxcopyreal8toptr800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x10d): undefined reference to `mexerrmsgidandtxt800_' C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o:timestwo.F90:(.text+0x13b): undefined reference to `mexerrmsgidandtxt800_' collect2: error: ld returned 1 exit status Here's my source: ! Gateway routine #include "fintrf.h" subroutine mexFunction(nlhs, plhs, nrhs, prhs) implicit none mwPointer plhs(*), prhs(*) integer nlhs, nrhs ! Declarations mwPointer mxGetDoubles mwPointer mxCreateDoubleMatrix integer mxIsNumeric mwPointer mxGetM, mxGetN mwPointer x_ptr, y_ptr mwPointer mrows, ncols mwSize size ! Declare variables for computational routine real*8 x_input, y_output ! Make sure input is valid if(nrhs /= 1) then call mexErrMsgIdAndTxt ('MATLAB:timestwo:nInput', & 'One input required.') elseif(nlhs > 1) then call mexErrMsgIdAndTxt ('MATLAB:timestwo:nOutput', & 'Too many output arguments.') endif if(mxIsNumeric(prhs(1)) == 0) then call mexErrMsgIdAndTxt ('MATLAB:timestwo:NonNumeric', & 'Input must be a number.') endif ! Read input array x_ptr = mxGetDoubles(prhs(1)) ! Get size of array mrows = mxGetM(prhs(1)) ncols = mxGetN(prhs(1)) size = mrows*ncols ! Create a Fortran array from the input call mxCopyPtrToReal8(x_ptr,x_input,size) ! Prepare a matrix for output plhs(1) = mxCreateDoubleMatrix(mrows,ncols,0) y_ptr = mxGetDoubles(plhs(1)) call timestwo(y_output, x_input) ! copy results to output argument call mxCopyReal8ToPtr(y_output,y_ptr,size) return end subroutine timestwo(y_output, x_input) real*8 x_input, y_output y_output = 2.0*x_input return end The output is the same if I try with the included matlabroot\extern\examples\refbook\timestwo.F fixed-form version. My options file details (first part of output from mex -v -R2018a timestwo.F90) Compiler location: C:\cygwin64 Options file: C:\Users\user\AppData\Roaming\MathWorks\MATLAB\R2019a\mex_FORTRAN_win64.xml CMDLINE2 : C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -pthread -shared -O3 -mtune=native -Wl,--version-script,"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64\fortran_exportsmexfileversion.map" C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o -Wl,-L"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -L"C:\cygwin64\lib\gcc\x86_64-w64-mingw32\7.4.0" -lgfortran -o timestwo.mexw64 FC : C:\cygwin64\bin\x86_64-w64-mingw32-gfortran DEFINES : -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD FFLAGS : -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer INCLUDE : -I"C:\Program Files\MATLAB\R2019a\extern\include" -I"C:\Program Files\MATLAB\R2019a\simulink\include" -I"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" FOPTIMFLAGS : -O3 -mtune=native FDEBUGFLAGS : -g -Wall LDF : C:\cygwin64\bin\x86_64-w64-mingw32-gfortran LDFLAGS : -pthread LDTYPE : -shared LINKEXPORT : -Wl,--version-script,"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64\fexport.map" LINKEXPORTVER : -Wl,--version-script,"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64\fortran_exportsmexfileversion.map" LINKLIBS : -Wl,-L"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -L"C:\cygwin64\lib\gcc\x86_64-w64-mingw32\7.4.0" -lgfortran LDOPTIMFLAGS : -O3 -mtune=native LDDEBUGFLAGS : -g -Wall OBJEXT : .o LDEXT : .mexw64 SETENV : set COMPILER=C:\cygwin64\bin\x86_64-w64-mingw32-gfortran set COMPFLAGS=-fexceptions -fbackslash -fPIC -fno-omit-frame-pointer -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD set OPTIMFLAGS=-O3 -mtune=native set DEBUGFLAGS=-g -Wall set LINKER=C:\cygwin64\bin\x86_64-w64-mingw32-gfortran set LINKFLAGS=-pthread set LINKDEBUGFLAGS=-pthread -shared -Wl,-L"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -llibmx -llibmex -llibmat -lm -L"C:\cygwin64\lib\gcc\x86_64-w64-mingw32\7.4.0" -lgfortran -Wl,--version-script,"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64\fexport.map" set LDDEBUGFLAGS=-g -Wall set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%%MEX_EXT%%" CYGWINROOT : C:\cygwin64 MATLABROOT : C:\Program Files\MATLAB\R2019a ARCH : win64 SRC : "C:\cygwin64\home\user\MATLAB\timestwo.F90";"C:\Program Files\MATLAB\R2019a\extern\version\fortran_mexapi_version.F" OBJ : C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o;C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o OBJS : C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o SRCROOT : C:\cygwin64\home\user\MATLAB\timestwo DEF : C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.def EXP : "timestwo.exp" LIB : "timestwo.lib" EXE : timestwo.mexw64 ILK : "timestwo.ilk" MANIFEST : "timestwo.mexw64.manifest" TEMPNAME : timestwo EXEDIR : EXENAME : timestwo OPTIM : -O3 -mtune=native LINKOPTIM : -O3 -mtune=native CMDLINE1_0 : C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -I"C:\Program Files\MATLAB\R2019a\extern\include" -I"C:\Program Files\MATLAB\R2019a\simulink\include" -I"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer -O3 -mtune=native "C:\cygwin64\home\user\MATLAB\timestwo.F90" -o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\timestwo.o CMDLINE1_1 : C:\cygwin64\bin\x86_64-w64-mingw32-gfortran -c -DMX_COMPAT_64 -DMATLAB_MEXCMD_RELEASE=R2018a -DUSE_MEX_CMD -I"C:\Program Files\MATLAB\R2019a\extern\include" -I"C:\Program Files\MATLAB\R2019a\simulink\include" -I"C:\Program Files\MATLAB\R2019a\extern\lib\win64\mingw64" -fexceptions -fbackslash -fPIC -fno-omit-frame-pointer -O3 -mtune=native "C:\Program Files\MATLAB\R2019a\extern\version\fortran_mexapi_version.F" -o C:\Users\user\AppData\Local\Temp\mex_62691295256641_4248\fortran_mexapi_version.o It seems like the mex-specific types like mwPointer defined in fintrf.h aren't being defined, even though I've included its location. Why are these types not recognized?
Why does Perl think 1<<-1 is 9223372036854775808?
If I understand perldoc perlop correctly, this operation should something undefined: The result of overflowing the range of the integers is undefined because it is undefined also in C. In other words, using 32-bit integers, 1 << 32 is undefined. Shifting by a negative number of bits is also undefined. I'm noticing two things on my setup that I cannot explain: 1 << -1 returns 9223372036854775808 without bigint or integer pragmas (returns NaN when they are active). > perl -le "print 1<<-1" 9223372036854775808 1 << -1 returns true when tested with defined, regardless of whether or not the bigint or integer pragmas are in effect > perl -le "print 'yes' if defined(1<<-1)" yes > perl -le "use integer; print 'yes' if defined(1<<-1)" yes > perl -le "use bigint; print 'yes' if defined(1<<-1)" yes Details of my setup: > perl -V Set up gcc environment - gcc.exe (rubenvb-4.5.4) 4.5.4 Summary of my perl5 (revision 5 version 16 subversion 3) configuration: Platform: osname=MSWin32, osvers=5.2, archname=MSWin32-x64-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='C:\Perl64\site\bin\gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bitfields', optimize='-O2', cppflags='-DWIN32' ccversion='', gccversion='gcc.exe (rubenvb-4.5.4) 4.5.4', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='__int64', ivsize=8, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='C:\Perl64\site\bin\g++.exe', ldflags ='-L"C:\Perl64\lib\CORE"' libpth=\lib libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 -lmsvcrt libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -L"C:\Perl64\lib\CORE"' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1603 [296746] Built under MSWin32 Compiled at Mar 13 2013 13:31:10 #INC: C:/Perl64/site/lib C:/Perl64/lib .
When they say undefined, they are referring to undefined behaviour, not the value undef. If the result of an operation is undefined behaviour, it means that anything could happen -- you could get a surprising result, a different result on different platforms, a different result each time you do the same thing, or 3-foot tall snails could come out of your computer and start speaking Swahili (though that last one is rather uncommon in practice). In other words, because it's explicitly documented as undefined behaviour, anything perl does is technically correct -- which means you can't rely on it to do anything useful.
The number 9223372036854775808 is equal to 2^63. Given a 64-bit unsigned integer initialized to 1, rotating it by one bit to the right gives this result. This is probably what's happening: << -1 is being interpreted as a rotate right by one. But since shifting by negative values is undefined, this is not something that can be depended on. The coincidence is worth noting, however.
Compiling DBD::mysql on SunOS 5.10
everybody I apologize for the massive length of this post. I am having some issues compiling DBD::mysql on SunOS. # /usr/perl5/bin/perlgcc Makefile.PL I will use the following settings for compiling and testing: cflags (mysql_config) = -I/usr/sfw/include/mysql -xstrconst -mt embedded (mysql_config) = ldflags (mysql_config) = -R/usr/sfw/lib -R/usr/sfw/lib/mysql libs (mysql_config) = -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm mysql_config (guessed ) = mysql_config nocatchstderr (default ) = 0 nofoundrows (default ) = 0 ssl (guessed ) = 0 testdb (default ) = test testhost (default ) = testpassword (default ) = testsocket (default ) = testuser (guessed ) = Checking if your kit is complete... Looks good Using DBI 1.58 (for perl 5.008004 on sun4-solaris-64int) installed in /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI/ Writing Makefile for DBD::mysql # /usr/sfw/bin/gmake cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm gcc -c -I/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI -I/usr/sfw/include/mysql -xstrconst -mt -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasing -DVERSION=\"4.022\" -DXS_VERSION=\"4.022\" -fPIC "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE" dbdimp.c gcc: language strconst not recognized gcc: dbdimp.c: linker input file unused because linking not done /usr/perl5/5.8.4/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI/Driver.xst > mysql.xsi /usr/perl5/5.8.4/bin/perl /usr/perl5/5.8.4/lib/ExtUtils/xsubpp -typemap /usr/perl5/5.8.4/lib/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c Warning: duplicate function definition 'do' detected in mysql.xs, line 242 Warning: duplicate function definition 'rows' detected in mysql.xs, line 752 gcc -c -I/usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int/auto/DBI -I/usr/sfw/include/mysql -xstrconst -mt -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TS_ERRNO -O2 -fno-strict-aliasing -DVERSION=\"4.022\" -DXS_VERSION=\"4.022\" -fPIC "-I/usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE" mysql.c gcc: language strconst not recognized gcc: mysql.c: linker input file unused because linking not done Running Mkbootstrap for DBD::mysql () chmod 644 mysql.bs rm -f blib/arch/auto/DBD/mysql/mysql.so LD_RUN_PATH="/usr/sfw/lib:/usr/lib:/lib" /usr/perl5/5.8.4/bin/perl myld gcc -G dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm gcc: dbdimp.o: No such file or directory gcc: mysql.o: No such file or directory gmake: *** [blib/arch/auto/DBD/mysql/mysql.so] Error 1 Probably relevant information: mysql_config --cflags -I/usr/sfw/include/mysql -xstrconst -mt mysql_config --libs -R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm file `which perl` /usr/bin/perl: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, stripped # perl --version This is perl, v5.8.4 built for sun4-solaris-64int ldd /usr/sfw/bin/mysql libcurses.so.1 => /lib/libcurses.so.1 libmysqlclient.so.12 => /usr/sfw/lib/libmysqlclient.so.12 libz.so.1 => /usr/lib/libz.so.1 librt.so.1 => /lib/librt.so.1 libcrypt_i.so.1 => /usr/lib/libcrypt_i.so.1 libgen.so.1 => /lib/libgen.so.1 libsocket.so.1 => /lib/libsocket.so.1 libnsl.so.1 => /lib/libnsl.so.1 libm.so.2 => /lib/libm.so.2 libCstd.so.1 => /usr/lib/libCstd.so.1 libCrun.so.1 => /usr/lib/libCrun.so.1 libw.so.1 => /lib/libw.so.1 libthread.so.1 => /lib/libthread.so.1 libc.so.1 => /lib/libc.so.1 libaio.so.1 => /lib/libaio.so.1 libmd.so.1 => /lib/libmd.so.1 libmp.so.2 => /lib/libmp.so.2 libscf.so.1 => /lib/libscf.so.1 libdoor.so.1 => /lib/libdoor.so.1 libuutil.so.1 => /lib/libuutil.so.1 /usr/lib/cpu/sparcv8plus/libCstd_isa.so.1 /platform/SUNW,SPARC-Enterprise-T5120/lib/libc_psr.so.1 /platform/SUNW,SPARC-Enterprise-T5120/lib/libmd_psr.so.1 # perl -V Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=solaris, osvers=2.10, archname=sun4-solaris-64int uname='sunos localhost 5.10 sun4u sparc SUNW,Ultra-2' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -xarch=v8 -D_TS_ERRNO', optimize='-xO3 -xspace -xildoff', cppflags='' ccversion='Sun WorkShop', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R /usr/perl5/5.8.4/lib/sun4-solaris-64int/CORE' cccdlflags='-KPIC', lddlflags='-G' Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_LARGE_FILES Locally applied patches: 22667 The optree builder was looping when constructing the ops ... 22715 Upgrade to FileCache 1.04 22733 Missing copyright in the README. 22746 fix a coredump caused by rv2gv not fully converting a PV ... 22755 Fix 29149 - another UTF8 cache bug hit by substr. 22774 [perl #28938] split could leave an array without ... 22775 [perl #29127] scalar delete of empty slice returned garbage 22776 [perl #28986] perl -e "open m" crashes Perl 22777 add test for change #22776 ("open m" crashes Perl) 22778 add test for change #22746 ([perl #29102] Crash on assign ... 22781 [perl #29340] Bizarre copy of ARRAY make sure a pad op's ... 22796 [perl #29346] Double warning for int(undef) and abs(undef) ... 22818 BOM-marked and (BOMless) UTF-16 scripts not working 22823 [perl #29581] glob() misses a lot of matches 22827 Smoke [5.9.2] 22818 FAIL(F) MSWin32 WinXP/.Net SP1 (x86/1 cpu) 22830 [perl #29637] Thread creation time is hypersensitive 22831 improve hashing algorithm for ptr tables in perl_clone: ... 22839 [perl #29790] Optimization busted: '#a = "b", sort #a' ... 22850 [PATCH] 'perl -v' fails if local_patches contains code snippets 22852 TEST needs to ignore SCM files 22886 Pod::Find should ignore SCM files and dirs 22888 Remove redundant %SIG assignments from FileCache 23006 [perl #30509] use encoding and "eq" cause memory leak 23074 Segfault using HTML::Entities 23106 Numeric comparison operators mustn't compare addresses of ... 23320 [perl #30066] Memory leak in nested shared data structures ... 23321 [perl #31459] Bug in read() 27722 perlio.c breaks on Solaris/gcc when > 256 FDs are available SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962 6663288 Upgrade to CGI.pm 3.33 REGEXP0 - fix for UTF-8 recoding in regexps - CVE-2007-5116 6758953 Perl Sys::Syslog can log messages with wrong severity Built under solaris Compiled at May 21 2009 03:59:02 #INC: /usr/perl5/5.8.4/lib/sun4-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/sun4-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl . isainfo -v 64-bit sparcv9 applications asi_blk_init vis2 vis 32-bit sparc applications asi_blk_init vis2 vis v8plus div32 mul32 Any tips as how I should proceed, if possible in a step-by-step (for dummies) manner? Thanks!
Try using a Sun compiler, which presumably compiled your mysql. Others have had this problem, too.
Changing pg_config
I'm facing a very similar problem as I'm trying to install psycopg2 onto Mac OS 10.6.3; it claims it can't find "stdarg.h" but I can see it's there; what should I do? (except I'm on OS X 10.7 and PostgreSQL v 9.0.5), and I'm thinking about changing my psql config c-compiler. When I type pg_config in terminal I get: BINDIR = /usr/bin DOCDIR = /usr/share/doc/postgresql HTMLDIR = /Library/WebServer/Documents/postgresql INCLUDEDIR = /usr/include PKGINCLUDEDIR = /usr/include/postgresql INCLUDEDIR-SERVER = /usr/include/postgresql/server LIBDIR = /usr/lib PKGLIBDIR = /usr/lib/postgresql LOCALEDIR = /usr/share/locale MANDIR = /usr/share/man SHAREDIR = /usr/share/postgresql SYSCONFDIR = /private/etc/postgresql PGXS = /usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk CONFIGURE = '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--prefix=/usr' '--sbindir=/usr/libexec' '--sysconfdir=/private/etc' '--localstatedir=/var/pgsql' '--htmldir=/Library/WebServer/Documents/postgresql' '--enable-thread-safety' '--enable-dtrace' '--with-tcl' '--with-perl' '--with-python' '--with-gssapi' '--with-krb5' '--with-pam' '--with-ldap' '--with-bonjour' '--with-openssl' '--with-libxml' '--with-libxslt' '--with-system-tzdata=/usr/share/zoneinfo' 'CFLAGS=-arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS=-arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations' 'LDFLAGS_EX=-mdynamic-no-pic' CC = gcc CPPFLAGS = -I/usr/include/libxml2 CFLAGS = -arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv CFLAGS_SL = LDFLAGS = -arch x86_64 -arch i386 -pipe -Os -g -Wall -Wno-deprecated-declarations -Wl,-dead_strip_dylibs LDFLAGS_EX = -mdynamic-no-pic LDFLAGS_SL = LIBS = -lpgport -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lm VERSION = PostgreSQL 9.0.5 I'm wondering how to change pg_config (so I can set CC = gcc-4.2) or something along those lines.
pg_config is just a util that provides information, it is not a "config" in the typical sense that you can edit properties. If you want to change a value that pg_config provides, you will need to manually do so outside of the util (in your case, you will need to install a new C compiler).