Problem installing tmap r package ubuntu 18.04 - ubuntu-18.04

I get the following error:
* installing *source* package ‘lwgeom’ ...
** package ‘lwgeom’ successfully unpacked and MD5 sums checked
** using staged installation
configure: CC: gcc -std=gnu99
configure: CXX: g++ -std=gnu++11
configure: pkg-config proj exists, will use it
checking proj_api.h usability... no
checking proj_api.h presence... no
checking for proj_api.h... no
configure: error: proj_api.h not found in standard or given locations.
ERROR: configuration failed for package ‘lwgeom’
Previously I have follow this: https://philmikejones.me/tutorials/2018-08-29-install-sf-ubuntu/
sf and rgdal are installed without problem
I have other three machines with the same OS and have not encounter this issue before.
R version:
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

I was looking for the exact same issue and I found a solution:
devtools::install_github("r-spatial/lwgeom")
For reasons I can't comprehend, it seems that CRAN version doesn't get along with Ubuntu, but installing it via devtools allowed me to install lwgeom first and then tmaptools with no trouble at all. I hope it helps!

Related

MacOS "configure: error: cannot run C compiled programs"

I am pretty new to the MacOS environment and I previously had some issue compiling C scripts. I had the following issue:
fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
I tried to re-install xcode-select --install but keep telling me
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
I updated everything and nothing. Apparently it is because I don't have the /usr/includes file. I found a way to compile my software by using
/Library/Developer/CommandLineTools/usr/bin/g++ XXXX.cpp
However, now I am trying to ./compile and make another software but I don't know how to use this gcc interpreter by default. When I try to ./configure I got this error
configure: error: cannot run C compiled programs. If you meant to
cross compile, use '--host'. See 'config.log' for more details
So when I do look into config.log :
configure:3224: checking for gcc
configure:3240: found /usr/local/bin/gcc
configure:3251: result: gcc
configure:3282: checking for C compiler version
configure:3291: gcc --version >&5
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3302: $? = 0
configure:3291: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/lto-wrapper
Target: x86_64-apple-darwin14.0.0
Configured with: ../gcc-4.9-20141029/configure --enable-languages=c++,fortran
Thread model: posix
gcc version 4.9.2 20141029 (prerelease) (GCC)
configure:3302: $? = 0
configure:3291: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3291: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:3302: $? = 1
configure:3322: checking whether the C compiler works
configure:3344: gcc conftest.c >&5
configure:3348: $? = 0
configure:3396: result: yes
configure:3399: checking for C compiler default output file name
configure:3401: result: a.out
configure:3407: checking for suffix of executables
configure:3414: gcc -o conftest conftest.c >&5
configure:3418: $? = 0
configure:3440: result:
configure:3462: checking whether we are cross compiling
configure:3470: gcc -o conftest conftest.c >&5
conftest.c:15:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
configure:3474: $? = 1
configure:3481: ./conftest
./configure: line 3483: ./conftest: No such file or directory
configure:3485: $? = 127
configure:3492: error: in `/Users/XXXX/phyml':
configure:3494: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Do you have any ideas of how I can fix it ?
Thanks a lot !
It's really easy to miss the answer from melpomene in the small comments to this question so let me post this here for everyone to see. This error usually means you're missing compiler tools (headers actually) that have been removed from Xcode.
You can find them in /Library/Developer/CommandLineTools/Packages/ since their name might be different depending on your version of macOS in the future.
Assuming you're running macOS Mojave (10.14), you need to run:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
And an macOS-style package installer will start, asking you for your adminstrator password. This is an official Apple package and although it might be weird to install something out of a random directory, you can trust it. You don't have to take my word for it though. Apple buried this change in the Xcode 10 release notes and you can find their explanation here: https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes#3035623
I'll reproduce this here in case this link ever goes away or gets changed:
The Command Line Tools package installs the macOS system headers inside the macOS SDK. Software that compiles with the installed tools will search for headers within the macOS SDK provided by either Xcode at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
or the Command Line Tools at:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
depending on which is selected using xcode-select.
The command line tools will search the SDK for system headers by default. However, some software may fail to build correctly against the SDK and require macOS headers to be installed in the base system under /usr/include. If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. You can find this package at:
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

> To make sure that you're using the intended version of the command line tools, run xcode-select -s or xcode select -s /Library/Developer/CommandLineTools after installing.

Compiling C Program to WebAssembly Program with "Error: No available targets are compatible with this triple" on Ubuntu 16.10

Following this tutorial, I tried to compile a C program to WebAssembly by using the following command.
emcc hello.c -s WASM=1 -o hello.html
But I ecounter the "No available targets are compatible with this triple." problem.
$ emcc hello.c -s WASM=1 -o hello.html
WARNING root: LLVM version appears incorrect (seeing "(https://github.com/kripken/emscripten-fastcomp-clang/", expected "3.4")
INFO root: (Emscripten: Running sanity checks)
WARNING root: Assigning a non-existent settings attribute "WASM"
WARNING root: - did you mean one of ASM_JS?
WARNING root: - perhaps a typo in emcc's -s X=Y notation?
WARNING root: - (see src/settings.js for valid values)
/home/casper/Desktop/test/emsdk/clang/fastcomp/build_incoming_64/bin/lli: error creating EE: No available targets are compatible with this triple.
FAIL: Running the generated program failed!
How to solve it?
EMCC Version
$ emcc --version
emcc (Emscripten GCC-like replacement) 1.22.1 ()
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Basic Information
OS : Ubuntu 16.10
emcc Location: /usr/bin/emcc
You're running emcc version 1.22.1 which dates back from 8/7/2014, before WebAssembly was started.
emsdk in the instruction you followed must have installed a very recent emscripten version (this is what sdk-incoming-64bit from these instructions does: incoming is the latest branch), but an older emscripten is found in your system.
Run:
which emcc
echo $PATH
What do they say? I suspect you have an old emscripten lying in there. You probably also want to check and/or delete your ~/.emscripten file which may also contain obsolete information.
You can alter your path, delete the older emscripten, or invoke the SDK's emscripten using its absolute path (though this may fail later if other scripts pick up older versions along the path).
Don't forget (from the tutorial's instructions) to activate the SDK you've installed:
./emsdk activate --build=Release sdk-incoming-64bit binaryen-master-64bit
And run:
source ./emsdk_env.sh
This last command needs to be run for every shell session. If you open a new shell you need to re-source then SDK.

Building R package krb5 from source

I'm trying to install the package krb5 from source available on rforge rforge.
To do so I use the following command within RStudio (1.0.136) with R (3.3.1) on Windows 7.
install.packages("krb5",,"http://rforge.net/",type="source")
Unfortunately this results in the following error:
* installing *source* package 'krb5' ...
** libs
*** arch - i386
c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c k.c -o k.o
k.c:1:18: fatal error: krb5.h: No such file or directory
#include <krb5.h>
^
compilation terminated.
make: *** [k.o] Error 1
Warnung: Ausführung von Kommando 'make -f "Makevars" -f "C:/PROGRA~1/R/R-33~1.1/etc/i386/Makeconf" -f "C:/PROGRA~1/R/R-33~1.1/share/make/winshlib.mk" SHLIB="krb5.dll" OBJECTS="k.o"' ergab Status 2
ERROR: compilation failed for package 'krb5'
* removing 'C:/Users/Fabian Desktop/Documents/R/win-library/3.3/krb5'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l "C:\Users\User\Documents\R\win-library\3.3" C:\Users\User\AppData\Local\Temp\RtmpCOnG2U/downloaded_packages/krb5_0.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘krb5’ had non-zero exit status
It seems as if the file "krb5.h" wasn't found. This makes sense since the package builds on MIT's Kerberos project available here.
The problem I am facing is that I've never built a C-project. Therefore I do not know how to "combine" the two projects or where to add the MIT-project to the R package such that it is available for the R package when building it. A short step by step guide I should take to make this working is much appreciated.
Caveat: I know nothing about the specifics of package krb5. But read on ...
A common pattern with Rcpp package is that they are interfaces between R on the one hand, and an external library on the other hand.
In order to compile code that connects two such worlds, you need header files and libraries from both. R covers its own side.
But krb5 likely only gives you the ability to talk Kerboros backends provided you have Kerberos (development) software installed. In other words krb5 is likely a gateway Kerberos, not Kerberos itself.

Cannot install macvim due to Xcode as "pre-release"

I'm trying to upgrade my Vim to MacVim by running:
$ brew install macvim --with--override-system-vim
I'm getting this error message saying that the package cannot be compiled:
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/private/tmp/macvim-20161028-10122-1pp1odr/macvim-snapshot-113/src':
configure: error: C compiler cannot create executables
See `config.log' for more details
I have Xcode 8.1 installed on my machine. But brew seems to think it's a pre-release version:
Warning: You are using a pre-release version of Xcode.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.

error installing BRugs "C compiler cannot create executables"

I am trying to install the R library BRugs on my Ubuntu 12.04 desktop.
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
But I get the following error:
* installing *source* package ‘BRugs’ ...
** package ‘BRugs’ successfully unpacked and MD5 sums checked
checking for prefix by checking for OpenBUGS... /usr/bin/OpenBUGS
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/RtmpnNLTG1/R.INSTALL488b7635d4c0/BRugs':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘BRugs’
* removing ‘/home/myuser/lib/R/BRugs’
Warning in install.packages("BRugs") :
installation of package ‘BRugs’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp2ytOWn/downloaded_packages’
Here is a link to config.log. It is difficult to tell what the error is, except that the errors starts with gcc: error: unrecognized option '-V'.
How can I get around this error (and install BRugs)?
According to the package description:
Versions running on Linux and on 64-bit R under Windows are in "beta"
status and less efficient.
And it looks like configure is trying to build the package using 32-bit executables (note the -m32 flags). It's probably best if you contact the package maintainer(s) and ask them how to build the 32-bit executable under 64-bit Ubuntu.

Resources