From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mambo Levis Newsgroups: gmane.emacs.bugs Subject: bug#24574: emacs-module is not GPL compatible (Windows) Date: Sat, 1 Oct 2016 20:28:15 +0000 (UTC) Message-ID: <628247655.3797718.1475353695862@mail.yahoo.com> References: <1261593588.2422705.1475266631400.ref@mail.yahoo.com> <1261593588.2422705.1475266631400@mail.yahoo.com> <86oa3433p1.fsf@realize.ch> <1337000014.3620747.1475325086234@mail.yahoo.com> <83mviokrgr.fsf@gnu.org> Reply-To: Mambo Levis NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3797717_2132201897.1475353695848" X-Trace: blaine.gmane.org 1475353775 24021 195.159.176.226 (1 Oct 2016 20:29:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Oct 2016 20:29:35 +0000 (UTC) Cc: "24574@debbugs.gnu.org" <24574@debbugs.gnu.org>, "a.s@realize.ch" To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 01 22:29:29 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqQuL-000491-Md for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Oct 2016 22:29:18 +0200 Original-Received: from localhost ([::1]:57084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqQuK-0007Dw-9W for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Oct 2016 16:29:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqQuC-0007De-A6 for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2016 16:29:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqQu6-0003Ni-97 for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2016 16:29:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35174) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqQu6-0003Ne-5H for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2016 16:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bqQu5-0004RK-TI for bug-gnu-emacs@gnu.org; Sat, 01 Oct 2016 16:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mambo Levis Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Oct 2016 20:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24574 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24574-submit@debbugs.gnu.org id=B24574.147535372217037 (code B ref 24574); Sat, 01 Oct 2016 20:29:01 +0000 Original-Received: (at 24574) by debbugs.gnu.org; 1 Oct 2016 20:28:42 +0000 Original-Received: from localhost ([127.0.0.1]:41364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqQtm-0004Qg-1f for submit@debbugs.gnu.org; Sat, 01 Oct 2016 16:28:42 -0400 Original-Received: from mail-it0-f44.google.com ([209.85.214.44]:37004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bqQtf-0004QL-Nt for 24574@debbugs.gnu.org; Sat, 01 Oct 2016 16:28:41 -0400 Original-Received: by mail-it0-f44.google.com with SMTP id j69so87695802itb.0 for <24574@debbugs.gnu.org>; Sat, 01 Oct 2016 13:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:reply-to:to:cc:message-id:in-reply-to:references:subject :mime-version:content-length; bh=g48IYap+UygO3hmBTfZEkImmUcE7dons6Fa3rOmnyoA=; b=HY0k0iUwY1mkK/D+vs4Mb9vgOLtCcvhaAmOqMWlKRfej/ZzYfjrNUDl60WCOYnNRoG oHzac0GofYm4eeQz/4hTNrRzLAiZJidcw71087MFGOa/bwrXgUvOf2ARetIOsIweoop6 XtKL+9mR5yGoFeSFrjenptabf/oLRxVDIZW1Rb36CpkAwR6WzoXV2fg/jYqpMc1k4Lj/ mrB/EF7ZiHVwr7cTlHOR3tvE7XrG+rZdCiQOQLn7taTfvSNXwnktuTDiGn38BbSdNazQ S6TvpuQLv3dM/n6XqE5zMP0Y3OlkcFG0+idHjKrxCyS1nIaAEuRbLhue5Rn9M8flhAKt UUXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:reply-to:to:cc:message-id:in-reply-to :references:subject:mime-version:content-length; bh=g48IYap+UygO3hmBTfZEkImmUcE7dons6Fa3rOmnyoA=; b=JAOJqArmDgY9DS2ARlNfgwXf6bRhGJjmh4+b6RpTWz37rkdjckU4i6f7Yvn6jlTBaK MUo964zF1naLeHYYVXtxmIW2uvg1Ms7yENk0WdNKeGF0AXsx6H/x6x/uFY9rVrBCSjb3 f9gweKY7APKl3XAHHW4K5O9wTkPx9t9knBeL66rczQ7NosNHpISpsWU2jIvabU1PExin Dt3LWZe1w5rgBt7M+i0A4FZv55oOCWNZNrusvmUMj+LGeDAg8RAIKxFbcxJlVhFC2hr4 +k7oAv67M+2f377Qfy48nOWsoYoqSNXJW3RqUyHei6cJ8RyiYx0fOGDal8k3XRP4+TO3 vaww== X-Gm-Message-State: AA6/9RmwqHd8HfbzBLkMWVCQA4u4Uz+qDtMk/TYHMvTKph4BttZ2yKIa87rCSfuTyLUc4g== X-Received: by 10.36.204.139 with SMTP id x133mr11636772itf.86.1475353697982; Sat, 01 Oct 2016 13:28:17 -0700 (PDT) Original-Received: from smtpsendws103.mail.ne1.yahoo.com (smtpsendws103.mail.ne1.yahoo.com. [98.138.101.180]) by smtp.gmail.com with ESMTPSA id u62sm10189674ioe.0.2016.10.01.13.28.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Oct 2016 13:28:17 -0700 (PDT) X-YMail-OSG: lPAvpEIVM1lbmvEs1aCa_SDP9hrl9obY4A.DKf0wrUuV7yv.g4UkQ9_vfJG9pRN y9s93M5jlOKirvkyK8h7Hx0IC4_RAKCh.AvO_Z07tJfX_3rQdnZKZeuueBoWZIkZss4i6Bm5z8MN Y4lQosjadcBrZp5twzU3d_RnZ6ynpJKCyOQXbajvIjCIhsN4lLe58mOH3Cdv13sfd8EqMNYKjDx_ xaUWjBM14aAs7kTUuLcAuS_zCDWppQIowwAtMrrSnqP7qDZgsGD0lxvFgkA.VaMqp37hscq4fOd8 SsvH_I05kyTWCRNrWKJRdX1KOUehk3uF_EOiNyKZafaS9sSuvx60tBd9KQD5RAYXfiwacflZck7V RqPcaCRmAj4gIo3JhRIreEfFnYkLuvYIRDmQvXi8KOpNQ9I65XcfFMPBEhZMcUPpN1m4.9uY6d1a d4IyM2zu1BP2fHS8b0bvTJG_PDZcxF1YGL9XLP.zZyn46ztRVO4ve4tQql3FjchD59iJ3j9JRdno d8URZnAIIWNonpOz9r1xhEaBBLnOJXT4ScsrJm3MVCsp99IAi7fZJDYoX5CL2D3gbvw-- Original-Received: from jws100242.mail.ne1.yahoo.com by smtpsendws103.mail.ne1.yahoo.com; Sat, 01 Oct 2016 20:28:16 +0000; 1475353696.333 In-Reply-To: <83mviokrgr.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123875 Archived-At: ------=_Part_3797717_2132201897.1475353695848 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you for the=C2=A0pexports=C2=A0recommendation. For somebody that just read this problem for the first time, a summary: Emacs version: GNU Emacs 25.1.1 Emacs module repo:=C2=A0https://github.com/syohex/emacs-sqlite3 Build process: mingw64_shell.bat (Windows)=C2=A0 Dependency: sqlite.lib Makefile: EMACS =3D D:\user\emacs-src\emacs-25-branch-srcINCLUDE =3D -I. -I$(EMACS)\s= rc=C2=A0 CC =C2=A0 =C2=A0 =C2=A0=3D gccLD =C2=A0 =C2=A0 =C2=A0=3D gccLDFLAGS =3D # On MS-Windows, say "make SO=3Ddll" to build the moduleSO =C2=A0 =C2=A0 = =C2=A0=3D dll# -fPIC is a no-op on Windows, but causes a compiler warningif= eq ($(SO),dll)CFLAGS =C2=A0=3D -std=3Dgnu99 -ggdb3 -WallelseCFLAGS =C2=A0= =3D -std=3Dgnu99 -ggdb3 -Wall -fPICendif all: sqlite3-core.$(SO) %.$(SO): %.o $(LD) -shared $(LDFLAGS) -o $@ $< sqlite3.lib %.o: %.c $(CC) $(CFLAGS) $(INCLUDE) -c $< check: $(EMACS)/src/emacs -batch -l ert -l test.el -f ert-run-tests-batch-a= nd-exit=C2=A0 =C2=A0=C2=A0clean: rm -rf *.o *.dll *.a *.d ---------------------------------------------------------------------------= ----------------------------------------------------- Now the result of my tests: 1. The symbols exported by the modules without considering any sqlite funct= ion are: =C2=A0LIBRARY sqlite3-core.dll EXPORTSemacs_module_init ; .text ; RVA 00001685plugin_is_GPL_compatible DAT= A ; no section ; RVA 00007010 2. onsidering the following sqlite3 related function: static voidel_sqlite3_free(void *arg){ sqlite3_close((sqlite3*)arg);} When I generate the sqlite3-core.dll=C2=A0using at least one sqlite3 DLL fu= nction, for example sqlite3_close ,=C2=A0an error message appears: =C2=A0(t= he module can't be found)=C2=A0..../modules/emacs-sqlite3/sqlite3-core.dll:= Das angegebene Modul wurde nicht gefunden. I check the sqlite3.dll using=C2=A0pexports=C2=A0tool, and the symbols=C2= =A0sqlite3_close is exported.LIBRARY sqlite3.dllEXPORTS.....sqlite3_changes= ; .text ; RVA 0009c648sqlite3_clear_bindings ; .text ; RVA 000373dcsqlite3= _close ; .text ; RVA 0009c9e8sqlite3_close_v2 ; .text ; RVA 0009ca08sqlite3= _collation_needed ; .text ; RVA 0009f4b3sqlite3_collation_needed16 ; .text = ; RVA 0009f51f I check the module qlite3-core.dll again and the symbols are there. ; .text =C2=A0 : RVA: 00001000, File offset: 00000600; .data =C2=A0 : RVA: = 00003000, File offset: 00002400; .rdata =C2=A0: RVA: 00004000, File offset:= 00002600; .pdata =C2=A0: RVA: 00005000, File offset: 00002e00; .xdata =C2= =A0: RVA: 00006000, File offset: 00003200; .bss =C2=A0 =C2=A0: RVA: 0000700= 0, File offset: 00000000; .edata =C2=A0: RVA: 00008000, File offset: 000034= 00; .idata =C2=A0: RVA: 00009000, File offset: 00003600; .CRT =C2=A0 =C2=A0= : RVA: 0000a000, File offset: 00003e00; .tls =C2=A0 =C2=A0: RVA: 0000b000, = File offset: 00004000; .reloc =C2=A0: RVA: 0000c000, File offset: 00004200;= /4 =C2=A0 =C2=A0 =C2=A0: RVA: 0000d000, File offset: 00004400; /19 =C2=A0 = =C2=A0 : RVA: 0000e000, File offset: 00004800; /31 =C2=A0 =C2=A0 : RVA: 000= 18000, File offset: 0000e200; /45 =C2=A0 =C2=A0 : RVA: 0001a000, File offse= t: 0000fa00; /57 =C2=A0 =C2=A0 : RVA: 0001c000, File offset: 00011200; /70 = =C2=A0 =C2=A0 : RVA: 0001d000, File offset: 00011e00; /81 =C2=A0 =C2=A0 : R= VA: 0001e000, File offset: 00012200; /92 =C2=A0 =C2=A0 : RVA: 00021000, Fil= e offset: 00015200; /105 =C2=A0 =C2=A0: RVA: 0002b000, File offset: 0001f20= 0; Reading exports from section: .edata; Export table: sqlite3-core.dll; Or= dinal base: 1; Ordinal table RVA: 00008038; Name table RVA: 0008030; Export= address table RVA: 00008028LIBRARY sqlite3-core.dllEXPORTSemacs_module_ini= t ; .text ; RVA 00001696plugin_is_GPL_compatible DATA ; no section ; RVA 00= 0078f0=20 Please, notice that this time the plugin_is_GPL_compatible. The problem is = now that the module can't be found when a sqlite3.dll symbol is used. Any Idea or suggestion? Thanks Levis On Saturday, October 1, 2016 5:40 PM, Eli Zaretskii wrot= e: =20 [Please don't cross post to help-gnu-emacs if you report bugs.] > Date: Sat, 1 Oct 2016 12:31:26 +0000 (UTC) > From: Mambo Levis > Cc: 24574@debbugs.gnu.org, help-gnu-emacs@gnu.org >=20 > 1. I commented all module's functions related with sqlite3 library and on= ly leave uncommented one of function > to verify if the module is working: >=20 > /* emacs-sqlite-version*/ > static emacs_value > Femacs_sqlite_version (emacs_env *env, ptrdiff_t nargs, emacs_value args[= ], void *data) > { > const char* msg_docstr =3D "emacs-sqlite module version 0.1"; > return env->make_string (env, msg_docstr, strlen(msg_docstr)); > } >=20 > When I require (emacs-sqlite-version) it works as expected. >=20 > 2. I tested only two function: the previous one Femacs_sqlite_version and= other associated with sqlite. Once I > consider a module function related to sqlite error message appears:=20 > is not GPL compatible >=20 > I think the error is related with the linking process of the sqlite3.lib = . One possible test is not linking sqlite3.lib > and stead just using sqlite source code as a part of the module. >=20 > Do you have any suggestion? I'd start by using the pexports program (or something similar) to see which symbols are exported by the sqlite DLL. =20 ------=_Part_3797717_2132201897.1475353695848 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you for the pexports recommendation.

