I want to install perl Gtk2, and for this I need first to have Glib installed. I tried sudo cpanm Glib, but I get an error when compiling (I also tried downloading the .tar.gz source etc., with the same effect). I also tried with an older version of Glib. I’m on OS X 10.11 (El Capitan). Here’s the error :
error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
I don’t know how to fix it… Thanks a lot if anyone can do something for me !
(BTW, brew install glib works fine, but it seems the app that I’m trying to build and run — auto-multiple-choice, for instance — is looking for a Gtk2.pm somewhere. So, the ‘glib’ installed by Homebrew is of no help.)
Benjamin
p.-s. : below is the complete log, if it helps :
cpanm (App::cpanminus) 1.7042 on perl 5.018002 built for darwin-thread-multi-2level
Work directory is /Users/benjamin/.cpanm/work/1474765262.7331
You have make /usr/bin/make
You have LWP 6.05
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Glib () on cpanmetadb ...
--> Working on Glib
Fetching http://www.cpan.org/authors/id/X/XA/XAOC/Glib-1.322.tar.gz
-> OK
Unpacking Glib-1.322.tar.gz
Entering Glib-1.322
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (6.66)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Configuring Glib-1.322
Running Makefile.PL
Including generated API documentation...
Checking if your kit is complete...
Looks good
Writing Makefile for Glib
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.66)
Building and testing Glib-1.322
cp lib/Glib/CodeGen.pm blib/lib/Glib/CodeGen.pm
cp /Users/benjamin/.cpanm/work/1474765262.7331/Glib-1.322/typemap blib/arch/Glib/Install/typemap
cp lib/Glib/ParseXSDoc.pm blib/lib/Glib/ParseXSDoc.pm
cp doctypes blib/arch/Glib/Install/doctypes
cp devel.pod blib/lib/Glib/devel.pod
cp gperl_marshal.h blib/arch/Glib/Install/gperl_marshal.h
cp lib/Glib/MakeHelper.pm blib/lib/Glib/MakeHelper.pm
cp gperl.h blib/arch/Glib/Install/gperl.h
cp lib/Glib.pm blib/lib/Glib.pm
cp lib/Glib/Object/Subclass.pm blib/lib/Glib/Object/Subclass.pm
cp build/IFiles.pm blib/arch/Glib/Install/Files.pm
cp lib/Glib/GenPod.pm blib/lib/Glib/GenPod.pm
[ XS Glib.xs ]
[ CC Glib.c ]
In file included from Glib.xs:22:
In file included from ./gperl.h:37:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib-object.h:23:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/gobject/gbinding.h:28:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib.h:30:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/galloca.h:32:
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gtypes.h:422:3: error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gmacros.h:232:103: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~~~~~~~~~
1 error generated.
make: *** [Glib.o] Error 1
-> FAIL Installing Glib failed. See
/Users/benjamin/.cpanm/work/1474765262.7331/build.log for details. Retry with --force to force install it.
This was posted to a GitHub issue.
I tracked down the problem by running:
cpanm --verbose --build-args=NOECHO=' ' Glib
so that I could see the specific compilation command that failed:
cc -c -I. -I/usr/local/Cellar/glib/2.50.0/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.0/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -D_REENTRANT -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"1.323\" -DXS_VERSION=\"1.323\" -o Glib.o "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" Glib.c
Since the problem was something to do with mismatching sizeof's, I figured that the problem was that the architecture that Perl was building with does not the architecture that Homebrew's libglib-2.0 was built against.
The fix is to specify that you only want to build for x86_64 by setting the ARCHFLAGS environment variable:
ARCHFLAGS="-arch x86_64" cpanm --verbose Glib
This is all using the system Perl. If you want the install to work in the long run across system upgrades, you will want to install your own user Perl using either perlbrew or plenv.
I ran into the same issue.
Installing gtk+ as a prerequisite fixed it.
Related
I am attempting to install the Perl package Math::GMP on OS X El Capitan.
I had one computer where this worked without issue - but a second computer is running into the following problem:
The Perl module Math::GMP requires the C library for GMP, so I have done a brew install gmp
This installed GMP including the following file:
/usr/local/include/gmp.h
But the package install still fails claiming I don't have gmp installed:
$ sudo perl -MCPAN -e shell
cpan[1]> install Math::GMP
Reading '/Users/chaosadmin/.cpan/Metadata'
Database was generated on Sat, 14 Nov 2015 09:17:02 GMT
Running install for module 'Math::GMP'
Checksum for /Users/me/.cpan/sources/authors/id/S/SH/SHLOMIF/Math-GMP-2.11.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
'YAML' not installed, will not store persistent state
Configuring S/SH/SHLOMIF/Math-GMP-2.11.tar.gz with Makefile.PL
Can't link/include C library 'gmp.h', 'gmp', aborting.
No 'Makefile' created SHLOMIF/Math-GMP-2.11.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Failed during this command:
SHLOMIF/Math-GMP-2.11.tar.gz : writemakefile NO -- No 'Makefile' created
The obvious line is:
Can't link/include C library 'gmp.h', 'gmp', aborting.
But I definitely have "gmp.h" installed in /usr/local/include/gmp.h
I'm unsure why it's failing to install on this OS X El Capitan machine (it worked fine on my other one).
In the CPAN shell I used:
look Math::GMP
And updated the Makefile.PL to debug:
check_lib_or_exit(
header => 'gmp.h',
lib => 'gmp',
debug => 'true'
);
Which displayed the following error when running perl Makefile.PL
# /usr/bin/cc -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -arch i386 -arch x86_64 -fstack-protector assertlibD4RJzZEa.c -o assertlibwGFzIVsM
assertlibD4RJzZEa.c:1:10: fatal error: 'gmp.h' file not found
include
On Centos :
Just install this : yum install gmp* -y
Good Luck :)
I've worked on this problem for a few days and couldn't find any solution even after reading several other blogs.
Whenever I try to install modules using CPAN, these installs fail since 'make' errors.
cpan[1]> install Clone
CPAN: Storable loaded ok (v2.18)
Reading '/Users/erikhanschen/.cpan/Metadata'
Database was generated on Wed, 11 Jun 2014 12:06:12 GMT
CPAN: YAML loaded ok (v0.92)
CPAN: Time::HiRes loaded ok (v1.9711)
Reading 49 yaml files from /Users/erikhanschen/.cpan/build/
DONE
Restored the state of none (in 1.7859 secs)
Running install for module 'Clone'
GARU/Clone-0.37.tar.gz
Has already been unwrapped into directory /Users/erikhanschen/.cpan/build/Clone-0.37-F3R5u0
GARU/Clone-0.37.tar.gz
Has already been prepared
GARU/Clone-0.37.tar.gz
Could not make: Unknown error
CPAN: CPAN::Meta loaded ok (v2.120351)
cpan[2]>
After I had to replaced my hard drive recently, I had to re-install Xcode but even after that, the make command didn't work. Uninstalling Xcode and installing GCC compiler instead didn't help. make is in /usr/bin/ and that directory is in my PATH, and make and GCC run when run without arguments, but the CPAN installer still can't find it when I'm trying to install a module.
After removing the contents of the CPAN build directory, trying to install a module still crashes at "make".
cpan[2]> install Clone
Running install for module 'Clone'
CPAN: Digest::SHA loaded ok (v5.45)
CPAN: Compress::Zlib loaded ok (v2.008)
Checksum for /Users/erikhanschen/.cpan/sources/authors/id/G/GA/GARU/Clone- 0.37.tar.gz ok
Scanning cache /Users/erikhanschen/.cpan/build for sizes
DONE
CPAN: Archive::Tar loaded ok (v1.96)
x Clone-0.37/
x Clone-0.37/Changes
x Clone-0.37/Clone.pm
x Clone-0.37/Clone.xs
x Clone-0.37/Makefile.PL
x Clone-0.37/MANIFEST
x Clone-0.37/META.json
x Clone-0.37/META.yml
x Clone-0.37/README
x Clone-0.37/t/
x Clone-0.37/t/01array.t
x Clone-0.37/t/02hash.t
x Clone-0.37/t/03scalar.t
x Clone-0.37/t/04tie.t
x Clone-0.37/t/05dtype.t
x Clone-0.37/t/06refcnt.t
x Clone-0.37/t/07magic.t
x Clone-0.37/t/08fieldhash.t
x Clone-0.37/t/dclone.t
x Clone-0.37/t/dump.pl
x Clone-0.37/t/tied.pl
CPAN: File::Temp loaded ok (v0.2304)
CPAN: Module::CoreList loaded ok (v2.13)
Configuring G/GA/GARU/Clone-0.37.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
'EXPATINCPATH' is not a known MakeMaker parameter name.
'EXPATLIBPATH' is not a known MakeMaker parameter name.
Generating a Unix-style Makefile
Writing Makefile for Clone
Writing MYMETA.yml and MYMETA.json
GARU/Clone-0.37.tar.gz
/usr/bin/perl Makefile.PL EXPATLIBPATH=/non-standard/lib EXPATINCPATH=/non-standard/include -- OK
Running make for G/GA/GARU/Clone-0.37.tar.gz
cp Clone.pm blib/lib/Clone.pm
AutoSplitting blib/lib/Clone.pm (blib/lib/auto/Clone)
Running Mkbootstrap for Clone ()
chmod 644 Clone.bs
/usr/bin/perl /Library/Perl/Updates/5.10.0/ExtUtils/xsubpp -typemap /System/Library/Perl/5.10.0/ExtUtils/typemap Clone.xs > Clone.xsc && mv Clone.xsc Clone.c
gcc-4.2 -c -arch x86_64 -arch i386 -arch ppc -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include -O3 -DVERSION=\"0.37\" -DXS_VERSION=\"0.37\" "- I/System/Library/Perl/5.10.0/darwin-thread-multi-2level/CORE" Clone.c
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
lipo: can't open input file: /var/tmp//cc23LjqR.out (No such file or directory)
make: *** [Clone.o] Error 2
GARU/Clone-0.37.tar.gz
/usr/bin/make -- NOT OK
Failed during this command:
GARU/Clone-0.37.tar.gz : make NO
I've already updated perl, CPAN, and Module::Build. I'm thinking the next step is to upgrade to 10.7, 10.8, or 10.9 and try to reinstall Command Line Tools straight from Apple.
Thoughts?
I had to re-install Xcode but even after that, the make command didn't work...
Install Command Line tools. Open Xcode, and then go to Xcode → Preferences → Downloads.
I'm trying to compile and install GCC 4.8.2 in OS X 10.9. I followed the instructions here (http://gcc.gnu.org/wiki/InstallingGCC) to first run ./contrib/download_prerequesites and then ran configure and make from a directory different from the source. My build fails with error:
checking for suffix of object files... configure: error: in `/Users/prokilogrammer/temp/gcc-build482/x86_64-apple-darwin13.0.2/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Apparently this problem would be solved if GCC's dependencies (GMP, MPC, MPFR) are properly installed (http://gcc.gnu.org/wiki/FAQ#configure_suffix). I checked and made sure they are correctly installed under /usr/local/lib & /usr/local/include directories.
Looking at config.log, I see the following errors:
configure:3565: checking for suffix of object files
configure:3587: /Users/prokilogrammer/temp/gcc-build482/./gcc/xgcc -B/Users/prokilogrammer/temp/gcc-build482/./gcc/ -B/usr/local/x86_64-apple-darwin13.0.2/bin/ -B/usr/local/x86_64-apple-darwin13.0.2/lib/ -isystem /usr/local/x86_64-apple-darwin13.0.2/include -isystem /usr/local/x86_64-apple-darwin13.0.2/sys-include -c -g -O2 conftest.c >&5
conftest.c:1:0: internal compiler error: Segmentation fault: 11
/* confdefs.h */
^
libbacktrace could not find executable to open
I am not sure if the segfault is because of the missing dependencies or a legit issue in gcc.
Have you guys experienced similar problems? Is there a solution/workaround?
PS: I have also tried setting LD_LIBRARY_PATH & DYLD_LIBRARY_PATH without any luck.
I've built GCC 4.8.2 on several Mavericks machines, but I chose a slightly different strategy. Specifically, I included the code for GMP, MPC, MPFR (and CLOOG and ISL) in the build directory. I used a script to quasi-automate it:
GCC_VER=gcc-4.8.2
tar -xf ${GCC_VER}.tar.bz2 || exit 1
cd ${GCC_VER} || exit
cat <<EOF |
cloog 0.18.0 tar.gz
gmp 5.1.3 tar.xz
isl 0.11.1 tar.bz2
mpc 1.0.1 tar.gz
mpfr 3.1.2 tar.xz
EOF
while read file vrsn extn
do
tar -xf "../$file-$vrsn.$extn" &&
ln -s "$file-$vrsn" "$file"
done
With that done:
mkdir gcc-4.8.2-obj
cd gcc-4.8.2-obj
../gcc-4.8.2/configure --prefix=$HOME/gcc/v4.8.2
make -j8 bootstrap
AFAICR, that was about all it took, with 4.8.1 and 4.8.2.
I'm trying to install rpostgresql on a mac. I want to be able to connect to a server using an IP address and read the data into a dataframe. I downloaded the package from CRAN, and ran the following line:
install.packages('/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz', type='source')
This started to compile the package but resulted with the following error message:
> install.packages('/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz', type='source')
Installing package(s) into ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library’
(as ‘lib’ is unspecified)
inferring 'repos = NULL' from the file name
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pg_config... /usr/bin/pg_config
checking for "/usr/include/libpq-fe.h"... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
*** arch - x86_64
gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/include -I/usr/local/include -fPIC -g -O2 -c RS-DBI.c -o RS-DBI.o
make: gcc-4.2: No such file or directory
make: *** [RS-DBI.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RPostgreSQL’
Warning in install.packages :
installation of package ‘/Users/celenius/Downloads/RPostgreSQL_0.2-1.tar.gz’ had non-zero exit status
I've looked through advice on the rpostgresql webpage (1, 2) but a lot of the suggestions are more than a year old so I thought there might be more recent advice on how to install this package.
If you want to connect to a postgre db, you also can use RODBC. Just install an ODBC driver (Lion should already include that for postgres) and you are ready to go.
I do that for conecting to my local postgre / postgis server and it works just fine.
You need Xcode installed in order to compile. Go into the Mac app store and search for, then install Xcode. It's free.
you can tell whether you already have gcc by doing a quick which gcc-4.2. My guess is that you do not. After installing Xcode, you should get /usr/bin/gcc-4.2 in response.
****EDIT****
After the comments about how you installed Xcode and still don't have gcc-4.2, I did a little bit of reading and it looks like you need to do one of the options listed in this Stack Overflow question: Setting GCC 4.2 as the default compiler on Mac OS X Leopard
This makes me wonder where my gcc-4.2 came from. Probably some fortuitous accident when I first got my MBP.
Since postgresql is required to build the package from source, you will need to install it. The easiest way to do so, if you use homebrew, is to simply do the following in a Terminal:
## install postgresql
brew install postgresql
## install the R package
Rscript -e "install.packages('RPostgreSQL', type = 'source')"
## remove postgresql (optional)
brew remove postgresql
On OS X I'm trying to install the zlib prerequisite for haskell's Cabal. I get this error:
$ sudo ./Setup build
Preprocessing library zlib-0.5.0.0…
ld: library not found for -lgmp
collect2: ld returned 1 exit status
linking dist/build/Codec/Compression/Zlib/Stream_hsc_make.o failed
command was: /usr/bin/gcc -lz -L/sw/lib/ghc-6.8.3/lib/bytestring-0.9.0.1.1 -L/sw/lib/ghc-6.8.3/lib/array-0.1.0.0 -L/sw/lib/ghc-6.8.3/lib/base-3.0.2.0 -L/sw/lib/ghc-6.8.3 -lm -lgmp -ldl dist/build/Codec/Compression/Zlib/Stream_hsc_make.o -o dist/build/Codec/Compression/Zlib/Stream_hsc_make
The library -lgmp is found in /sw/lib, so I can run that command ("/usr/bin/gcc ...") successfully if I manually add -L/sw/lib. The problem is that sudo doesn't know about /sw/lib. Behold:
$ gcc -print-search-dirs | grep sw
libraries: =/lib/i686-apple-darwin9/4.0.1/:/lib/:/usr/lib/i686-apple-darwin9/4.0.1/:/usr/lib/:./i686-apple-darwin9/4.0.1/:./:/sw/lib/i686-apple-darwin9/4.0.1/:/sw/lib/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../../i686-apple-darwin9/lib/i686-apple-darwin9/4.0.1/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../../i686-apple-darwin9/lib/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../i686-apple-darwin9/4.0.1/:/usr/lib/gcc/i686-apple-darwin9/4.0.1/../../../
$ sudo gcc -print-search-dirs | grep sw
$
How do I tell the sudo version of gcc to look in /sw/lib for libraries? Do I add an environment variable on root's .bash_profile? If so, which one?
UPDATE:
There’s probably a more proper way to do this, but here’s what worked. I created a bash script with this in it:
#!/bin/sh
export LIBRARY_PATH=/sw/lib:$LIBRARY_PATH
./Setup build
And then I ran
$ sudo ./script.sh
That compiled zlib without complaining - hooray! Unfortunately cabal-install is still giving me the error:
$ ./Setup configure
Configuring cabal-install-0.6.2…
Setup: At least the following dependencies are missing:
zlib >=0.4 && <0.6
So I went back to the cabal-install dir (which is what I'm trying to do in the first place), and ran...
$ ./bootstrap.sh
...and that installed everything as expected.
Why you use sudo ever? You should not compile as super user. Compile as normal user and install as super user.
Try setting LDFLAGS=-L/sw/lib.
GHC now comes with an installer for OS X (Leopard, not sure about Tiger). The only issue is that if you use macports or fink, these will probably not see that you have GHC installed and try to install their own version of it.