Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If fetching tarball fails, build should err out at that point and not proceed to fail at linking: ld: library not found for -lsundials_idas #9

Open
barracuda156 opened this issue Dec 16, 2024 · 4 comments

Comments

@barracuda156
Copy link

This way of building it is fragile:

--->  Extracting sundialr_0.1.6.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/R-sundialr/sundialr_0.1.6.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
--->  Configuring R-sundialr
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/sundialr" && /opt/local/bin/R CMD build . --no-manual --no-build-vignettes --keep-empty-dirs 
* checking for file ‘./DESCRIPTION’ ... OK
* preparing ‘sundialr’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
* 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 ‘sundialr_0.1.6.tar.gz’

--->  Building R-sundialr
xinstall: mkdir /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/build
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/sundialr" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/build --install-tests 
* installing *source* package ‘sundialr’ ...
** package ‘sundialr’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether /opt/local/bin/g++-mp-13 -std=gnu++17 accepts -g... yes
checking for /opt/local/bin/g++-mp-13 -std=gnu++17 option to enable C++11 features... none needed
checking how to run the C++ preprocessor... /opt/local/bin/g++-mp-13 -std=gnu++17 -E
checking whether the compiler supports GNU C++... (cached) yes
checking whether /opt/local/bin/g++-mp-13 -std=gnu++17 accepts -g... (cached) yes
checking for /opt/local/bin/g++-mp-13 -std=gnu++17 option to enable C++11 features... (cached) none needed
checking for cmake... /opt/local/bin/cmake
set CMAKE_BIN=/opt/local/bin/cmake
trying URL 'https://github.com/LLNL/sundials/releases/download/v7.2.0/sundials-7.2.0.tar.gz'
Content type 'application/octet-stream' length 94348468 bytes (90.0 MB)
======
downloaded 11.2 MB

Error in download.file(url = "https://github.com/LLNL/sundials/releases/download/v7.2.0/sundials-7.2.0.tar.gz",  : 
  download from 'https://github.com/LLNL/sundials/releases/download/v7.2.0/sundials-7.2.0.tar.gz' failed
In addition: Warning messages:
1: In download.file(url = "https://github.com/LLNL/sundials/releases/download/v7.2.0/sundials-7.2.0.tar.gz",  :
  downloaded length 11698030 != reported length 94348468
2: In download.file(url = "https://github.com/LLNL/sundials/releases/download/v7.2.0/sundials-7.2.0.tar.gz",  :
  URL 'https://objects.githubusercontent.com/github-production-release-asset-2e65be/105918649/555777cc-d942-4795-ac9b-989816606d53?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241216%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241216T134011Z&X-Amz-Expires=300&X-Amz-Signature=280f79491fcd4853c64d0cb2a3e03a062bd3ac49d9fb58d3775fc98ea70d96d6&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dsundials-7.2.0.tar.gz&response-content-type=application%2Foctet-stream': Timeout of 60 seconds was reached
Execution halted

gzip: stdin: unexpected end of file
/opt/local/bin/gtar: Unexpected EOF in archive
/opt/local/bin/gtar: Unexpected EOF in archive
/opt/local/bin/gtar: Error is not recoverable: exiting now
Warning message:
In utils::untar(tarfile = "sundials-7.2.0.tar.gz") :
  '/opt/local/bin/gtar -xf 'sundials-7.2.0.tar.gz'' returned error code 2
set CC=/opt/local/bin/gcc-mp-13
set CFLAGS=-isystem/opt/local/include/LegacySupport -I/opt/local/include -fPIC -pipe -Os -arch ppc
set CXX=/opt/local/bin/g++-mp-13
set CXXFLAGS=-std=gnu++11 -isystem/opt/local/include/LegacySupport -I/opt/local/include -fPIC -pipe -Os -arch ppc
set LDFLAGS=-Wl,-headerpad_max_install_names -L/opt/local/lib -lMacportsLegacySupport -Wl,-rpath,/opt/local/lib/libgcc -arch ppc
-- The C compiler identification is GNU 13.3.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/gcc-mp-13 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at CMakeLists.txt:39 (include):
  include could not find requested file:

    SundialsCMakeMacros


CMake Error at CMakeLists.txt:51 (sundials_git_version):
  Unknown CMake command "sundials_git_version".


-- Configuring incomplete, errors occurred!
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
mv: rename sundials-src/src/* to ./sundials/*: No such file or directory
configure: creating ./config.status
config.status: creating src/Makevars
** libs
using C++ compiler: ‘g++-mp-13 (MacPorts gcc13 13.3.0_2+stdlib_flag) 13.3.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../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -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../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c check_retval.cpp -o check_retval.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c cvode.cpp -o cvode.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c cvodes.cpp -o cvodes.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c cvsolve.cpp -o cvsolve.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c ida.cpp -o ida.o
/opt/local/bin/g++-mp-13 -std=gnu++17 -I"/opt/local/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include/ -I./inst/ -DHAVE_CONFIG_H -DARMA_USE_CXX11 -I./sundials/sundials  -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/Rcpp/include' -I'/opt/local/Library/Frameworks/R.framework/Versions/4.4/Resources/library/RcppArmadillo/include' -isystem/opt/local/include/LegacySupport -I/opt/local/include    -fPIC  -pipe -Os -arch ppc   -c rhs_func.cpp -o rhs_func.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 sundialr.so RcppExports.o check_retval.o cvode.o cvodes.o cvsolve.o ida.o rhs_func.o -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/opt/local/Library/Frameworks/R.framework/Resources/lib -lRblas -lMacportsLegacySupport -lgfortran -lSystemStubs -lef_ppc -L../inst/lib -L../inst/lib -lsundials_idas -lsundials_cvodes -lsundials_nvecserial -lsundials_sunlinsoldense -lsundials_sunmatrixdense -lsundials_core -lm -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory '../inst/lib' following -L not found
ld: warning: directory '../inst/lib' following -L not found
ld: library not found for -lsundials_idas
collect2: error: ld returned 1 exit status
make: *** [sundialr.so] Error 1
ERROR: compilation failed for package ‘sundialr’
* removing ‘/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/build/sundialr’
Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/sundialr" && /opt/local/bin/R CMD INSTALL . --library=/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-sundialr/R-sundialr/work/build --install-tests 
Exit code: 1
Error: Failed to build R-sundialr: command execution failed

Once fetching a tarball fails, perhaps it should just err out with a clear message, rather than trying to build a package and fail at linking.

@bastistician
Copy link

Similarly, if make or make install fail further down in tools/cmake_call.sh, the script should exit with an error, too.

(Problem observed in an exotic setup, where the package tarball is extracted and R CMD INSTALL is run by a different user than the one owning the files; make install tries to replace files in CMAKE_INSTALL_PREFIX=../../inst by downloaded files ...)

sn248 added a commit that referenced this issue Dec 16, 2024
See the changes suggested at #9
@sn248
Copy link
Owner

sn248 commented Dec 16, 2024

Thanks! I have made the following updates

if [ $? -ne 0 ]; then

if [ $? -ne 0 ]; then

if [ $? -ne 0 ]; then

to error out.

@sn248 sn248 closed this as completed Dec 18, 2024
@bastistician
Copy link

I'm afraid the fix is incomplete. Currently, errors from these scripts are not propagated:

  1. cmake_call.sh ignores the exit status from sundials_download.sh.
  2. configure[.ac] ignores the exit status from tools/cmake_call.sh.

@sn248
Copy link
Owner

sn248 commented Dec 19, 2024

Thanks!, I will make changes similar to checks used above to the cmake_call.sh and configure.ac file.

@sn248 sn248 reopened this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants