Re: [polyml] polyc and libraries

2017-12-18 Thread David Matthews

Phil,
I'm not exactly clear how pkg-config is supposed to be used.  It's 
certainly possible to add -lpolymain explicitly to the libraries in 
polyml.pc.


David

On 17/12/2017 21:57, Phil Clayton wrote:

David,

On Fedora 25, polyc still appears to work for shared poly with this 
change.  However, there is an issue for pkg-config because the libs 
section in polyml.pc no longer includes the flag -lpolymain causing a 
link error:


/usr/lib/gcc/x86_64-redhat-linux/6.4.1/../../../../lib64/crt1.o: In 
function `_start':

(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

Regards,
Phil

On 12/12/17 13:14, David Matthews wrote:
The polyc script has been developed mainly to simplify the linking of 
an exported ML function and in particular to try to capture the 
libraries that need to be included.  I've been having another look at 
this because of an issue that was reported a while back.  Up till now 
the linking step has included all the libraries that were needed in 
order to link libpolyml itself.  That was extracted by the configure 
script.  It turns out that this is right if libpolyml is compiled as a 
static library but has a problem if libpolyml is a dynamic library.


Object files exported by PolyML.export make reference to external 
symbols from libpolyml but do not directly reference anything else.  
If libpolyml is a dynamic library it exports these symbols but all the 
other dependencies are satisfied by loading the appropriate libraries 
dynamically.


The issue was reported in the Fedora distribution but may also affect 
other distributions that package up Poly/ML and have separate packages 
for libraries (e.g. libgmp and libffi) and development packages.  They 
were building libpolyml as a shared library but because polyc included 
the dependencies of libpolyml itself polyc was including -lgmp -lffi 
in the link step.  This meant that it needed the development versions 
of these libraries even though they were not actually used.


I've now modified the configure script so that polyc only includes the 
dependent libraries if libpolyml has been built with shared libraries 
disabled and at the same time changed the default so that it builds a 
shared library unless --disable-shared is given.  Hopefully this 
hasn't broken anything but I'd appreciate any reports of problems.



David
___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml


___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Re: [polyml] polyc and libraries

2017-12-18 Thread David Matthews

On 15/12/2017 18:41, Makarius wrote:

On 15/12/17 17:46, David Matthews wrote:

On 15/12/2017 16:15, Makarius wrote:


    * The polyc script cannot handle directory names with spaces, e.g. the
main "prefix".


I guess it would need some extra quotation.  Do you want to propose a fix?


See the included change: my very first commit produced with git (with
VSCode and gitk).



Thanks.  I've merged and pushed it.

David


___
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml