Re: [sage-devel] Re: linker options for C code in ext/interpreters and other stuff in sagelib

2017-03-28 Thread Dima Pasechnik


On Tuesday, March 28, 2017 at 8:32:53 AM UTC+1, Jeroen Demeyer wrote:
>
> On 2017-03-27 23:15, François Bissey wrote: 
> > The generated sage/ext/interpreters/wrapper_cdf.pxd has the following 
> > statement: 
> > cimport sage.libs.cypari2.types 
> > 
> > That would pull `-lpari`. 
>
> That's not actually true. Just using the *types* from PARI doesn't need 
> linking against PARI. It's cysignals which pulls -lpari. 
>
> > To add `-lm` you would have to add 
> > a line 
> > #distutils: libraries = m 
> > at the top of the same .pxd file 
>
> Actually, the .pyx file. If something is needed for the .pxd file, the 
> "# distutils" declaration should be in the .pxd file. But this is not 
> the case here, so it should be in the .pyx file. 
>

Thanks.
Does such  "#distutils: libraries = blah " automatically imply that libblah 
from $SAGE_LOCAL/lib/ will be linked?
 

-- 
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 sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: linker options for C code in ext/interpreters and other stuff in sagelib

2017-03-28 Thread Jeroen Demeyer

On 2017-03-27 23:15, François Bissey wrote:

The generated sage/ext/interpreters/wrapper_cdf.pxd has the following
statement:
cimport sage.libs.cypari2.types

That would pull `-lpari`.


That's not actually true. Just using the *types* from PARI doesn't need 
linking against PARI. It's cysignals which pulls -lpari.



To add `-lm` you would have to add
a line
#distutils: libraries = m
at the top of the same .pxd file


Actually, the .pyx file. If something is needed for the .pxd file, the 
"# distutils" declaration should be in the .pxd file. But this is not 
the case here, so it should be in the .pyx file.


--
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 sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: linker options for C code in ext/interpreters and other stuff in sagelib

2017-03-27 Thread François Bissey

The generated sage/ext/interpreters/wrapper_cdf.pxd has the following
statement:
cimport sage.libs.cypari2.types

That would pull `-lpari`. To add `-lm` you would have to add
a line
#distutils: libraries = m
at the top of the same .pxd file, you'll have to dig a bit
inside sage_setup/autogen/interpreters.py to work out
where and how to insert it. The class "InterpreterSpec"
has a "pxd_header" which I think is right place for it.

Francois


On 28/03/17 06:58, Dima Pasechnik wrote:

here is one concrete example:

"extra_link_args"
in src/build/cythonized/sage/ext/interpreters/wrapper_cdf.c
has "-lpari" in it.

Where is this specified?

Note that this C file is apparently generated from
src/sage/ext/interpreters/wrapper_cdf.pyx
which is
"Automatically generated by
/usr/home/dima/Sage/sage/src/sage_setup/autogen/interpreters.py"
(apparently from thin air :-))


(IMHO my problem will be solved if I find out how to add '-lm' next to
that '-lpari')

Thanks,
Dima


On Monday, March 27, 2017 at 4:42:40 PM UTC+1, Dima Pasechnik wrote:

On #22679 I am getting errors like

import sage.ext.interpreters.wrapper_cdf
ImportError:

/usr/home/dima/Sage/sage/local/lib/python2.7/site-packages/sage/ext/interpreters/wrapper_cdf.so:
 Undefined symbol "cpow"

Here cpow should come from cephes package, which creates
SAGE_LOCAL/lib/libm.so
---but it does not.
Where does one set up linking options for C/C++ code that goes into
sagelib?
(in this case, for src/sage/ext/interpreters/interp_cdf.c)
This does not seem to be documented anywhere.

Thanks,
Dima



--
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 sage-devel+unsubscr...@googlegroups.com
.
To post to this group, send email to sage-devel@googlegroups.com
.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


--
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 sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.