From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Fri, 13 Feb 2015 15:09:08 -0600 Message-ID: <85h9upjz7v.fsf@stephe-leake.org> References: <87y4t9m76w.fsf@lifelogs.com> <85k31coixa.fsf@stephe-leake.org> <85oapy5kt6.fsf@stephe-leake.org> <83y4oiiw81.fsf@gnu.org> <838ugdf251.fsf@gnu.org> <87bnl1vmqf.fsf@lifelogs.com> <87vbj8tow4.fsf@lifelogs.com> <87r3twtagf.fsf@lifelogs.com> <85siebl7ws.fsf@stephe-leake.org> <85a90ilwmm.fsf@stephe-leake.org> <83386a6f7z.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423861792 31761 80.91.229.3 (13 Feb 2015 21:09:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2015 21:09:52 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 13 22:09:42 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YMNUa-000886-Mr for ged-emacs-devel@m.gmane.org; Fri, 13 Feb 2015 22:09:40 +0100 Original-Received: from localhost ([::1]:57474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMNUa-00030c-1T for ged-emacs-devel@m.gmane.org; Fri, 13 Feb 2015 16:09:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMNUW-0002yW-C5 for emacs-devel@gnu.org; Fri, 13 Feb 2015 16:09:37 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMNUS-0005tM-RZ for emacs-devel@gnu.org; Fri, 13 Feb 2015 16:09:36 -0500 Original-Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:46718) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1YMNUS-0005tA-Jq for emacs-devel@gnu.org; Fri, 13 Feb 2015 16:09:32 -0500 Original-Received: (qmail 18721 invoked by uid 0); 13 Feb 2015 21:09:27 -0000 Original-Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy2.mail.unifiedlayer.com with SMTP; 13 Feb 2015 21:09:27 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by cmgw3 with id rx9N1p0072UdiVW01x9RwU; Fri, 13 Feb 2015 14:09:27 -0700 X-Authority-Analysis: v=2.1 cv=SqADtp+0 c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=TeMFXEv2S7AA:10 a=9i_RQKNPAAAA:8 a=hEr_IkYJT6EA:10 a=jrwKn-8xaegA:10 a=0HtSIViG9nkA:10 a=mDV3o1hIAAAA:8 a=JxnxhJdEbHOXWh0aHbkA:9 Original-Received: from [70.94.38.149] (port=50935 helo=takver) by host114.hostmonster.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1YMNUH-00055u-OO for emacs-devel@gnu.org; Fri, 13 Feb 2015 14:09:22 -0700 In-Reply-To: <83386a6f7z.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 12 Feb 2015 22:34:56 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 70.94.38.149 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.18.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:183027 Archived-At: Eli Zaretskii writes: >> From: Stephen Leake >> Date: Thu, 12 Feb 2015 14:09:53 -0600 >> >> I had to add to options to the 'gcc' line in modules/curl/Makefile: >> >> -std=c99 -I$(ROOT)/nt/inc > > Why do you need -std=c99? What happens if you don't use it? It complains about the "register" keyword in string.h stpcpy >GCC > defaults to -std=gnu99, Apparently not in Mingw64 > I also don't like the -I$(ROOT)/nt/inc thing, it should only be needed > for Emacs-specific system-level stuff. Why was it needed here? some file included ms-w32.h: stephe@takver$ make gcc -std=c99 -ggdb3 -Wall -I../../src -I../../lib `pkg-config libcurl --cflags` -fPIC -c curl.c curl.c:1:0: warning: -fPIC ignored for target (all code is position independent) #include ^ In file included from ../../src/config.h:1866:0, from curl.c:6: ../../src/conf_post.h:32:27: fatal error: ms-w32.h: No such file or directory >> Normally those would be added by configure. Perhaps they could be set >> via CFLAGS by the perl script when on mingw64? > > Sorry, I don't understand: the Emacs configure script already adds > that directory to the include path. So what's wrong? I'm not running the top level Emacs makefile; I'm running modules/curl/Makefile, in order to build the curl module. >> But then I get link errors: >> >> > > GNU ld is a one-pass linker, so the libraries should be after the > object files. Ah, right; I forgot about link order. That fixes the libcurl problem. But the original order worked on Debian. >> The other symbols appear to be Emacs symbols? There was some discussion >> about a special flag for exporting those on Windows; is that '-Xlinker >> -E'? I guess that goes in src/Makefile somewhere? > > The unresolved externals that are defined by Emacs are expected: you > need to link against an import library produced as part of building > emacs.exe. Right, but I was expecting this makefile to do that. Especially since it "just works" on Debian. > Otherwise all this stuff will not work on Windows, because > the Windows port of the linker must see the import library at link > time. Apparently that is not true on Debian. > The flag to produce the import library should be something like this: > > -Wl,--out-implib=libemacs.dll.a And that goes in src/Makefile somewhere? Not on the "emacs$(EXEEXT)" line, since that doesn't run gcc. So it must go on the temacs$(EXEEXT) line (line 693)? And until we write emacs.h, it also needs -Xlinker -E (or can that be -Wl,-E ?). That should be added by configure when Windows and --with-ltdl are specified. Hmm. We already have: LIBLTDL = -lltdl -Wl,--export-dynamic which is included in LIBES, and thus in the temacs.exe link. However, that produces a warning: C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/bin/ld.exe: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols? So apparently that should be changed to --export-all-symbols? Doing that produces libemacs.dll.a "--export-dynamic" is currently set in ./configure.ac line 3266; that needs to be customized for the OS. Apparently the right way to do that is with something like: if test "${opsys}" = "mingw64" || test "${opsys}" = "mingw32"; then #FIXME: should export only symbols defined in emacs.h (which doesn't exist yet) LIBLTDL="-lltdl -Wl,--export-all-symbols -Wl,--out-implib=libemacs.dll.a" else LIBLTDL="-lltdl -Wl,--export-dynamic" fi > Then you need to link the shared library against -lemacs. > > And the link command line should produce curl.dll, not curl.so. Ok, that produced curl.dll. But doing: src/emacs.exe -L modules/curl & (require 'curl) fails, with "eval: Cannot open load file: No such file or directory, curl". That same test works on Debian. Hmm. There is no curl/test.el, so this is _not_ designed to be part of the test suite. Sigh. I'll work on the other module/* directories, which do have test.el files. So one question is how to make this Makefile do the right thing for the current operating system. The intent is for this Makefile to be part of the Emacs test suite, so it needs to not require user intervention. One option is to rename modules/curl/Makefile to modules/curl/Makefile.in and use configure in the modules directories. Another is to set flags in modules/tests.py. I would prefer the former, since that makes each Makefile self-documenting. -- -- Stephe