Open szhorvat opened 6 months ago
It seems things are going wrong when rigraphlite
finds the external C/igraph library on my system (version 0.10.12) and tries to use that. If I uninstall it, then the rigraphlite
installation succeeds.
Looking more carefully, I can see that the issue is that rigraphlite
requires a 32-bit igraph_integer_t
, while on most systems igraph is configured with a 64-bit integer. Thus it might make sense to not try to use an external library at all, since it will almost never be compatible.
I'm not sure if there's a good way to communicate package configuration, such as IGRAPH_INTEGER_SIZE
, though CMake packages.
But in the source code you can protect for this with something like
#if IGRAPH_INTEGER_SIZE != 32
#error "rigraphlite requires igraph to be configured with a 32-bit integer size"
#endif
I now exposed IGRAPH_INTEGER_SIZE
through igraph's CMake package file, see https://github.com/igraph/igraph/pull/2606 This will be available in the next igraph version, either 0.10.13 or 1.0, whichever comes first. The you will be able to check whether the external igraph is suitable, directly from CMake.
Thank you very much for trying this package and giving a close look at the installation problems. You are absolutely right. Currently this package requires IGRAPH_INTEGER_SIZE=32
for efficient conversion (or for doing many things without conversion) between igraph_vector_int_t
and Rcpp::IntegerVector
.
Thus it might make sense to not try to use an external library at all, since it will almost never be compatible.
This seems to be the way to go for now. I will try IGRAPH_INTEGER_SIZE
exposed by igraph CMake in the near future. In the long run, of course, this package should become compatible with general 64-bit installation.
When I try to install this package on macOS, I get errors such as:
I am using macOS. The toolchain and dependencies are installed using MacPorts. A full installation transcript, as well as my
.R/Makevars
file are included. Note that I needed to disableccache
in theMakevars
file, something I didn't need to do for other R packages.Terminal transcript
``` ~ $ R R version 4.4.0 (2024-04-24) -- "Puppy Cup" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: aarch64-apple-darwin20 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > devtools::install_github("heavywatal/rigraphlite") Using GitHub PAT from the git credential store. Downloading GitHub repo heavywatal/rigraphlite@HEAD ββ R CMD build ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β checking for file β/private/var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T/Rtmp6tjzsQ/remotes155d0d55dcf2/heavywatal-rigraphlite-9de3d45/DESCRIPTIONβ ... β preparing βigraphliteβ: β checking DESCRIPTION meta-information ... β cleaning src β running βcleanupβ β checking for LF line-endings in source and make files and shell scripts β checking for empty or unneeded directories β building βigraphlite_0.10.12.tar.gzβ * installing *source* package βigraphliteβ ... ** using staged installation cmake version 3.29.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). CXX: /opt/local/bin/clang++-mp-18 PWD: /private/var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T/RtmpKH0PaR/R.INSTALL156242fb50693/igraphlite R_PACKAGE_DIR: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/00LOCK-igraphlite/00new/igraphlite IGRAPH_INSTALL_PREFIX: FINAL_INSTDIR: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/igraphlite BUILD_DIR: /var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T//RtmpKH0PaR/igraphlite-build rm: /var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T//RtmpKH0PaR/igraphlite-build/CMake*: No such file or directory -- The C compiler identification is Clang 18.1.5 -- The CXX compiler identification is Clang 18.1.5 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /opt/local/bin/clang-mp-18 - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /opt/local/bin/clang++-mp-18 - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- CMAKE_CURRENT_SOURCE_DIR="/private/var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T/RtmpKH0PaR/R.INSTALL156242fb50693/igraphlite/src" -- CMAKE_PREFIX_PATH="/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/00LOCK-igraphlite/00new/igraphlite" -- igraph_FOUND="1" ; igraph_DIR="/opt/local/lib/cmake/igraph" -- CMAKE_INSTALL_PREFIX="/opt/local" -- CPPFLAGS="-I/opt/local/include" -- LDFLAGS="-L/opt/local/lib -Wl,-rpath,/opt/local/lib" -- Configuring done (0.7s) -- Generating done (0.0s) -- Build files have been written to: /var/folders/fm/9634rg5100n44pfnr7g5r94c0000gq/T/RtmpKH0PaR/igraphlite-build ninja: no work to do. -- Install configuration: "" -- /opt/local/lib/cmake/igraph ** libs using C++ compiler: βclang version 18.1.5β using SDK: ββ /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c basic.cpp -o basic.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c generators.cpp -o generators.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c igraph.cpp -o igraph.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c init.cpp -o init.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c layout.cpp -o layout.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c methods.cpp -o methods.o /opt/local/bin/clang++-mp-18 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DSTRICT_R_HEADERS -I/opt/local/include -I'/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/Rcpp/include' -I/opt/local/include -fPIC -falign-functions=64 -Wall -g -O2 -c structural.cpp -o structural.o In file included from structural.cpp:3: In file included from ./vector.hpp:7In file included from : methods.cpp:./policy.hpp2:: 71In file included from :./adjlist.hpp5::9 : ./policy.hpp:71:5: error: no matching function for call to 'igraph_vector_int_init_array' error: 71 | inog rmatchinga pfunctionh _forv ector_int_callinit_ar ray(dtoa t'igraph_vector_int_init_array'a, &(x [0]), x.size()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 71 | igraph_vector_int_init_array(data, &(x[0]), x.size()); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/include/igraph/igraph_vector_pmt.h:30:30/opt/local/include/igraph/igraph_vector_pmt.h::30 :30:note: candidate note: function not viable: no known conversioncandidate function not viable: from 'const typename storage_type<13>::type *' no known conversion from 'const typename storage_type<13>::type *' (aka 'const int *') to 'const igraph_integer_t *' (aka 'const long long *') for 2nd (aka 'const int *')argument 30to | IGRAPH_ E'const igraph_integer_t *'X P(aka 'const long long *')ORT igr aforp h2nd_ eargumentrr or_t FUNCTION(i g30r | aIpGhR_AvPeHc_tEoXrP,O RiTnit_ar ray)(i g r| ap ^h _ 31 | error_t FUNCTTION(igraph_vYePctor, init_Ea(igraph_vectror)* v,r const BASE*a data, igraph_iynteger)_t lengt(h); | ~~~~~~~~~~~~~~~~ | ^/opt/local/include/igraph/igraph_pmt.h :177:31: note: expanded from macro 31'FUNCTION' | 177 | #defin e FUNC TION(a,c) CONCA T3(a,SH ORT,c)T Y | ^ P/opt/local/include/igraph/igraph_pmt.h:27:24:E (ignote: raexpandedp hfrom_ vmacroe c'CONCAT3' t27 | #define CoONCAT3(a,b,c) COrNCAT3x(a,b,)c) | ^ /opt/local/include/igraph/igraph_pmt.h:26:*25: note: expanded from macro 'CONCAT3x' 26 | #dvefine C,ONCAT3x(a,b ,c) a #c#o n_ ## b s## _ ## tc | ^ B.R/Makevars file
``` #CCACHE=/opt/local/bin/ccache CC = $(CCACHE) /opt/local/bin/clang-mp-18 CXX = $(CCACHE) /opt/local/bin/clang++-mp-18 CXX11 = $(CCACHE) /opt/local/bin/clang++-mp-18 FC = $(CCACHE) /opt/local/bin/gfortran-mp-13 F77 = $(CCACHE) /opt/local/bin/gfortran-mp-13 FLIBS = -L/opt/local/lib/libgcc -lgfortran -lquadmath -lm -Wl,-rpath /opt/local/lib/gcc13 CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib MAKEFLAGS = -j8 CFLAGS = -Wno-unused-but-set-variable -Wno-uninitialized -O3 ```