For somebody that just read this= problem for the first time, a summary:

Emacs version: GNU Emacs 25.1.1

Dependency: sqlite.lib<= /div>

Makefile:

EMACS =3D D:= \user\emacs-src\emacs-25-branch-src
INCLUDE =3D -I. -I$(EMACS)\src 

CC      =3D gcc
LD      =3D g= cc
LDFLA= GS =3D
<= br id=3D"yui_3_16_0_ym19_1_1475350414913_37024">
# On MS-Windows, say "make SO=3D= dll" to build the module
SO      =3D dll
# -fPIC is a no-op on Windows, but = causes a compiler warning
ifeq ($(SO),dll)
CFLAGS  =3D -std=3Dgnu99 -ggdb3 -Wall
=
else
CFLAGS  =3D= -std=3Dgnu99 -ggdb3 -Wall -fPIC
endif

all: sqlit= e3-core.$(SO)

%.$(SO): %.o
=09$(L= D) -shared $(LDFLAGS) -o $@ $< sqlite3.lib

%.o: %.c
=09$(CC) $(CFLAGS) $(INCLUDE) -c $<

check:
=09$(EMACS)/src/emacs -batch -l ert -l t= est.el -f ert-run-tests-batch-and-exit
    
clean:
=09rm -rf *.o *.d= ll *.a *.d

