Failed to created shared library after OS update

341 views
Skip to first unread message

Ann Raiho

unread,
Aug 16, 2022, 2:13:16 PM8/16/22
to nimble-users
Hello Nimble Users,

I'm having trouble compiling the first example from the user manual - pumpMiss - after recently updating my OS. 

I'm using:
- 2019 MacBook Pro
- macOS Monterey Version 12.5
- R version 4.2.1
- X code version 13.4.1 with command line tools

I've tried reinstalling R, Xcode, and command line tools.

Let me know if you need more info.

Ann

===============================================

Compiler Output:

Error: Failed to create the shared library.
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DR_NO_REMAP   -DEIGEN_MPL2_ONLY=1 -I"/Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include" -Wno-misleading-indentation -Wno-ignored-attributes -Wno-deprecated-declarations  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include   -fPIC  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c dynamicRegistrations_08_16_12_05_57.cpp -o dynamicRegistrations_08_16_12_05_57.o
warning: unknown warning option '-Wno-misleading-indentation'; did you mean '-Wno-binding-in-condition'? [-Wunknown-warning-option]
In file included from dynamicRegistrations_08_16_12_05_57.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/RcppUtils.h:26:
In file included from /usr/local/clang7/include/c++/v1/string:500:
In file included from /usr/local/clang7/include/c++/v1/string_view:176:
In file included from /usr/local/clang7/include/c++/v1/__string:56:
In file included from /usr/local/clang7/include/c++/v1/algorithm:642:
In file included from /usr/local/clang7/include/c++/v1/cstring:61:
/usr/local/clang7/include/c++/v1/string.h:74:64: error: use of undeclared identifier 'strchr'
char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__s, __c);}
                                                               ^
/usr/local/clang7/include/c++/v1/string.h:81:75: error: use of undeclared identifier 'strpbrk'
char* __libcpp_strpbrk(const char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}
                                                                          ^
/usr/local/clang7/include/c++/v1/string.h:88:65: error: use of undeclared identifier 'strrchr'; did you mean 'strchr'?
char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(__s, __c);}
                                                                ^
/usr/local/clang7/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
/usr/local/clang7/include/c++/v1/string.h:95:76: error: use of undeclared identifier 'memchr'
void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (void*)memchr(__s, __c, __n);}
                                                                           ^
/usr/local/clang7/include/c++/v1/string.h:102:74: error: use of undeclared identifier 'strstr'; did you mean 'strchr'?
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
                                                                         ^
/usr/local/clang7/include/c++/v1/string.h:78:13: note: 'strchr' declared here
      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
/usr/local/clang7/include/c++/v1/string.h:102:74: error: no matching function for call to 'strchr'
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
                                                                         ^
/usr/local/clang7/include/c++/v1/string.h:78:13: note: candidate disabled: <no message provided>
      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
/usr/local/clang7/include/c++/v1/string.h:102:81: error: cannot initialize a parameter of type 'char *' with an lvalue of type 'const char *'
char* __libcpp_strstr(const char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}
                                                                                ^~~~
/usr/local/clang7/include/c++/v1/string.h:78:32: note: passing argument to parameter '__s' here
      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}
                               ^
In file included from dynamicRegistrations_08_16_12_05_57.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/RcppUtils.h:26:
In file included from /usr/local/clang7/include/c++/v1/string:500:
In file included from /usr/local/clang7/include/c++/v1/string_view:176:
In file included from /usr/local/clang7/include/c++/v1/__string:56:
In file included from /usr/local/clang7/include/c++/v1/algorithm:642:
/usr/local/clang7/include/c++/v1/cstring:70:9: error: no member named 'memcpy' in the global namespace; did you mean 'memchr'?
using ::memcpy;
      ~~^
/usr/local/clang7/include/c++/v1/string.h:97:13: note: 'memchr' declared here
const void* memchr(const void* __s, int __c, size_t __n) {return __libcpp_memchr(__s, __c, __n);}
            ^
In file included from dynamicRegistrations_08_16_12_05_57.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/RcppUtils.h:26:
In file included from /usr/local/clang7/include/c++/v1/string:500:
In file included from /usr/local/clang7/include/c++/v1/string_view:176:
In file included from /usr/local/clang7/include/c++/v1/__string:56:
In file included from /usr/local/clang7/include/c++/v1/algorithm:642:
/usr/local/clang7/include/c++/v1/cstring:71:9: error: no member named 'memmove' in the global namespace
using ::memmove;
      ~~^
