I agree - our developer guide (https://doc.sagemath.org/html/en/developer/coding_in_cython.html) does not explain any of this.
On Thursday, March 16, 2023 at 6:38:45 PM UTC-7 Brent W. Baccala wrote: > It's starting to make sense. Looks like I need "distutils: libraries = > bmi" at the beginning of bmi_c.pxd > > I think it would be useful to have all of the distutils: directives > documented in one place. > > agape > brent > > > On Thursday, March 16, 2023 at 4:36:36 PM UTC-4 Matthias Koeppe wrote: > >> Third paragraph in the linked article: >> Some Cython modules need specific compiler and linker flags. Sage 9.2 has >> moved all of these flags from Extension options in src/module_list.py to >> distutils: directives in the individual .pyx source files, see #29706 >> <https://trac.sagemath.org/ticket/29706> and Cython documentation >> <https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#compiler-directives> >> . >> >> >> On Thursday, March 16, 2023 at 1:10:47 PM UTC-7 Brent W. Baccala wrote: >> >>> Thank you, Matthias and Dima, for those pointers. >>> >>> Reading over that, it seems like it should just find the files on its >>> own. "src/module_list.py" was not replaced with anything other than >>> improved logic to find Cython files. >>> >>> How does it know which shared libraries to load? It seems like that's >>> where it's failing - not when it compiles the Cython, but when it tries to >>> run it and call a function in the shared library. >>> >>> agape >>> brent >>> >>> >>> On Thursday, March 16, 2023 at 6:23:44 AM UTC-4 Dima Pasechnik wrote: >>> >>>> On Thu, Mar 16, 2023 at 8:07 AM Matthias Koeppe >>>> <[email protected]> wrote: >>>> > >>>> > Looking at the branch I see a change to "src/module_list.py". This >>>> file is not a thing any more in Sage. See >>>> https://wiki.sagemath.org/ReleaseTours/sage-9.2#For_developers:_Changes_to_the_build_system_of_sagelib >>>> >>>> >>>> This is somewhat outdated, it seems. I've edited the links there to >>>> point to sources on github, but there is nothing about sage-tdlib in >>>> setup.py any more. >>>> There is sagemath-tdlib in src/sage/misc/package_dir.py, etc... >>>> >>>> probably it's best to be edited further not by me, but by someone who >>>> knows details. >>>> >>>> >>>> > >>>> > >>>> > On Wednesday, March 15, 2023 at 6:56:32 PM UTC-7 Brent W. Baccala >>>> wrote: >>>> >> >>>> >> Hi - >>>> >> >>>> >> I'm trying to get the DifferentialAlgebra package in issue 13268 >>>> running (it has a github branch that was imported from trac). >>>> >> >>>> >> Last time I had it running was 9.0 (I think), and now I'm trying to >>>> build it on 9.8. >>>> >> >>>> >> It seems to build fine, but can't access functions in the shared >>>> library that was built from upstream's C code. >>>> >> >>>> >> It does this: >>>> >> >>>> >> baccala@samsung:~/src/sage-rg$ ./sage >>>> >> >>>> ┌────────────────────────────────────────────────────────────────────┐ >>>> >> │ SageMath version 9.8, Release Date: 2023-02-11 │ >>>> >> │ Using Python 3.11.1. Type "help()" for help. │ >>>> >> >>>> └────────────────────────────────────────────────────────────────────┘ >>>> >> sage: import sage.calculus.DifferentialAlgebra >>>> >> >>>> --------------------------------------------------------------------------- >>>> >>>> >> ImportError Traceback (most recent call last) >>>> >> Cell In [1], line 1 >>>> >> ----> 1 import sage.calculus.DifferentialAlgebra >>>> >> >>>> >> ImportError: /home/baccala/src/sage-rg/src/sage/calculus/ >>>> DifferentialAlgebra.cpython-311-x86_64-linux-gnu.so: undefined symbol: >>>> bmi_sage_is_constant >>>> >> sage: >>>> >> >>>> >> The function is cimported in DifferentialAlgebra.pyx: >>>> >> >>>> >> cimport sage.libs.bmi_c as bmi_c >>>> >> >>>> >> bmi_c.pxd is in src/sage/libs and contains lines like this: >>>> >> >>>> >> cdef extern from "bmi.h": >>>> >> ... >>>> >> ctypedef bmi_balsa_object_string* ALGEB_string >>>> >> ALGEB_string bmi_sage_is_constant ( >>>> >> char*, char*, ALGEB, char*, char*, ba0_int_p, ba0_int_p) >>>> >> >>>> >> The symbol exists in a shared library in local/lib: >>>> >> >>>> >> baccala@samsung:~/src/sage-rg$ ls -l local/lib/libbmi.so.0.0.0 >>>> >> -rwxr-xr-x 1 baccala baccala 973584 Mar 15 16:17 >>>> local/lib/libbmi.so.0.0.0 >>>> >> baccala@samsung:~/src/sage-rg$ nm local/lib/libbmi.so.0.0.0 | grep >>>> bmi_sage_is_constant >>>> >> 000000000000c140 T bmi_sage_is_constant >>>> >> >>>> >> >>>> >> Any idea what needs to be done to access this shared library from >>>> Sage? >>>> >> >>>> >> It may be related to something that changed since Sage 9.0. >>>> >> >>>> >> Thanks for any help you can provide! >>>> >> >>>> >> agape >>>> >> brent >>>> >> >>>> > -- >>>> > You received this message because you are subscribed to the Google >>>> Groups "sage-devel" group. >>>> > To unsubscribe from this group and stop receiving emails from it, >>>> send an email to [email protected]. >>>> > To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/sage-devel/5363374f-dceb-4176-8e69-f1402d2cb8f2n%40googlegroups.com. >>>> >>>> >>>> >>> -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/d0389fac-b4c3-496c-8f4b-0a78bdc334bbn%40googlegroups.com.