------------= ---------------------------------------------------------------------------= -----------------------------------------

Now= the result of my tests:


1. The symbols exported by= the modules without considering any sqlite function are:

 LIBRARY sqlite3-core.dll
EXPORTS
emacs_mod= ule_init ; .text ; RVA 00001685
plugin_is_GPL_compatible DATA ; no section= ; RVA 00007010

2. onsidering the following sqlite3 r= elated function:

static void
el_sqlite3_free(void *a= rg)
{
=09sqlite3_close((sqlite3*)arg);
}

When I g= enerate the sq= lite3-core.dll using at least one sqlite3 DLL function, for exampl= e sqlite3_clos= e , an error message appears:  (the module can't be found) 
<= div dir=3D"ltr" id=3D"yiv9323075439yui_3_16_0_ym19_1_1475350414913_12933" s= tyle=3D"font-family: "Helvetica Neue", Helvetica, Arial, "Lu= cida Grande", sans-serif; font-size: 13px; color: rgb(0, 0, 0);">..../modules/emacs-= sqlite3/sqlite3-core.dll: Das angegebene Modul wurde nicht gefunden.

I check the sqlite3.dll using <= span id=3D"yiv9323075439yui_3_16_0_ym19_1_1475350414913_22151" style=3D"">p= exports tool, and the symbols sqlite3_close is exported.
LIBRARY sqlite3.dll
EX= PORTS
.....
sqlite3_changes ; .text ; RVA 0009c648
sqlite3_clear_binding= s ; .text ; RVA 000373dc
sqlite3_close ; .text ; RVA 0009c9e8
sqlite3_close_v2 ; .tex= t ; RVA 0009ca08
sqlite3_collation_needed ; .text ; RVA 0009f4b3
sqlite3_= collation_needed16 ; .text ; RVA 0009f51f

I check the module qlite3-core.dll again and the symbols= are there.

; .text   : RVA: 00001000, File offset: 00000600
; .data   : RVA:= 00003000, File offset: 00002400
; .rdata  : RVA: 00004000, File offset: 00002= 600
; .p= data  : RVA: 00005000, File offset: 00002e00
; .xdata  : RVA: 00006000, = File offset: 00003200
; .bss    : RVA: 00007000, File offset: 00000000
; .edata &= nbsp;: RVA: 00008000, File offset: 00003400
; .idata  : RVA: 00009000, File of= fset: 00003600
; .CRT    : RVA: 0000a000, File offset: 00003e00
; .tls   &nb= sp;: RVA: 0000b000, File offset: 00004000
; .reloc  : RVA: 0000c000, File offs= et: 00004200
; /4      : RVA: 0000d000, File offset: 00004400
<= div dir=3D"ltr" id=3D"yui_3_16_0_ym19_1_1475350414913_28640">; /19   &= nbsp; : RVA: 0000e000, File offset: 00004800
; /31     : RVA: 00018000, F= ile offset: 0000e200
; /45     : RVA: 0001a000, File offset: 0000fa00
; /57  = ;   : RVA: 0001c000, File offset: 00011200
; /70     : RVA: 0001d000= , File offset: 00011e00
; /81     : RVA: 0001e000, File offset: 00012200<= /div>
; /92 &n= bsp;   : RVA: 00021000, File offset: 00015200
; /105    : RVA: 0002b= 000, File offset: 0001f200
; Reading exports from section: .edata
; Export table: sqlite3-c= ore.dll
= ; Ordinal base: 1
; Ordinal table RVA: 00008038
; Name table RVA: 0008030
; Export address table RV= A: 00008028
LIBRARY sqlite3-core.dll
EXPORTS
emacs_= module_init ; .text ; RVA 00001696
plugin_is_GPL_compatible DATA ; no section ; RVA 000078f0


Please, notice that this time t= he plugin_is_GPL_compati= ble. The problem is now that the module can't be found when a sqlite= 3.dll symbol is used.

Any Idea or suggestion?

Thanks

Levis

=
On Saturday, October 1, 2016 5:40 PM, Eli Zaretskii <el= iz@gnu.org> wrote:

<= br clear=3D"none">
[Please don't cross post to h= elp-gnu-emacs if you report bugs.]

> = Date: Sat, 1 Oct 2016 12:31:26 +0000 (UTC)
> From: Mam= bo Levis <
mambo.levis@gmail.com<= /a>>
> Cc:
= 24574@debbugs.gnu.org, help-g= nu-emacs@gnu.org
>
> 1. I co= mmented all module's functions related with sqlite3 library and only leave = uncommented one of function
> to verify if the module = is working:
>
> /* emacs-sqlite-= version*/
> static emacs_value
> = Femacs_sqlite_version (emacs_env *env, ptrdiff_t nargs, emacs_value args[],= void *data)
> {
> const char* ms= g_docstr =3D "emacs-sqlite module version 0.1";
> retu= rn env->make_string (env, msg_docstr, strlen(msg_docstr));
> }
>
> When I require (= emacs-sqlite-version) it works as expected.
>
> 2. I tested only two function: the previous one Femacs_sqli= te_version and other associated with sqlite. Once I
> = consider a module function related to sqlite error message appears:
> is not GPL compatible
>
> I think the error is related with the linking process of the sql= ite3.lib . One possible test is not linking sqlite3.lib
&= gt; and stead just using sqlite source code as a part of the module.
>
> Do you have any suggestion?
<= br clear=3D"none">
I'd start by using the pexports progra= m (or something similar) to see
which symbols are exporte= d by the sqlite DLL.



------=_Part_3797717_2132201897.1475353695848--