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

[liblantern CPU compilation ubuntu 22 ] leads to liblantern.so: undefined symbol: #1107

Closed
cregouby opened this issue Sep 29, 2023 · 2 comments

Comments

@cregouby
Copy link
Collaborator

Current behavior

Trying to build from Rstudio the torch project onto UBUNTU 22.04 CPU with env BUILD_LANTERN=1 leads to the following error at the end of the building log

[100%] Linking CXX shared library liblantern.so
make[3] : on quitte le répertoire « /home/xxx/R/_packages/torch/build-lantern »
[100%] Built target lantern
make[2] : on quitte le répertoire « /home/xxx/R/_packages/torch/build-lantern »
Install the project...
-- Install configuration: ""
-- Installing: /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so
-- Set runtime path of "/home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so" to "$ORIGIN"
-- Installing: /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/include/lantern/lantern.h
-- Installing: /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/include/lantern/types.h
gmake[1] : on quitte le répertoire « /home/xxx/R/_packages/torch/build-lantern »
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o torch.so RcppExports.o amp.o autograd.o backends.o codegen.o contrib.o cuda.o device.o dimname_list.o dtype.o gen-namespace.o generator.o indexing.o ivalue.o jit-compile.o jit-execute.o lantern.o layout.o memory_format.o nn_utils_rnn.o qscheme.o quantization.o reduction.o save.o scalar.o script_module.o stack.o storage.o tensor.o tensor_list.o torch_api.o torch_exports.o trace.o utils.o variable_list.o xptr.o -L/usr/lib/R/lib -lR
ℹ*** Renaming torch lib to torchpkg
"/usr/lib/R/bin/Rscript" "../tools/renamelib.R"
installing to /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
Avis : ℹ torch failed to start, restart your R session to try again.
ℹ You might need to reinstall torch using `install_torch()`
✖ /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so
-
  /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so:
  undefined symbol:
  _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
Caused by error in `cpp_lantern_init()` at torch/R/lantern_load.R:13:2:
  ! /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so - /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so: undefined symbol: _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Avis : ℹ torch failed to start, restart your R session to try again.
ℹ You might need to reinstall torch using `install_torch()`
✖ /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so
-
  /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so:
  undefined symbol:
  _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
Caused by error in `cpp_lantern_init()` at torch/R/lantern_load.R:13:2:
  ! /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so - /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/00LOCK-torch/00new/torch/lib/liblantern.so: undefined symbol: _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
Avis : ℹ torch failed to start, restart your R session to try again.
ℹ You might need to reinstall torch using `install_torch()`
✖ /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/torch/lib/liblantern.so -
  /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/torch/lib/liblantern.so:
  undefined symbol:
  _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
Caused by error in `cpp_lantern_init()` at torch/R/lantern_load.R:13:2:
  ! /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/torch/lib/liblantern.so - /home/xxx/R/x86_64-pc-linux-gnu-library/4.3/torch/lib/liblantern.so: undefined symbol: _ZN2at4_ops25reflection_pad1d_backward4callERKNS_6TensorES4_N3c108ArrayRefINS5_6SymIntEEE
** testing if installed package keeps a record of temporary installation path
* DONE (torch)

Expected behavior

correct build so I can run tests part of my Pull Request before submitting...

Context

Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=fr_FR.UTF-8      
 [2] LC_NUMERIC=C              
 [3] LC_TIME=fr_FR.UTF-8       
 [4] LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8   
 [6] LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8      
 [8] LC_NAME=C                 
 [9] LC_ADDRESS=C              
[10] LC_TELEPHONE=C            
[11] LC_MEASUREMENT=fr_FR.UTF-8
[12] LC_IDENTIFICATION=C       

time zone: Europe/Paris
tzcode source: system (glibc)

attached base packages:
character(0)

other attached packages:
[1] torch_0.11.0.9002

loaded via a namespace (and not attached):
 [1] digest_0.6.33     methods_4.3.1    
 [3] coro_1.0.3        fastmap_1.1.1    
 [5] xfun_0.40         bit_4.0.5        
 [7] magrittr_2.0.3    bspm_0.5.1       
 [9] knitr_1.44        htmltools_0.5.6  
[11] rmarkdown_2.25    bit64_4.0.5      
[13] utils_4.3.1       ps_1.7.5         
[15] cli_3.6.1         processx_3.8.2   
[17] callr_3.7.3       graphics_4.3.1   
[19] grDevices_4.3.1   stats_4.3.1      
[21] compiler_4.3.1    base_4.3.1       
[23] rstudioapi_0.15.0 tools_4.3.1      
[25] evaluate_0.21     yaml_2.3.7       
[27] Rcpp_1.0.11       rlang_1.1.1      
[29] datasets_4.3.1   
@dfalbel
Copy link
Member

dfalbel commented Oct 2, 2023

Hi @cregouby,

Thanks for reporting!

I believe this caused by a mismatch between LibLantern's expected LibTorch and the one installed in the build-lantern directory. What happens if you erase the build-lantern/libtorch and try to rebuild? Do you still get the same errors?

@dfalbel dfalbel assigned dfalbel and unassigned dfalbel Oct 2, 2023
@cregouby
Copy link
Collaborator Author

Hello @dfalbel
Thanks a lot for the hint, as yes I had unexpected file in the "lantern/build" folder. Plus I was using the RStudio "Install" button, that, in the case of {torch} is the wrong way to proceed.
Now, with a cleaned install folder plus using the proper procedure documented in CONTRIBUTION.md, build is fine !

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

2 participants