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
Related
I am trying to build and install the OpenFst library on windows10 using MINGW64 with Msys but i got the following error during the building with make. I first used this command:
./configure --enable-grm --enable-far --enable-ngram-fsts MAKE="mingw32-make"
some of the checking results from this command generates no:
checking whether we are cross compiling... no
checking for sysroot... no
checking for a working dd... ./configure: line 7016: cmp: command not found
./configure: line 7016: cmp: command not found
checking for mt... no
checking if : is a manifest tool... no
checking for unistd.h... no
checking if gcc supports -fno-rtti -fno-exceptions... ./configure: line 8930: diff: command `not found`
checking whether to build static libraries... no
The other checking results are ok and yes. Then I used the make command:
mingw32-make
it works for some files then terminated by that error:
libtool: error: can't build x86_64-w64-mingw32 shared library unless -no-undefined is
specified
It is my first time to build with MinGW. So, I do not know what the error means and if the resulting "no" checking from the configuration responsible for it.
This is normal.
MinGW does not allow building shared libraries (DLLs) when there are still unresolved symbols, because on Windows each symbol referenced from a DLL must point to something that exists. On other platforms this is not always required.
So you should pass to -Wl,-no-undefined to gcc when linking.
For projects using autoconf's configure this is normally already done if it was a recent enough version of autoconf. Otherwise you may need to add LDFLAGS="-Wl,-no-undefined" to the configure line.
If that doesn't help you can try to change it in the libtool file generated by configure.
So specicially you can try this in MSYS/MSYS2 shell:
./configure LDFLAGS="-Wl,-no-undefined"
and if that doesn't work you can also try this (after the configure command and before running make):
sed -i.bak -e "s/\(allow_undefined=\)yes/\1no/" libtool
Other build tools like cmake, meson or scons already know how to build Windows DLLs and need no special treatment.
I'm trying to install the elastic beanstalk cli, like so:
./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
But I'm getting the following error:
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
python-build: use readline from homebrew
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557
Results logged to /var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557.log
Last 10 log lines:
checking for python3.7... python3.7
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/var/folders/96/df02xppj77g7dx698gtmwmrw0000gn/T/python-build.20210319024756.38557/Python-3.7.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
Exiting due to failure
For some reason, the installation script isn't detecting the C compiler. Of course, both the gcc and the cc commands work in the terminal. I'm using macOS 11.1. How do I fix this?
You need to run the commands using Roseta, and arch command can be used to run commands via Rosetta:
arch -x86_64 ./aws-elastic-beanstalk-cli-setup/scripts/bundled_installer
I'm trying to compile the binutils for the i686-elf target according to this tutorial:
https://wiki.osdev.org/GCC_Cross-Compiler
I just added the --enable-tui option, so that I have the support in the gdb.
I did the following:
# get sources
git clone git://sourceware.org/git/binutils-gdb.git
# store settings
export PREFIX="`pwd`/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
# create build folder
mkdir build-binutils
cd build-binutils
# run configure
../binutils-gdb/configure -target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror --enable-tui
# make
make
This runs for some time and terminates with the following error:
checking for library containing socketpair... (cached) none required
checking for ld used by GCC... (cached) ld
checking if the linker (ld) is GNU ld... (cached) yes
checking for shared library run path origin... (cached) done
checking for iconv... (cached) yes
checking for iconv declaration... (cached)
extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for library containing waddstr... (cached) no
configure: error: no enhanced curses library found; disable TUI
make[1]: *** [Makefile:11329: configure-gdb] Error 1
make[1]: Leaving directory '/home/noexpandtab/dev/build-binutils'
make: *** [Makefile:853: all] Error 2
For me it seems, that the ncurses library cannot be found.
I have a Debian 10 running and installed the following additional packages:
libncurses-dev
ncurses-base
ncurses-doc
libncurses5-dev
Do I have to install additional packages? Or am I missing some options for the configure script?
You're cross-compiling to a different architecture (i686-elf) than whatever you're running on—the $TARGET mentioned in the question. gdb will have to be linked with libraries which are built for that architecture.
Debian provides ncurses packages which run on the current architecture, but does not provide a suitable package for the cross-compiled application. So you get to do this for yourself.
When cross-compiling ncurses, you'll have to keep in mind that part of it builds/runs on the current architecture (to generate source-files for compiling by the cross-compiler). That's defined in the environment as $BUILD_CC (rather than $CC), as you might see when reading the script for the mingw cross-compiling. There's a section in the INSTALL file (in the ncurses sources) which outlines the process.
There's no tutorial (that would be off-topic here anyway), but others have read the instructions and cross-compiled ncurses as evidenced by a recent bug report.
I retried the whole compilation, and suddenly it works! I tested a bit and I assume I found my fault: I executed configure without --enable-tui, where make worked. Then I executed configure with --enable-tui in the same folder without cleaning it. After cleaning or running in a new folder it compiled.
Thanks to the one user who posted to delete the contents of opt/cross. (The comment itself was already somehow deleted in between.) This wasn't the solution, but leaded me in the right direction.
TL;DR: Clean the build folder before running configure with different parameters again.
I have managed to successfully launch the most recent RStudio AWS EC2 instance (louisaslett.com, RStudio-1.1383_R-3.4.2…ubuntu-16.04-LTS-64). R operates mostly as expected in this instance, and I can install and open a number of packages. However I get an error if I try to install either of the rgdal of gdalUtils packages.
Below is the console output when I attempt to install rgdal. The output for the gdalUtils install is too long to include here, but both include the text "error: upgrade GDAL to 1.11.4 or later" which I suspect is the problem, but have no idea how to correct.
Any thoughts or advice would be greatly appreciated.
Cheers
> install.packages("rgdal")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-3.tar.gz'
Content type 'application/x-gzip' length 1670656 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
configure: CC: gcc -std=gnu99
configure: CXX: g++
configure: rgdal: 1.3-3
checking for /usr/bin/svnversion... yes
configure: svn revision: 759
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=gnu++11... yes
configure: C++11 support available
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.11.3
checking GDAL version >= 1.11.4... no
configure: error: upgrade GDAL to 1.11.4 or later
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpGUxbcA/downloaded_packages’
I have since run into the same issue running Rstudio on the google cloud. In both cases a solution was relatively simple - install a recent but older rgdal package from cran (https://cran.r-project.org/src/contrib/Archive/rgdal/) which wasnt dependent on the most recent gdal libraries, and therefore installed without throwing the error about upgrading GDAL.
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.