pneuvial / adjclust

Adjacency-constrained hierarchical clustering of a similarity matrix
https://pneuvial.github.io/adjclust/
16 stars 8 forks source link

[macOS] `adjclust` 0.6.9 fails to build with Clang #81

Open barracuda156 opened 6 months ago

barracuda156 commented 6 months ago
  --->  Building R-adjclust
  DEBUG: Executing proc-pre-org.macports.build-build-0
  xinstall: mkdir /opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build
  DEBUG: Executing org.macports.build (R-adjclust)
  DEBUG: Environment: 
  CC_PRINT_OPTIONS='YES'
  CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/.CC_PRINT_OPTIONS'
  CPATH='/opt/local/include'
  DEVELOPER_DIR='/Library/Developer/CommandLineTools'
  LIBRARY_PATH='/opt/local/lib'
  MACOSX_DEPLOYMENT_TARGET='11.0'
  SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk'
  Executing:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
  DEBUG: system:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
  * installing *source* package ‘adjclust’ ...
  ** package ‘adjclust’ successfully unpacked and MD5 sums checked
  ** using staged installation
  ** libs
  using C compiler: ‘clang version 15.0.7’
  using C++ compiler: ‘clang version 15.0.7’
  using SDK: ‘MacOSX11.3.sdk’
  /opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64  -c RcppExports.cpp -o RcppExports.o
  /opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64  -c adjClustFast.cpp -o adjClustFast.o
  In file included from adjClustFast.cpp:89:
  /opt/local/include/libomp/omp.h:27:12: error: expected unqualified-id
      extern "C" {
             ^
  1 error generated.
  make: *** [adjClustFast.o] Error 1
  ERROR: compilation failed for package ‘adjclust’
  * removing ‘/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build/adjclust’
  Command failed:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
tuxette commented 6 months ago

Thanks for the information @barracuda156 ! I don't get why you have this error: CRAN check indicates that adjclust 0.6.9 has been properly built for MAC OS + clang: https://cran.r-project.org/web/checks/check_results_adjclust.html

Can you use the binary version released on CRAN? (Sorry if my question is stupid: I am really not a MAC expert.)

barracuda156 commented 6 months ago

@tuxette CRAN uses a handicapped Clang without OpenMP support, maybe due to that? I.e. Xcode clang [perhaps] just bypasses this: https://github.com/pneuvial/adjclust/blob/04636176f0f9a23f6049caac6e9c1495f4813e20/src/adjClustFast.cpp#L88-L91

For the context: I want to update adjclust port in Macports, and for that I need it to build with Clang and GCC both. GCC works, Clang does not, as of now.

P. S. If you happen to have some Apple hardware, this should be reproducible via sudo port -vs install R-adjclust. But existing in Macports version will likely build fine, only the new one fails.

tuxette commented 6 months ago

OK. So, I don't have any apple hardware but I'll try to fix this nevertheless. Last version of adjclust included a similar command, except that parallel for num_threads(nthreads) was replaced by parallel if parallel_on (parallel_on was a boolean indicating that OPENMP was enabled). Were you able to compile the previous version of the package?

barracuda156 commented 6 months ago

Yes, previous version built fine both with Clang (x86_86 / arm64) and GCC (ppc), new one fails with Clang – I just verified locally on Sonoma / arm64.

0.6.8

Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/R-adjclust/adjclust_0.6.8.tar.gz' | /usr/bin/tar -xf - 
--->  Configuring R-adjclust
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD build . --no-manual --no-build-vignettes --keep-empty-dirs 
* checking for file ‘./DESCRIPTION’ ... OK
* preparing ‘adjclust’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking vignette meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘adjclust_0.6.8.tar.gz’

--->  Building R-adjclust
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
* installing *source* package ‘adjclust’ ...
** package ‘adjclust’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘clang version 15.0.7’
using C++ compiler: ‘clang version 15.0.7’
using SDK: ‘MacOSX14.2.sdk’
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c RcppExports.cpp -o RcppExports.o
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c adjClustFast.cpp -o adjClustFast.o
/opt/local/bin/clang-mp-15 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk    -fPIC  -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c mainFunctions.c -o mainFunctions.o
/opt/local/bin/clang++-mp-15 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/opt/local/Library/Frameworks/R.framework/Resources/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-rpath,/opt/local/lib/libgcc -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -o adjclust.so RcppExports.o adjClustFast.o mainFunctions.o -fopenmp -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/local/lib/gcc12/gcc/arm64-apple-darwin23/12.3.0 -L/opt/local/lib/gcc12 -lgfortran -lemutls_w -lquadmath -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build/00LOCK-adjclust/00new/adjclust/libs
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (adjclust)

0.6.9

--->  Extracting adjclust_0.6.9.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/R-adjclust/adjclust_0.6.9.tar.gz' | /usr/bin/tar -xf - 
--->  Configuring R-adjclust
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD build . --no-manual --no-build-vignettes --keep-empty-dirs 
* checking for file ‘./DESCRIPTION’ ... OK
* preparing ‘adjclust’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking vignette meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘adjclust_0.6.9.tar.gz’

--->  Building R-adjclust
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
* installing *source* package ‘adjclust’ ...
** package ‘adjclust’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘clang version 15.0.7’
using C++ compiler: ‘clang version 15.0.7’
using SDK: ‘MacOSX14.2.sdk’
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c RcppExports.cpp -o RcppExports.o
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64  -c adjClustFast.cpp -o adjClustFast.o
In file included from adjClustFast.cpp:89:
/opt/local/include/libomp/omp.h:27:12: error: expected unqualified-id
    extern "C" {
           ^
1 error generated.
make: *** [adjClustFast.o] Error 1
ERROR: compilation failed for package ‘adjclust’
* removing ‘/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build/adjclust’
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
Exit code: 1
Error: Failed to build R-adjclust: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port R-adjclust failed
tuxette commented 6 months ago

I guess I found the problem...: this is just me being stupid! I removed the initial command lines checking if OPENMP was enabled and correctly reintroduced the check in some places (like the one you show) but not everywhere... https://github.com/pneuvial/adjclust/blob/04636176f0f9a23f6049caac6e9c1495f4813e20/src/adjClustFast.cpp#L251-L254

tuxette commented 6 months ago

I'll fix that but can that wait a few days (or one week)? Sorry for the inconvenience...

tuxette commented 6 months ago

Before I submit the package to the CRAN, will it be possible for you to test the compilation (I'll send you the tarball archive)?

barracuda156 commented 6 months ago

@tuxette Yes, sure, please, I can verify it builds with Clang and GCC at least on my test systems. Please tag me once you commit a fix, I can just build locally from a given commit or apply it as a patch.

tuxette commented 6 months ago

@barracuda156 : I think it's done in commit https://github.com/pneuvial/adjclust/commit/12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b Can you confirm? If so, I'll update the version number and push the package to the CRAN.

barracuda156 commented 6 months ago

@tuxette Thank you for addressing the issue! Yes, it builds with Clang for me now:

--->  Building R-adjclust
xinstall: mkdir /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build
Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
* installing *source* package ‘adjclust’ ...
** using staged installation
** libs
using C compiler: ‘clang version 15.0.7’
using C++ compiler: ‘clang version 15.0.7’
using SDK: ‘’
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include      -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -c RcppExports.cpp -o RcppExports.o
/opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include      -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -arch x86_64  -c adjClustFast.cpp -o adjClustFast.o
/opt/local/bin/clang-mp-15 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include    -fPIC  -pipe -Os -arch x86_64  -c mainFunctions.c -o mainFunctions.o
/opt/local/bin/clang++-mp-15 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-rpath,/opt/local/lib/libgcc -arch x86_64 -o adjclust.so RcppExports.o adjClustFast.o mainFunctions.o -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_R_R-adjclust/R-adjclust/work/build/00LOCK-adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b/00new/adjclust/libs
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (adjclust)

I also confirmed it builds fine with GCC (just to make sure nothing got broken accidentally):

--->  Building R-adjclust
xinstall: mkdir /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-adjclust/R-adjclust/work/build
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-adjclust/R-adjclust/work/adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-adjclust/R-adjclust/work/build --install-tests 
* installing *source* package ‘adjclust’ ...
** using staged installation
** libs
using C compiler: ‘gcc-mp-13 (MacPorts gcc13 13.2.0_4+stdlib_flag) 13.2.0’
using C++ compiler: ‘g++-mp-13 (MacPorts gcc13 13.2.0_4+stdlib_flag) 13.2.0’
Warning in system2("xcrun", "--show-sdk-path", TRUE, TRUE) :
  running command ''xcrun' --show-sdk-path 2>&1' had status 64
using SDK: ‘NA’‘NA’‘NA’‘NA’‘NA’‘NA’
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include      -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -arch ppc  -c RcppExports.cpp -o RcppExports.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include      -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -arch ppc  -c adjClustFast.cpp -o adjClustFast.o
/opt/local/bin/gcc-mp-13 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc  -c mainFunctions.c -o mainFunctions.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -Wl,-headerpad_max_install_names -L/opt/local/lib -lMacportsLegacySupport -Wl,-rpath,/opt/local/lib/libgcc -arch ppc -o adjclust.so RcppExports.o adjClustFast.o mainFunctions.o -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-adjclust/R-adjclust/work/build/00LOCK-adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b/00new/adjclust/libs
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (adjclust)

P. S. By the way, it does not seem to check for OpenMP support at all: GCC does support it, but the package does not add -fopenmp flag.

tuxette commented 6 months ago

Thanks! I'll work on this flag issue before submitting it then. I thought it was OK but I must have missed something.

barracuda156 commented 6 months ago

@tuxette This is perhaps not super-critical, but desirable to have fixed. Thank you.

AFAIK, gcc supports OpenMP as a given and normally just needs -fopenmp (including on macOS). For clang it is needed to check if libomp is present, since it may not be, and Apple clangs do not support OpenMP at all. Clang will need -lomp to be passed in addition to -fopenmp. (It is perhaps OK just to disable OpenMP for clangs or for Apple clangs, as a simple solution, and only pass -fopenmp with gcc.)

barracuda156 commented 4 months ago

@tuxette Have you had a chance to deal with this? And maybe make a new release then?

barracuda156 commented 4 months ago

Building from 12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b on CI I got this now:

2024-04-21T12:23:08.2388830Z --->  Building R-adjclust
2024-04-21T12:23:08.2393190Z DEBUG: Executing proc-pre-org.macports.build-build-0
2024-04-21T12:23:08.2400890Z xinstall: mkdir /opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build
2024-04-21T12:23:08.2402130Z DEBUG: Executing org.macports.build (R-adjclust)
2024-04-21T12:23:08.2423760Z DEBUG: Environment: 
2024-04-21T12:23:08.2424510Z CC_PRINT_OPTIONS='YES'
2024-04-21T12:23:08.2425770Z CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/.CC_PRINT_OPTIONS'
2024-04-21T12:23:08.2426920Z CPATH='/opt/local/include'
2024-04-21T12:23:08.2428180Z DEVELOPER_DIR='/Library/Developer/CommandLineTools'
2024-04-21T12:23:08.2428840Z LIBRARY_PATH='/opt/local/lib'
2024-04-21T12:23:08.2429290Z MACOSX_DEPLOYMENT_TARGET='12.0'
2024-04-21T12:23:08.2429930Z SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk'
2024-04-21T12:23:08.2433970Z Executing:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
2024-04-21T12:23:08.2438550Z DEBUG: system:  cd "/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/adjclust-12e9dd8c5fd57f6a18d383ee03eb6853c0f0901b" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_Users_runner_work_macports-ports_macports-ports_ports_R_R-adjclust/R-adjclust/work/build --install-tests 
2024-04-21T12:23:08.5792870Z * installing *source* package ‘adjclust’ ...
2024-04-21T12:23:08.5802140Z ** using staged installation
2024-04-21T12:23:08.6182910Z ** libs
2024-04-21T12:23:08.8278680Z using C compiler: ‘clang version 15.0.7’
2024-04-21T12:23:08.9451470Z using C++ compiler: ‘clang version 15.0.7’
2024-04-21T12:23:08.9596920Z using SDK: ‘MacOSX12.3.sdk’
2024-04-21T12:23:08.9786890Z /opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64  -c RcppExports.cpp -o RcppExports.o
2024-04-21T12:23:25.5192050Z /opt/local/bin/clang++-mp-15 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/RcppArmadillo/include' -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk   -fopenmp   -DARMA_64BIT_WORD=1 -fPIC  -pipe -Os -stdlib=libc++ -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64  -c adjClustFast.cpp -o adjClustFast.o
2024-04-21T12:23:36.6809370Z In file included from adjClustFast.cpp:89:
2024-04-21T12:23:36.6810520Z /opt/local/include/libomp/omp.h:28:12: error: expected unqualified-id
2024-04-21T12:23:36.6811140Z     extern "C" {
2024-04-21T12:23:36.6811450Z            ^
2024-04-21T12:23:37.9400200Z 1 error generated.
2024-04-21T12:23:37.9573020Z make: *** [adjClustFast.o] Error 1
tuxette commented 4 months ago

@barracuda156 : You're right, I'm too slow. It's still on my TODO list (so I see it everyday) but my TODO list is insane at the moment (and until end of May). If that's not too urgent, I'd rather handle it in June. Sorry for that...

tuxette commented 2 weeks ago

Hello @barracuda156 : Very sorry for the very long delay for my answer. I am on it and a bit puzzled at the moment: I can only test very precisely on linux and the -fopenmp flag is included during compilation. I also don't understand the difference between what happened in February and what you got in April. Everything is still fine on CRAN checks (and I think that r-devel-linux-x86_64-fedora-clang is using clang with openMP support). I'm a bit stuck and need to read more documentation. If by chance you have any lead that I could follow, do not hesitate to tell me.

barracuda156 commented 2 weeks ago

@tuxette I am not really sure why this fails with clang for us since my testing system only uses gcc, which has no problem with OpenMP. (I have a setup with clang just to run the build, but I do not know how clang handles this stuff.)

Difference in results might have been caused by Apple Xcode (SDK) changes, potentially.

I can try re-running CI for the existing version and see how it goes.

P. S. If you have access to Apple hardware, issue should be reproducible.

tuxette commented 2 weeks ago

Thanks @barracuda156 : I am in the process of getting my hands on a MAC (probably next week) to try to make sense of this.