all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs 25 modules
@ 2016-10-25 21:06 Joey Ezechiels
  2016-10-26  2:39 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Joey Ezechiels @ 2016-10-25 21:06 UTC (permalink / raw)
  To: help-gnu-emacs

Hello there,

I've written an Emacs 25 module that uses a dynamic library in order to
function. In order to verify that the module loads correctly, I log every
function I register in the module, and these logs appear in *Messages*.
Most of my work has been done on an OS X machine and there Emacs 25 will
load the module just fine, no issues there.

But recently I've been trying to get it to work on Linux, and there I just
get completely garbled output in the spot where the log messages should be.
Not even proper text.
Needless to say, the functionality my module is supposed to provide is not
available.

Just to make sure it is not the dynamic library causing the garbling, I've
created some small programs that use the very same .so/.dylib file as the
Emacs module uses. When I run those programs, they work as they should,
both in Linux and in OS X.
To eliminate another factor: Both on OS X and on Linux I have compiled
Emacs 25 from source with the --with-modules flag passed to the configure
script.

So my current hypothesis is that somehow Emacs, while built correctly,
doesn't load the module correctly on Linux, but I'm stumped as to what
could cause that.
I would really appreciate any help I could get on this. The reason I'm
posting here rather than filing a bug report is that I'm not entirely
convinced it's a bug, either. I certainly have no in-depth knowledge,
though I can reproduce the issue flawlessly every time in my Ubuntu VM.


Met vriendelijke groet / Best regards,
Joey Ezechiëls


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs 25 modules
  2016-10-25 21:06 Emacs 25 modules Joey Ezechiels
@ 2016-10-26  2:39 ` Eli Zaretskii
  2016-10-26 11:33   ` Aurélien Aptel
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2016-10-26  2:39 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Joey Ezechiels <joey.ezechiels@gmail.com>
> Date: Tue, 25 Oct 2016 23:06:57 +0200
> 
> But recently I've been trying to get it to work on Linux, and there I just
> get completely garbled output in the spot where the log messages should be.
> Not even proper text.
> Needless to say, the functionality my module is supposed to provide is not
> available.
> 
> Just to make sure it is not the dynamic library causing the garbling, I've
> created some small programs that use the very same .so/.dylib file as the
> Emacs module uses. When I run those programs, they work as they should,
> both in Linux and in OS X.
> To eliminate another factor: Both on OS X and on Linux I have compiled
> Emacs 25 from source with the --with-modules flag passed to the configure
> script.
> 
> So my current hypothesis is that somehow Emacs, while built correctly,
> doesn't load the module correctly on Linux, but I'm stumped as to what
> could cause that.

Actually, my first suspect would be that your module doesn't protect
its data from GC.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs 25 modules
  2016-10-26  2:39 ` Eli Zaretskii
@ 2016-10-26 11:33   ` Aurélien Aptel
  0 siblings, 0 replies; 6+ messages in thread
From: Aurélien Aptel @ 2016-10-26 11:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs@gnu.org

On Wed, Oct 26, 2016 at 4:39 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> Actually, my first suspect would be that your module doesn't protect
> its data from GC.

I would say it's unlikely after the GC switch to conservative
scanning. Could you share your module code?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs 25 modules
@ 2016-10-26 17:34 Joey Ezechiels
  2016-11-02  7:32 ` Zhang Jun
  0 siblings, 1 reply; 6+ messages in thread
From: Joey Ezechiels @ 2016-10-26 17:34 UTC (permalink / raw)
  To: aurelien.aptel+emacs; +Cc: help-gnu-emacs

Yes, the module code is located here
<https://github.com/jjpe/spoofax-mode/tree/master/module.rs>, and the Elisp
code that loads the module is located here
<https://github.com/jjpe/spoofax-mode/blob/master/spoofax.el#L112>.

The module is written in Rust, but an earlier prototype of the module was
written in C and exhibited the same loading issues under Linux.


Best regards / Met vriendelijke groet
Joey Ezechiëls


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs 25 modules
  2016-10-26 17:34 Joey Ezechiels
@ 2016-11-02  7:32 ` Zhang Jun
  2016-11-07 20:51   ` Joey Ezechiels
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang Jun @ 2016-11-02  7:32 UTC (permalink / raw)
  To: Joey Ezechiels; +Cc: help-gnu-emacs

don't know rust and OSx, if your module also load other .so file at
runtime, it may have problem,
then need to change emacs src/dynlib.c, add RTLD_GLOBAL flag to dlopen()

On Thu, Oct 27, 2016 at 1:34 AM, Joey Ezechiels <joey.ezechiels@gmail.com>
wrote:

> Yes, the module code is located here
> <https://github.com/jjpe/spoofax-mode/tree/master/module.rs>, and the
> Elisp
> code that loads the module is located here
> <https://github.com/jjpe/spoofax-mode/blob/master/spoofax.el#L112>.
>
> The module is written in Rust, but an earlier prototype of the module was
> written in C and exhibited the same loading issues under Linux.
>
>
> Best regards / Met vriendelijke groet
> Joey Ezechiëls
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Emacs 25 modules
  2016-11-02  7:32 ` Zhang Jun
@ 2016-11-07 20:51   ` Joey Ezechiels
  0 siblings, 0 replies; 6+ messages in thread
From: Joey Ezechiels @ 2016-11-07 20:51 UTC (permalink / raw)
  To: Zhang Jun; +Cc: help-gnu-emacs

Hi Zhang,

Thank you for your response. I have tried adding the RTLD_GLOBAL flag to
the only call to dlopen() in the file you mentioned, but unfortunately that
turns out not to work: I still get the same garbage output as before.

What's odd about this whole situation is that I'm trying to accomplish
something conceptually very simple: Using ZeroMQ from an Emacs
module. Since it is most easily accessed as a dynlib when working
multi-platform, that's the way I want to link the module and zmq.


Met vriendelijke groet / Best regards,
Joey Ezechiëls

On Wed, Nov 2, 2016 at 8:32 AM, Zhang Jun <gb2313@gmail.com> wrote:

> don't know rust and OSx, if your module also load other .so file at
> runtime, it may have problem,
> then need to change emacs src/dynlib.c, add RTLD_GLOBAL flag to dlopen()
>
> On Thu, Oct 27, 2016 at 1:34 AM, Joey Ezechiels <joey.ezechiels@gmail.com>
> wrote:
>
>> Yes, the module code is located here
>> <https://github.com/jjpe/spoofax-mode/tree/master/module.rs>, and the
>> Elisp
>> code that loads the module is located here
>> <https://github.com/jjpe/spoofax-mode/blob/master/spoofax.el#L112>.
>>
>> The module is written in Rust, but an earlier prototype of the module was
>> written in C and exhibited the same loading issues under Linux.
>>
>>
>> Best regards / Met vriendelijke groet
>> Joey Ezechiëls
>>
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-07 20:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-25 21:06 Emacs 25 modules Joey Ezechiels
2016-10-26  2:39 ` Eli Zaretskii
2016-10-26 11:33   ` Aurélien Aptel
  -- strict thread matches above, loose matches on Subject: below --
2016-10-26 17:34 Joey Ezechiels
2016-11-02  7:32 ` Zhang Jun
2016-11-07 20:51   ` Joey Ezechiels

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.