pievos101 / PopGenome

An Efficient Swiss Army Knife for Population Genomic Analyses in R
30 stars 4 forks source link

Compilation errors occurring during the installation of the package due to compatibility issues with the C++ code and the macOS SDK. #13

Open Tuc-Nguyen opened 4 months ago

Tuc-Nguyen commented 4 months ago

This is the error code

devtools::install_github("pievos101/PopGenome")
Downloading GitHub repo pievos101/PopGenome@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/6_/_ygsg2w97vl00r8mbrqx081r0000gn/T/RtmpCfUQzb/remotesb4121a672927/pievos101-PopGenome-ab39ee8/DESCRIPTION’ ...
─  preparing ‘PopGenome’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  looking to see if a ‘data/datalist’ file should be added
─  building ‘PopGenome_2.7.7.tar.gz’

* installing *source* package ‘PopGenome’ ...
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c whopgenome/readdnapp.cpp -o whopgenome/readdnapp.o
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:966:34: error: too many arguments provided to function-like macro invocation
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
                                 ^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:969:9: note: macro 'length' defined here
#define length(x)               Rf_length(x)
        ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:965:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:891:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:870:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
                         ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:966:15: error: expected ';' at end of declaration list
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1052:34: error: too many arguments provided to function-like macro invocation
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
                                 ^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:969:9: note: macro 'length' defined here
#define length(x)               Rf_length(x)
        ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1051:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:891:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:870:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
                         ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1052:15: error: expected ';' at end of declaration list
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1137:34: error: too many arguments provided to function-like macro invocation
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
                                 ^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:969:9: note: macro 'length' defined here
#define length(x)               Rf_length(x)
        ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1136:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:891:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:870:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
                         ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1137:15: error: expected ';' at end of declaration list
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
              ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1313:34: error: too many arguments provided to function-like macro invocation
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
                                 ^
/Library/Frameworks/R.framework/Resources/include/Rinternals.h:969:9: note: macro 'length' defined here
#define length(x)               Rf_length(x)
        ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1312:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
    _LIBCPP_INLINE_VISIBILITY
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:891:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
#  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:870:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
          __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_ODR_SIGNATURE))))
                         ^
In file included from whopgenome/readdnapp.cpp:43:
In file included from whopgenome/whop_rsupport.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/vector:321:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_bool.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__format/formatter_integral.h:32:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:202:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:1313:15: error: expected ';' at end of declaration list
    int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
              ^
In file included from whopgenome/readdnapp.cpp:817:
whopgenome/rdnapp_Phylip.h:99:12: warning: variable 'samplenameidx' set but not used [-Wunused-but-set-variable]
                for( int samplenameidx=0; c != ' ';samplenameidx++)
                         ^
In file included from whopgenome/readdnapp.cpp:823:
whopgenome/rdnapp_MAF.h:495:30: warning: array subscript is of type 'char' [-Wchar-subscripts]
                c = (int)nucleotide_mapping['-'];
                                           ^~~~
whopgenome/rdnapp_MAF.h:280:6: warning: variable 'currentalignmentoffset' set but not used [-Wunused-but-set-variable]
                                        currentalignmentoffset=0        //where the current alignment-block begins
                                        ^
3 warnings and 12 errors generated.
make: *** [whopgenome/readdnapp.o] Error 1
ERROR: compilation failed for package ‘PopGenome’
* removing ‘/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/library/PopGenome’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/6_/_ygsg2w97vl00r8mbrqx081r0000gn/T//RtmpCfUQzb/fileb4123a55576f/PopGenome_2.7.7.tar.gz’ had non-zero exit status

This is what chatgpt suggested:

It seems like there are compilation errors occurring during the installation of the PopGenome package from GitHub. The errors are related to compatibility issues with the C++ code and the macOS SDK.

The primary error seems to be caused by a conflict between a function-like macro named length in the PopGenome C++ code and another macro of the same name in the R internals (Rinternals.h). This conflict arises because both macros are named length. The C++ compiler is likely picking up the macro definition from R internals, which leads to compilation errors.

One potential solution could be to modify the PopGenome C++ code to avoid using variable names or function names that conflict with those defined in R internals.

Another potential solution could involve modifying the compilation flags to ensure that the C++ code is compiled correctly with respect to the macOS SDK.

mvsantosherp commented 1 week ago

Hi @Tuc-Nguyen!

Did you manage to fix this issue? I'm having the same problem while installing popgenome in R version 4.4.1