`later` package not compiling on MacOS ("unknown type name uuid_t")

I get the following errors when trying to install the later package on MacOS. The error message includes: "unknown type name 'uuid_t'". On Ubuntu it is usually enough to install dev library when this type of error occurs, but I am not sure what to do on MacOS. Any ideas?

clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.3_1/lib/R/include" -DNDEBUG -pthread -DSTRICT_R_HEADERS -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I"/usr/local/lib/R/3.6/site-library/BH/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include  -fPIC  -g -O2  -c later_posix.cpp -o later_posix.o
In file included from later_posix.cpp:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: 
      C++ requires a type specifier for all declarations
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTIN...
                ^
In file included from later_posix.cpp:6:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:662:27: error: 
      unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getsgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 
      'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from later_posix.cpp:6:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:664:27: error: 
      unknown type name 'uuid_t'; did you mean 'uid_t'?
int      getwgroups_np(int *, uuid_t);
                              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 
      'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from later_posix.cpp:6:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:727:31: error: 
      unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setsgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 
      'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
In file included from later_posix.cpp:6:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:729:31: error: 
      unknown type name 'uuid_t'; did you mean 'uid_t'?
int      setwgroups_np(int, const uuid_t);
                                  ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uid_t.h:31:31: note: 
      'uid_t' declared here
typedef __darwin_uid_t        uid_t;
                              ^
5 errors generated.
make: *** [later_posix.o] Error 1
ERROR: compilation failed for package ‘later’
* removing ‘/usr/local/lib/R/3.6/site-library/later’

1 Like

I have a similar problem when trying to install dplyr:

install.packages("dplyr")
In file included from RcppExports.cpp:4:
In file included from ./../inst/include/dplyr.h:4:
In file included from ../inst/include/dplyr/main.h:6:
In file included from ../inst/include/dplyr/workarounds/static_assert.h:17:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config.hpp:57:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/platform/macos.hpp:28:
In file included from /usr/local/lib/R/3.6/site-library/BH/include/boost/config/detail/posix_features.hpp:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:655:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/gethostuuid.h:39:17: error: C++ requires a type
      specifier for all declarations
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_NA);

I tried this on MacOS Catalina, 10.15.3 running R version 3.6.3 (2020-02-29) with command line tools installed.

This is a (meanwhile) known regression with Rcpp 1.0.4, c.f. http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2020-March/010411.html

As a workaround you can install a fixed version from upstream's drat rpository, e.g.:

install.packages("Rcpp", repos="https://RcppCore.github.io/drat")
7 Likes

I have the same issue trying to build dplyr for R 4.0 (Unsuffered Consequences) on MacOSX Catalina. Any workarounds?

I'm seeing similar error messages when trying to install the readxl and dplyr packages in R 3.6.3 om Mac Mojave.

install.packages("readxl", type = "source")

In file included from /Users/sm*****et/Library/R/3.6/library/progress/include/RProgress.h:6:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:732:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int setwgroups_np(int, const uuid_t);

install.packages("dplyr", type = "source")

In file included from /Users/sm***et/Library/R/3.6/library/BH/include/boost/config/detail/posix_features.hpp:18:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:732:31: error: unknown type name 'uuid_t'; did you mean 'uid_t'?
int setwgroups_np(int, const uuid_t);

Rstubs fix, i.e., install.packages("Rcpp", repos="https://RcppCore.github.io/drat")

fixed my dplyr and readxl install problems.

Thanks!

Have you tried to install the fixed version from the drat repository as I suggested?

Is there a drat version of dplyr? I tried:

install.packages("dplyr", repos = "https://RcppCore.github.io/drat ")

I am not aware of a drat version of dplyr. However, that should not be necessary. After installing Rcpp from drat, you can install dplyr either from CRAN for the released version or from GH for the development version.

I think the problem is the type uuid_t is not defined at anywhere. So the declaration at line 662 in the file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h will cause error for example.

In the first attempt, I tried to add one line into that unistd.h file:
#include <sys/_types/_uuid_t.h> at line 83. But it doesn't help.

Because I don't want to go deeper to edit many system file, I add another line into unistd.h to manually define the type of uuid_t, based on the definition in _uuid_t.h.
typedef __darwin_uuid_t uuid_t; at line 661, after "#endif".

Then it worked.

I am not sure if this is an error in the source code of MacOSX.10.15.sdk or not. But if you want to fix it in this way, please make sure you have the root permission when editing those files.

1 Like

Many thanks for your insights ptdtan! It was very helpful :slight_smile:

I've been using MacOSX 10.14.sdk and the same issue rose everywhere.

I commented the lines 28 and 32 in the file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_uuid_t.h:

28: /* #ifndef _UUID_T */
29: #define _UUID_T
30: #include <sys/_types.h> /* __darwin_uuid_t */
31: typedef __darwin_uuid_t	uuid_t;
32: /* #endif */ /* _UUID_T */

It worked by now.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.