Ironholds / rgeolocate

Generalised IP geolocation through R
https://cran.r-project.org/web/packages/rgeolocate/index.html
Other
66 stars 22 forks source link

rgeolocate failed to compile from CRAN #45

Closed ashlevitt closed 4 years ago

ashlevitt commented 7 years ago

Tried install.packages("rgeolocate") and received the following errors:

`3 errors generated. make: *** [maxmind.o] Error 1 ERROR: compilation failed for package ‘rgeolocate’

Ironholds commented 7 years ago

Were there any additional errors, and what platform are you on?

ashlevitt commented 7 years ago

There were no other errors.

I was using:

R version 3.4.1 RStudio version 1.1.383 macOS Sierra version 10.12.6

Hope that helps. Let me know if you'd like me to try anything again.

On Mon, Nov 6, 2017 at 7:43 PM, Oliver Keyes notifications@github.com wrote:

Were there any additional errors, and what platform are you on?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Ironholds/rgeolocate/issues/45#issuecomment-342263373, or mute the thread https://github.com/notifications/unsubscribe-auth/ARuEtBDKkQhoPYzwAT4B-A-oCFxZUdgEks5sz2FSgaJpZM4QEr7U .

Ironholds commented 7 years ago

Have you tried installing from the binary rather than from source?

Ironholds commented 6 years ago

Hmn; now I'm running into weird errors - it looks like the way R3.4.0 is handling C++ is causing some issues. Let me see...

Ironholds commented 6 years ago

@wrathematics any idea why rgeolocate'd fail on R3.4.0 on macs? I've run into issues compiling it myself and can sort of conceptually get what changed with 3.4.0, but am not sure how this package specifically comes into it - is it because of the extensive makevars tweakery?

wrathematics commented 6 years ago

Not sure. I don't have access to a Mac myself. Can you post the log?

It's building fine on Linux. Even with -Wall -pedantic -Wextra I only see a handful of "variable set but not used" warnings.

Ironholds commented 6 years ago

Overall output:


In file included from maxmind.cpp:1:
In file included from ./maxmind.h:4:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/RcppCommon.h:51:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iostream:38:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ios:216:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__locale:18:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/mutex:189:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__mutex_base:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:156:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:300:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port() {
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__threading_support:301:12: error: use of undeclared identifier 'pthread_mach_thread_np'
    return pthread_mach_thread_np(pthread_self());
           ^
3 errors generated.
make: *** [maxmind.o] Error 1
ERROR: compilation failed for package ‘rgeolocate’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgeolocate’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rgeolocate’

Exited with status 1.

Specific errors:

screen shot 2017-11-09 at 6 31 47 pm

My only hypothesis (from the fact that it's on mac, and the fact that it's mutex-related) is that it pertains to R's decision that in the absence of OSX supporting a decent toolchain for modern C++ and fortran it'd just ship one internally, and the package is relying on the system compiler, which is missing functionality R and Rcpp expect, and then raspberry. There's a thread at https://github.com/RcppCore/Rcpp/issues/682 which I can just about follow but don't know how to integrate or if it's actually the problem :/.

wrathematics commented 6 years ago

Weird. What happens if you put #include <mach/mach_types.h> before the first line of maxmind.cpp ?

Ironholds commented 6 years ago

Iii..no longer know because I just upgraded to High Sierra at which point the problem fixed itself. macs. @ashlevitt what happens if you bump up to High Sierra?

wrathematics commented 6 years ago

You could try rhub for testing. They have macos-elcapitan-release and macos-mavericks-oldrel platforms, matching what's on CRAN.

Incidentally, the package is passing CRAN's checks on 10.9 but failing on 10.11 https://cran.r-project.org/web/checks/check_results_rgeolocate.html

ashlevitt commented 6 years ago

I haven't upgraded to High Sierra yet, and probably won't be able to until this weekend. I'll let you know what happens once I do.

On Thu, Nov 9, 2017 at 10:23 PM, Oliver Keyes notifications@github.com wrote:

Iii..no longer know because I just upgraded to High Sierra at which point the problem fixed itself. macs. @ashlevitt https://github.com/ashlevitt what happens if you bump up to High Sierra?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ironholds/rgeolocate/issues/45#issuecomment-343371401, or mute the thread https://github.com/notifications/unsubscribe-auth/ARuEtHKHU0KFuMMsEUMqH6aDPsGyBEPAks5s08_AgaJpZM4QEr7U .

Ironholds commented 6 years ago

Thanks both!

Ironholds commented 6 years ago

How weird - r-hub's 10.11 is fine with it! https://builder.r-hub.io/status/rgeolocate_1.1.90000.tar.gz-012ad8b5f3f94e55b0a319fe3d79d20c

ashlevitt commented 6 years ago

I upgraded to High Sierra today, and tried to install it again, and it failed again. Here's what I see in my R console:

install.packages("rgeolocate") Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘rgeolocate’ Do you want to attempt to install these from sources? y/n: y installing the source package ‘rgeolocate’

trying URL 'https://cran.rstudio.com/src/contrib/rgeolocate_1.0.1.tar.gz' Content type 'application/x-gzip' length 1331328 bytes (1.3 MB)

downloaded 1.3 MB

Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) : unknown timezone 'default/America/Chicago'

Let me know if there's anything else you'd like me to try.

On Fri, Nov 10, 2017 at 4:59 PM, Oliver Keyes notifications@github.com wrote:

How weird - r-hub's 10.11 is fine with it! https://builder.r-hub.io/ status/rgeolocate_1.1.90000.tar.gz-012ad8b5f3f94e55b0a319fe3d79d20c

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ironholds/rgeolocate/issues/45#issuecomment-343609221, or mute the thread https://github.com/notifications/unsubscribe-auth/ARuEtFCmu8PrWvZ5DmEfclLcA3iR0XDrks5s1NVBgaJpZM4QEr7U .

Ironholds commented 6 years ago

'checking whether the C compiler works...no' seems to be the operant line. HUH. Do you have xcode and the related developer tools installed?

ashlevitt commented 6 years ago

I have devtools installed. I don't have xcode. I tried installing it and it said xcode not available for R 3.4.1.

Also, my background is more in analysis/stats, not programming, so I'm pretty naive on diagnosing/resolving issues like this. But I'm willing to help if you provide the guidance.

On Mon, Nov 13, 2017 at 12:23 PM, Oliver Keyes notifications@github.com wrote:

'checking whether the C compiler works...no' seems to be the operant line. HUH. Do you have xcode and the related developer tools installed?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ironholds/rgeolocate/issues/45#issuecomment-344011068, or mute the thread https://github.com/notifications/unsubscribe-auth/ARuEtA0lyYyXYr4_z_k_-0L-I8ZNkd35ks5s2IkwgaJpZM4QEr7U .

Ironholds commented 6 years ago

Ah, sorry, my bad - xcode is a mac package rather than an R package. See here!

bearloga commented 6 years ago

Another weird issue: compiling with clang++ worked for me (you need to install Xcode Command Line Tools via xcode-select --install after installing Xcode from Mac App Store)

What didn't work for me was using g++-7:

g++-7 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I"/Users/mpopov/Library/R/3.4/library/Rcpp/include" -I/usr/local/include   -fPIC  -O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -flto -ffat-lto-objects  -Wno-unused-local-typedefs -Wno-ignored-attributes -Wno-deprecated-declarations -c maxmind.cpp -o maxmind.o
In file included from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/system_error:39:0,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/bits/ios_base.h:46,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ios:42,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/ostream:38,
                 from /usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/iterator:64,
                 from /Users/mpopov/Library/R/3.4/library/Rcpp/include/RcppCommon.h:49,
                 from /Users/mpopov/Library/R/3.4/library/Rcpp/include/Rcpp.h:27,
                 from maxmind.h:4,
                 from maxmind.cpp:1:
/usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/x86_64-apple-darwin16.7.0/bits/error_constants.h:135:24: error: 'EOWNERDEAD' was not declared in this scope
       owner_dead =     EOWNERDEAD,
                        ^~~~~~~~~~
/usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/x86_64-apple-darwin16.7.0/bits/error_constants.h:151:34: error: 'ENOTRECOVERABLE' was not declared in this scope
       state_not_recoverable =    ENOTRECOVERABLE,
                                  ^~~~~~~~~~~~~~~
/usr/local/Cellar/gcc/7.2.0/include/c++/7.2.0/x86_64-apple-darwin16.7.0/bits/error_constants.h:151:34: note: suggested alternative: 'NO_RECOVERY'
       state_not_recoverable =    ENOTRECOVERABLE,
                                  ^~~~~~~~~~~~~~~
                                  NO_RECOVERY
make: *** [maxmind.o] Error 1
ERROR: compilation failed for package ‘rgeolocate’
wrathematics commented 6 years ago

Hmm. What happens if you add PKG_LIBS = -lpthread as a new line to src/Makevars.in?

bearloga commented 6 years ago

Same error

Ironholds commented 6 years ago

https://github.com/RcppCore/Rcpp/pull/742/files more detail here. Is it as simple as: one must find R's internal C++ compiler and ping off that if it's available?

Ironholds commented 6 years ago

I wonder if https://github.com/envoyproxy/envoy/pull/1785 is the source..

Ironholds commented 6 years ago

(I mean, well, not SOURCE but an example of the same underlying problem)

Ironholds commented 6 years ago

@ashlevitt @bearloga any change in this as time and updates progress?

bearloga commented 6 years ago

Installing via devtools::install_github and installing from CRAN worked now for me! :D Current environment:

Ironholds commented 6 years ago

Yay! :D

ashlevitt commented 6 years ago

Sorry for the delay. I've been swamped with work getting ready for a huge tradeshow starting tomorrow and going for a week. I'll take a look again when I get back.

On Sat, Jan 20, 2018 at 12:02 AM, Oliver Keyes notifications@github.com wrote:

@ashlevitt https://github.com/ashlevitt @bearloga https://github.com/bearloga any change in this as time and updates progress?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Ironholds/rgeolocate/issues/45#issuecomment-359148518, or mute the thread https://github.com/notifications/unsubscribe-auth/ARuEtE_tipXBRJCPGLZXMWbbXNEk6GzRks5tMYGHgaJpZM4QEr7U .

Ironholds commented 6 years ago

That's totally fair! I hope it goes well!

sara-lumos commented 6 years ago

I'm getting the same errors as shown by @Ironholds above:

In file included from maxmind.cpp:1:
In file included from ./maxmind.h:4:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/Rcpp.h:27:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/RcppCommon.h:60:
In file included from /usr/local/clang4/bin/../include/c++/v1/iostream:38:
In file included from /usr/local/clang4/bin/../include/c++/v1/ios:216:
In file included from /usr/local/clang4/bin/../include/c++/v1/__locale:18:
In file included from /usr/local/clang4/bin/../include/c++/v1/mutex:189:
In file included from /usr/local/clang4/bin/../include/c++/v1/__mutex_base:17:
/usr/local/clang4/bin/../include/c++/v1/__threading_support:156:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port();
^
/usr/local/clang4/bin/../include/c++/v1/__threading_support:300:1: error: unknown type name 'mach_port_t'
mach_port_t __libcpp_thread_get_port() {
^
/usr/local/clang4/bin/../include/c++/v1/__threading_support:301:12: error: use of undeclared identifier 'pthread_mach_thread_np'
    return pthread_mach_thread_np(pthread_self());
           ^
3 errors generated.
make: *** [maxmind.o] Error 1

Adding #include <mach/mach_types.h> on the first line of maxmind.cpp as suggested by @wrathematics takes care of the first two errors, but not the third (use of undeclared identifier 'pthread_mach_thread_np'). Attempting to install from CRAN vs github produces the same errors.

Environment:

Ironholds commented 6 years ago

Now that's just confusing. Darn! Upping the mac to 10.13 do anything?

sara-lumos commented 6 years ago

Unfortunately, I'm not at liberty to upgrade to High Sierra just yet (company machine). Any chance of a compilation workaround for Sierra?

Ironholds commented 6 years ago

I'd love to, but I'm still not sure what causes that third error :(. I assume some other R package has had to patch around whatever is causing it, but..