bnprks / BPCells

Scaling Single Cell Analysis to Millions of Cells
https://bnprks.github.io/BPCells
Other
166 stars 17 forks source link

Get 'undefined symbol' error when build the package #109

Closed ycli1995 closed 4 months ago

ycli1995 commented 4 months ago

Hi, @bnprks. I try to add linear regression as new feature for BPCells, so I create a branch here: https://github.com/ycli1995/BPCells/tree/LinearResidual

However, when I tested the package using devtools::document(), the compiler seemed to ignore the LinearResidual.cpp I created, and raise an error:

Error in dyn.load(dll_copy_file) : 
  unable to load shared object '/tmp/RtmpTdktzr/pkgload11b0251da3c23/BPCells.so':
  /tmp/RtmpTdktzr/pkgload11b0251da3c23/BPCells.so: undefined symbol: _ZTVN7BPCells14LinearResidualE

The file paths in src/ were checked and nothing abnormal was found. The src/matrixTransforms/LinearResidual.o was not created. Maybe I overlooked something?

Do you have idea where the error could come from? Thanks for any advice.

bnprks commented 4 months ago

Sure, this one should be pretty easy -- you just need to add the .o file you want made into the list present in the Makevars.in file. Ultimately that gets processed into the Makevars file at build time and then used to set what files R should compile.

EDIT: just checked out the branch you're working on -- looks pretty cool! Very excited to see you diving into more C++-level development and I'd be happy to answer any questions or provide strategy advice if you like. I'm also reachable via email bparks [at] stanford.edu. So far it looks great!

Oh, and for a usage example on the MatrixTransformDense implementation I'd check out Shift.cpp as it's a good example of how loadZero and loadZeroSubtracted split up what part of the values are being loaded.

-Ben

ycli1995 commented 4 months ago

Thank you! It can be normally compiled after I modified the Makevars.in file!

For the usage of loadZero and loadZeroSubtracted method, not pretty sure that I got the right understanding. I'd check out the existing examples for MatrixTransformDense as you advised.

Since the original problem has been solved, I'll close the issue for the moment.