/usr/local/clang7/include/c++/v1/cstring:72:9: error: no member named 'strcpy' in the global namespace; did you mean 'strchr'?
using ::strcpy;
      ~~^
/usr/local/clang7/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
In file included from dynamicRegistrations_08_16_12_05_57.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/RcppUtils.h:26:
In file included from /usr/local/clang7/include/c++/v1/string:500:
In file included from /usr/local/clang7/include/c++/v1/string_view:176:
In file included from /usr/local/clang7/include/c++/v1/__string:56:
In file included from /usr/local/clang7/include/c++/v1/algorithm:642:
/usr/local/clang7/include/c++/v1/cstring:73:9: error: no member named 'strncpy' in the global namespace
using ::strncpy;
      ~~^
/usr/local/clang7/include/c++/v1/cstring:74:9: error: no member named 'strcat' in the global namespace; did you mean 'strchr'?
using ::strcat;
      ~~^
/usr/local/clang7/include/c++/v1/string.h:76:13: note: 'strchr' declared here
const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}
            ^
In file included from dynamicRegistrations_08_16_12_05_57.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27:
In file included from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/nimble/include/nimble/RcppUtils.h:26:
In file included from /usr/local/clang7/include/c++/v1/string:500:
In file included from /usr/local/clang7/include/c++/v1/string_view:176:
In file included from /usr/local/clang7/include/c++/v1/__string:56:
In file included from /usr/local/clang7/include/c++/v1/algorithm:642:
/usr/local/clang7/include/c++/v1/cstring:75:9: error: no member named 'strncat' in the global namespace
using ::strncat;
      ~~^
/usr/local/clang7/include/c++/v1/cstring:76:9: error: no member named 'memcmp' in the global namespace; did you mean 'memchr'?
using ::memcmp;
      ~~^
/

Perry de Valpine

unread,
Aug 16, 2022, 3:05:02 PM8/16/22
to Ann Raiho, nimble-users
Hi Ann, 
Thanks for the report.
I haven't yet accepted the current Mac OS X update, so I'm not sure, but in the past it was sometimes necessary after a major OS X update to run Xcode once outside of nimble before nimble could use it successfully.  When run separately, Xcode would take a one-time authentication when it was first opened, and then after that it would work fine from nimble.  Any chance that solves it?
Perry

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/CALGFJyPEae15imNsbtZ9JRRp2Oc6%2BoCid4ZxBo6qYyuoOobpug%40mail.gmail.com.

Ann Raiho

unread,
Aug 16, 2022, 5:02:38 PM8/16/22
to Perry de Valpine, nimble-users
Hey Perry,

I did try that and I got the same compiler error.

Ann

Duncan Temple Lang

unread,
Aug 16, 2022, 5:06:10 PM8/16/22
to Ann Raiho, Perry de Valpine, nimble-users
Hi Ann

You might check the output of the  shell command-line call
xcode-select -p

If the output doesn't say something like  /Library/Developer/CommandLineTools, but instead says ..../Developer, you probably need to set it, e.g.,

sudo xcode-select -s /Library/Developer/CommandLineTools
See SO question.

Worth a try.
D.



--
===============================
Duncan Temple Lang
Associate Dean for Graduate Programs
Professor, Department of Statistics
UC Davis

Ann Raiho

unread,
Aug 17, 2022, 11:23:39 AM8/17/22
to Duncan Temple Lang, Perry de Valpine, nimble-users
Hi Duncan,

Thank you for the response. I made this change but still can't compile pumpMIss. Maybe I need to make a similar change within R?

Let me know what you think,
Ann

Ann Raiho

unread,
Aug 18, 2022, 12:39:53 PM8/18/22
to Duncan Temple Lang, Perry de Valpine, nimble-users
Hey Perry and Duncan,

After reinstalling Xcode, commandline tools, and R, I just deleted my .R/Makevars and then it worked. Hopefully there aren't other consequences to doing that but I saved the Makevars I had before so probably all good. 

Thanks for your responses!
Ann

