Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to install H3 for R #35

Closed
su-park opened this issue Aug 18, 2020 · 9 comments
Closed

Failed to install H3 for R #35

su-park opened this issue Aug 18, 2020 · 9 comments

Comments

@su-park
Copy link

su-park commented Aug 18, 2020

I failed to install H3 for R on my mac.

I tried to install it using devtools but got the error as follows.

I guess it occurs when I try to install h3 for C but I know no other ways to fix it.

( based on your guidance I already installed 'cmake' and 'make' before the job )

can you give me hands for this?

If you need more information for my environments let me know.

`h3_hex-ring.cpp:2:10: fatal error: 'h3/h3api.h' file not found
#include <h3/h3api.h>
^~~~~~~~~~~~
1 error generated.
make: *** [h3_hex-ring.o] Error 1
ERROR: compilation failed for package ‘h3’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/h3’
    Error: Failed to install 'h3' from GitHub:
    (converted from warning) installation of package ‘/var/folders/vc/khw6v0g10wggw3ygs5_k_nk80000gn/T//RtmpcmlKxz/file12ba2af5644b/h3_3.3.2.tar.gz’ had non-zero exit status`
@crazycapivara
Copy link
Owner

crazycapivara commented Aug 18, 2020

Hi @su-park,

Before running devtools::install() you need to install the H3 C library.

The easiest way is to run the script included in the repo:

git clone https://github.com/crazycapivara/h3-r.git
pushd h3-r
chmod +x install-h3c.sh
# Install H3 C Library
./install-h3c.sh

# Install H3 for R
R -q -e 'devtools::install()'
popd
rm -rf h3-r

@crazycapivara
Copy link
Owner

See install-h3c.sh

@su-park
Copy link
Author

su-park commented Aug 18, 2020

Thank you for responding swiftly.

Actually, I have tried it but got the same message.

For some reason, installation code for H3 for R can't load h3 for C I guess.

`h3_hex-ring.cpp:2:10: fatal error: 'h3/h3api.h' file not found
#include <h3/h3api.h>
^~~~~~~~~~~~
1 error generated.
make: *** [h3_hex-ring.o] Error 1
ERROR: compilation failed for package ‘h3’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/h3’`

@crazycapivara
Copy link
Owner

Does install-h3c.sh run without errors?
Can you for example run geoToH3 from the console afterwards?

Error points out that the h3 C library is not found.

@crazycapivara
Copy link
Owner

It looks in /usr/local/lib/ for the h3 C lib.

@su-park
Copy link
Author

su-park commented Aug 19, 2020

No.

It looks in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/ for the h3 C lib.

It worked for me.

I guess you need to check the assigned path for h3api.h.

Thanks anyway!

@crazycapivara
Copy link
Owner

That's fine. So, what did you do that it works for you.

In Makevars the path for additional libs is defined.
This works on Linux systems I have tested so far and on the Travis OSX VM.

@isaacbrodsky
Copy link

This looks very similar to an issue I ran into when working on uber/h3#381, where h3/h3api.h isn't found after installing on OSX. I think there may have been a regression (probably in H3 3.6.4) where the installed H3 target doesn't set /usr/local/include as an include directory. I see this version of H3 isn't used in the install script here.

I wonder if what happened was that H3 version 3.6.4 (or master) was installed first, and then that installation was not usable.

@su-park su-park closed this as completed Aug 24, 2020
@JosiahParry
Copy link

Just as a note: the easiest way I've found to install on OS X was with brew install h3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants