#14038: Let libgap build a shared library on Cygwin
--------------------------------------+-------------------------------------
Reporter: jpflori | Owner: tbd
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.7
Component: packages | Resolution:
Keywords: cygwin spkg libgap | Work issues:
Report Upstream: N/A | Reviewers: Jean-Pierre Flori
Authors: Volker Braun | Merged in:
Dependencies: | Stopgaps:
--------------------------------------+-------------------------------------
Comment (by dimpase):
Replying to [comment:29 jpflori]:
> The spkg is updated (I've not commited anything as I don't want to deal
with the external repository hell).
OK, it builds and seemingly works.
>
> And I still do not understand what you meant after reading all the
thread.
> The last message basically says that using _NSGetEnviron() worked, and
in other messages its told that the solution used is not to remove no-
undefined but to use _NSGetEnviron().
No, I think it says that the library built with the -undefined
dynamic_lookup option works.
>
> By ld do you mean run-time linking? because I don't think its ld that
takes care of that.
OK, here is the example:
{{{
$ cat enlib.c
extern char** environ;
char *** environ_addr (void) { return &environ; }
$ glibtool --mode=compile gcc -c enlib.c
glibtool: compile: gcc -c enlib.c -fno-common -DPIC -o .libs/enlib.o
glibtool: compile: gcc -c enlib.c -o enlib.o >/dev/null 2>&1
$ glibtool --mode=link gcc -o libenlib.la enlib.lo -rpath /tmp
glibtool: link: rm -fr .libs/libenlib.a .libs/libenlib.la
glibtool: link: gcc -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -o
.libs/libenlib.0.dylib .libs/enlib.o -install_name
/tmp/libenlib.0.dylib -compatibility_version 1 -current_version 1.0
-Wl,-single_module
glibtool: link: dsymutil .libs/libenlib.0.dylib || :
warning: no debug symbols in executable (-arch x86_64)
glibtool: link: (cd ".libs" && rm -f "libenlib.dylib" && ln -s
"libenlib.0.dylib" "libenlib.dylib")
glibtool: link: (cd ".libs" && rm -f "libenlib.0.0.0.dylib" && ln -s
"libenlib.0.dylib" "libenlib.0.0.0.dylib")
glibtool: link: ar cru .libs/libenlib.a enlib.o
glibtool: link: ranlib .libs/libenlib.a
glibtool: link: ( cd ".libs" && rm -f "libenlib.la" && ln -s
"../libenlib.la" "libenlib.la" )
$ cat en.c
#include <stdio.h>
#include <crt_externs.h>
#define macenviron (*_NSGetEnviron())
extern char *** environ_addr (void); /* comes from my enlib */
int main()
{
printf(" from the shared lib:\n %s \n", **environ_addr());
printf(" from macenviron :\n %s \n", *macenviron);
}
$ glibtool --mode=link gcc -o en en.c libenlib.la
glibtool: link: gcc -o .libs/en en.c ./.libs/libenlib.0.0.0.dylib
$ ./en
from the shared lib:
NNTPSERVER=news.gmane.org
from macenviron :
NNTPSERVER=news.gmane.org
}}}
So you see, it works with {{{-undefined dynamic_lookup}}} just fine.
(printf(%s) isn't the rght way of parsing of environ, so the output is cut
at the first \n, I guess).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14038#comment:30>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.