On Tue, Aug 16, 2022 at 3:06 PM Duncan Temple Lang <dtemp...@ucdavis.edu> wrote:

Perry de Valpine

unread,
Aug 18, 2022, 3:29:22 PM8/18/22
to Ann Raiho, Duncan Temple Lang, nimble-users
Thanks for following up with that solution, Ann, in case it helps anyone else too!

Laura Kinney

unread,
Aug 25, 2022, 1:59:09 PM8/25/22
to nimble-users
I am having this same problem and have tried so many things to no avail.. I reinstalled xcode, commandline tools, and R... where can i find the .R/Makevars file?

Laura Kinney

unread,
Aug 25, 2022, 2:51:52 PM8/25/22
to nimble-users
My error message has changed slightly now: 

Error: Failed to create the shared library. clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DR_NO_REMAP   -DEIGEN_MPL2_ONLY=1 -I"/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/nimble/include" -Wno-misleading-indentation -Wno-ignored-attributes -Wno-deprecated-declarations  -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c dynamicRegistrations_08_25_12_44_29.cpp -o dynamicRegistrations_08_25_12_44_29.o clang-10: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] In file included from dynamicRegistrations_08_25_12_44_29.cpp:1: In file included from /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/nimble/include/nimble/dynamicRegistrations.h:27: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/nimble/include/nimble/RcppUtils.h:26:10: fatal error: 'string' file not found #include <string>          ^~~~~~~~ 1 error generated. make: *** [/Library/Frameworks/R.framework/Resources/etc/Makeconf:175: dynamicRegistrations_08_25_12_44_29.o] Error 1

Perry de Valpine

unread,
Aug 25, 2022, 3:05:46 PM8/25/22
to Laura Kinney, nimble-users
Hi Laura,
These are hard for us to diagnose.  Have you tried the steps suggested by me (guessing) and then Duncan in the 2nd and 4th messages in this thread?
Perry

Laura Kinney

unread,
Aug 25, 2022, 3:33:48 PM8/25/22
to nimble-users
Hi Perry, Yes..very hard and annoying to diagnose for sure.. I have tried your and Duncan's suggestions. I can't find a .R/Makevars file but have tried everything else in this thread. I have a first generation M1 chip if that makes any difference.. 

Duncan Temple Lang

unread,
Aug 25, 2022, 3:53:18 PM8/25/22
to Laura Kinney, nimble-users
Hi Laura, Perry
 -c
Look to see if there is a directory ~/.R, i.e. $HOME/.R.   If it is there,see if contains a file named Makevars or Makevars-...  which may be for a platform-specific file.
It is an optional file one can use to override some of R's make configuration variable.
R uses this file (if it exists) and also the one in R_HOME/etc${R_ARCH}/Makeconf

These are places to explore what command line arguments are being given.

From the error message, the command line seems to start with
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DR_NO_REMAP   -DEIGEN_MPL2_ONLY=1 -I"/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/nimble/include" -Wno-misleading-indentation -Wno-ignored-attributes -Wno-deprecated-declarations  -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c dynamicRegistrations_08_25_12_44_29.cpp -o

There is a bit after the -o that is truncated but probably not important.

Perhaps put the following code
#include <string>

int
foo(std::string x)
{
    return(x.size());
}

into a file named, say, str.cc and then give the shell command

clang++ -c str.cc

and see what errors come from that. You can share the whole output  with us.

Also, run the shell command
 R CMD config CXX
and see what the output for that is - hopefully  the same instance of clang++ as you are finding on your shel's own path.

D.



Message has been deleted

Laura Kinney

unread,
Aug 29, 2022, 6:41:10 PM8/29/22
to nimble-users
Hi Duncan,

Thank you for your response. This is all very over my head so appreciate your help and patience with me :) My Makevars file is empty so I don't think that is the issue. 

The result of running  R CMD config CXX is:
x86_64-apple-darwin13.4.0-clang++ -std=gnu++11

This doesn't match the error message portion: "clang++ -arch arm64 -std=gnu++14". I don't really know what all that means but maybe that tells us something?


Running the little code you suggested gives lots of error messages:

In file included from str.cc:1:

In file included from /Users/Laura/anaconda3/bin/../include/c++/v1/cstring:60:

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:73:64: error: use of

      undeclared identifier 'strchr'

char* __libcpp_strchr(const char* __s, int __c) {return (char*)strchr(__...

                                                               ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:80:75: error: use of

      undeclared identifier 'strpbrk'

  ...char* __s1, const char* __s2) {return (char*)strpbrk(__s1, __s2);}

                                                  ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:87:65: error: use of

      undeclared identifier 'strrchr'; did you mean 'strchr'?

char* __libcpp_strrchr(const char* __s, int __c) {return (char*)strrchr(...

                                                                ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:75:13: note: 'strchr'

      declared here

const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:94:49: error: unknown type

      name 'size_t'

void* __libcpp_memchr(const void* __s, int __c, size_t __n) {return (voi...

                                                ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:96:46: error: unknown type

      name 'size_t'

const void* memchr(const void* __s, int __c, size_t __n) {return __libcp...

                                             ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:98:46: error: unknown type

      name 'size_t'

      void* memchr(      void* __s, int __c, size_t __n) {return __libcp...

                                             ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:101:74: error: use of

      undeclared identifier 'strstr'; did you mean 'strchr'?

  ...char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}

                                                  ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:77:13: note: 'strchr'

      declared here

      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:101:74: error: no matching

      function for call to 'strchr'

  ...char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}

                                                  ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:77:13: note: candidate

      disabled: <no message provided>

      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:101:81: error: cannot

      initialize a parameter of type 'char *' with an lvalue of type

      'const char *'

  ...char* __s1, const char* __s2) {return (char*)strstr(__s1, __s2);}

                                                         ^~~~

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:77:32: note: passing

      argument to parameter '__s' here

      char* strchr(      char* __s, int __c) {return __libcpp_strchr(__s, __c);}

                               ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:68:9: error: no member

      named 'size_t' in the global namespace

using ::size_t;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:69:9: error: no member

      named 'memcpy' in the global namespace; did you mean 'memchr'?

using ::memcpy;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:98:13: note: 'memchr'

      declared here

      void* memchr(      void* __s, int __c, size_t __n) {return __libcp...

            ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:70:9: error: no member

      named 'memmove' in the global namespace

using ::memmove;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:71:9: error: no member

      named 'strcpy' in the global namespace; did you mean 'strchr'?

using ::strcpy;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:75:13: note: 'strchr'

      declared here

const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:72:9: error: no member

      named 'strncpy' in the global namespace

using ::strncpy;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:73:9: error: no member

      named 'strcat' in the global namespace; did you mean 'strchr'?

using ::strcat;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:75:13: note: 'strchr'

      declared here

const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:74:9: error: no member

      named 'strncat' in the global namespace

using ::strncat;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:75:9: error: no member

      named 'memcmp' in the global namespace; did you mean 'memchr'?

using ::memcmp;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:98:13: note: 'memchr'

      declared here

      void* memchr(      void* __s, int __c, size_t __n) {return __libcp...

            ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:76:9: error: no member

      named 'strcmp' in the global namespace; did you mean 'strchr'?

using ::strcmp;

      ~~^

/Users/Laura/anaconda3/bin/../include/c++/v1/string.h:75:13: note: 'strchr'

      declared here

const char* strchr(const char* __s, int __c) {return __libcpp_strchr(__s, __c);}

            ^

In file included from str.cc:1:

/Users/Laura/anaconda3/bin/../include/c++/v1/cstring:77:9: error: no member

      named 'strncmp' in the global namespace

using ::strncmp;

      ~~^

fatal error: too many errors emitted, stopping now [-ferror-limit=]

20 errors generated.


I don't know what any of this means but hopefully someone else will be able to decipher this.. Thank you again for your help! 

Laura Kinney

unread,
Aug 30, 2022, 1:57:50 AM8/30/22
to nimble-users
Well I uninstalled anaconda and now all of my issues are fixed.. I might want anaconda again in the future but for now this is better than not being able to run anything.. Definitely an M1 issue. R was trying to use the anaconda c++ compiler I had downloaded which seems to be made for intel. The latest version of anaconda says it has native M1 support but I tried to reinstall it and had the same issue.. 

Perry de Valpine

unread,
Sep 2, 2022, 7:03:00 PM9/2/22
to Laura Kinney, nimble-users
Thanks for the follow-up.  What a pain and congrats on getting through it.

Reply all
Reply to author
Forward
0 new messages