<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Alexey,<br>
<br>
GNU APL uses the C functions <b>dlopen()</b> to open the library
and <b>dlsym() </b>to locate functions inside<br>
the library.<br>
<br>
From the printout we see that GNU APL finds the library file but the
<b>dlopen()</b> of the existing file fails.<br>
<br>
Although the <b>dlopen()</b> and <b>dlsym()</b> functions are
quite standard among different platforms, the way<br>
in which the dynamic library files are linked from the compiled
object files differs considerably between<br>
platforms.<br>
<br>
In this particular case there could be 2 reasons for <b>dlopen()</b>
to fail:<br>
<br>
1. a bug in the platform as one of the posts below suggests.
Somebody who had the same problem (although<br>
with a different library) has reported that after an OS-X update his
problem disappeared.<br>
<br>
2. The library must be constructed in a specific way. On GNU/Linux
this is often properly handled by libtool,<br>
but I do not know if libtool even exists on OS-X and if it works
properly. On GNU/Linux there is another<br>
tool called <b>libtoolize</b> which prepares autoconf projects that
do not use <b>libtoolize</b> into projects that do.<br>
<b>libtoolize</b> does some magic to make shared library work and
you may need to do something similar on<br>
your box.<br>
<br>
My proposal would be:<br>
<br>
1. upgrade your OS-X as proposed in the post below.<br>
<br>
2. If that does not fix the problem then learn from your platform
documentation how shared libraries<br>
for use with dlopen() shall be built. And what namespaces are (they
do not exist on GNU/Linux).<br>
<br>
Good Luck!<br>
/// Jürgen<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/12/2017 12:27 PM, Alexey
Veretennikov wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAKE5LL6H7nu+***@mail.gmail.com">
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
</div>
Could you please hint me how to specify these flags so I can
experiment myself?<br>
<br>
</div>
Br,<br>
</div>
/Alexey<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2017-12-11 16:19 GMT+01:00 Juergen
Sauermann <span dir="ltr"><<a
href="mailto:***@t-online.de"
target="_blank" moz-do-not-send="true">***@t-online.de</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <font
face="Helvetica, Arial, sans-serif">Hi Alexey,<br>
<br>
I suppose that you need some platform specific linker
flags when building </font><font face="Helvetica,
Arial, sans-serif"><b>libemacs.dylib</b>.<br>
Since I do not have access to a Mac OS-X machine, I
can't tell you which ones.<br>
<br>
Best Regards,<br>
/// Jürgen<br>
<br>
<br>
</font>
<div>
<div class="h5">
<div class="m_-4955542798000717810moz-cite-prefix">On
12/06/2017 08:18 PM, Alexey Veretennikov wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>
<div>
<div>It is really strange but reporting with
otool shows two level:<br>
<br>
otool -hV /Users/alexey/Applications/<wbr>gnu-apl/lib/apl/libemacs.dylib<br>
/Users/alexey/Applications/<wbr>gnu-apl/lib/apl/libemacs.<wbr>dylib:<br>
Mach header<br>
magic cputype cpusubtype caps
filetype ncmds sizeofcmds flags<br>
MH_MAGIC_64 X86_64 ALL 0x00
DYLIB 14 2272 NOUNDEFS DYLDLINK
TWOLEVEL WEAK_DEFINES BINDS_TO_WEAK
NO_REEXPORTED_DYLIBS<br>
<br>
</div>
For flat libraries there should be no TWOLEVEL
flag.<br>
<br>
</div>
Br,<br>
</div>
/Alexey<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2017-12-04 17:33
GMT+01:00 Juergen Sauermann <span dir="ltr"><<a
href="mailto:***@t-online.de"
target="_blank" moz-do-not-send="true">***@t-online.de</a><wbr>></span>:<br>
<blockquote class="gmail_quote" style="margin:0
0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <font
face="Helvetica, Arial, sans-serif">Hi,<br>
<br>
from the GNU APL printout it looks like
the file was found, but something is wrong
with the file:<br>
</font><br>
<font face="Helvetica, Arial, sans-serif"><span> <font
face="Courier New, Courier, monospace"><b>
file /Users/alexey/Applications/gnu</b></font><font
face="Courier New, Courier, monospace"><b><wbr>-apl/lib/apl/libemacs.dylib
( flat namespace</b><b><br>
</b><b> in
/Users/alexey/Applications/gnu</b><b><wbr>-apl/lib/apl/libemacs.dylib
)</b></font><br>
<br>
</span> So GNU APL was able to open the
file (using <b>dlopen()</b>) but then
gets the "flat namespace" error at some
point.<br>
<br>
The second link below says:<br>
</font><br>
<div
class="m_-4955542798000717810m_9090577801925878262timeline-comment-header
m_-4955542798000717810m_9090577801925878262clearfix">
<h3
class="m_-4955542798000717810m_9090577801925878262timeline-comment-header-text
m_-4955542798000717810m_9090577801925878262f5
m_-4955542798000717810m_9090577801925878262text-normal">
<strong> <a
href="https://github.com/amandogra"
class="m_-4955542798000717810m_9090577801925878262author
m_-4955542798000717810m_9090577801925878262text-inherit"
target="_blank"
moz-do-not-send="true">amandogra</a>
</strong> commented <a
href="https://github.com/tmux/tmux/issues/547#issuecomment-250954758"
class="m_-4955542798000717810m_9090577801925878262timestamp"
target="_blank" moz-do-not-send="true">on
Oct 2, 2016</a> </h3>
</div>
<div
class="m_-4955542798000717810m_9090577801925878262edit-comment-hide">
<table
class="m_-4955542798000717810m_9090577801925878262d-block">
<tbody
class="m_-4955542798000717810m_9090577801925878262d-block">
<tr
class="m_-4955542798000717810m_9090577801925878262d-block">
<td
class="m_-4955542798000717810m_9090577801925878262d-block
m_-4955542798000717810m_9090577801925878262comment-body
m_-4955542798000717810m_9090577801925878262markdown-body
m_-4955542798000717810m_9090577801925878262js-comment-body">
<p>It got solved by OS upgrade.<br>
For someone who comes to this...<br>
I was on Mac OSX El Capitan, but
I upgraded to macOS Sierra.<br>
Then, I executed the following
command</p>
<pre><code>brew unlink libevent && brew link libevent
</code></pre>
<p>This fixed my issue.</p>
</td>
</tr>
</tbody>
</table>
</div>
<font face="Helvetica, Arial, sans-serif"><br>
The posting was related to a different
library but the (rest of the) error
message looks very similar (considering<br>
that GNU APL cuts off the start the error
message text until the last : in it). The
full error message was most likely:</font><br>
<pre><code>Expected in: flat namespace</code></pre>
<font face="Helvetica, Arial, sans-serif">Maybe
<b>"nm</b><b> -D" </b>on the dylib file
reveals some more information.<br>
<br>
Best Regards,<br>
/// Jürgen<br>
<br>
<br>
</font>
<div>
<div class="m_-4955542798000717810h5">
<div
class="m_-4955542798000717810m_9090577801925878262moz-cite-prefix">On
12/04/2017 04:06 AM, Elias Mårtenson
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Perhaps adding the path
to the dylib file in
DYLIB_LIBRARY_PATH will help? Don't
forget to exprt the variable before
starting apl.
<div><br>
</div>
<div>Regards,</div>
<div>Elias</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 4
December 2017 at 01:56, Juergen
Sauermann <span dir="ltr"><<a
href="mailto:***@t-online.de" target="_blank"
moz-do-not-send="true">***@t-online.de</a><wbr>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0
.8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div text="#000000"
bgcolor="#FFFFFF"> <font
face="Helvetica, Arial,
sans-serif">Hi,<br>
<br>
I haven't changed anything
in that area. One poster in
one of the links below
mentioned that an OS-X
upgrade<br>
had fixed a similar problem
that the poster had, so my
impression is that this is a
problem than cannot be fixed<br>
inside GNU APL.<br>
</font><br>
Best Regards,<br>
/// Jürgen
<div>
<div
class="m_-4955542798000717810m_9090577801925878262h5"><br>
<br>
<br>
<div
class="m_-4955542798000717810m_9090577801925878262m_-2180885449486840444moz-cite-prefix">On
12/03/2017 12:02 PM,
Elias Mårtenson wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">10.6.8 is
indeed very old. I
thought my Macbook was
old and it's running
10.10.
<div><br>
</div>
<div>I have to admit
that I haven't tried
the Emacs mode on
OSX in a while since
I don't use Macs
anymore. That said,
last time I did try,
it worked fine.</div>
<div><br>
</div>
<div>Jürgen, could
there be an issue
with the way the
libraries are built?
Did anything change
in the last couple
of years?</div>
<div><br>
</div>
<div>Regards,</div>
<div>Elias</div>
</div>
<div class="gmail_extra"><br>
<div
class="gmail_quote">On
3 December 2017 at
18:58, Juergen
Sauermann <span
dir="ltr"><<a
href="mailto:***@t-online.de"
target="_blank"
moz-do-not-send="true">***@t-online.de</a><wbr>></span>
wrote:<br>
<blockquote
class="gmail_quote"
style="margin:0 0
0
.8ex;border-left:1px
#ccc
solid;padding-left:1ex">
<div
text="#000000"
bgcolor="#FFFFFF">
<font
face="Helvetica,
Arial,
sans-serif">Hi
Alexey,<br>
<br>
I am not
really
familiar with
emacs or OS X,
so Elias is
probably
better
informed than
me.<br>
<br>
Unfotunately
shared
libraries are
rather
platform
dependent and
so are the
error messages
that<br>
they produce.
From the
output below
it seems that
the file </font><font
face="Helvetica, Arial, sans-serif"><b>libemacs.dylib</b><b> </b>exists
and was found,<br>
but could not
be opened with
<b>dlopen()</b>.
It might be
that your
platform needs
additional
linker flags<br>
for dynamic
libraries to
work, but I
have no idea
which ones.<br>
</font><br>
<font
face="Helvetica,
Arial,
sans-serif"><font
face="Helvetica, Arial, sans-serif">See also:<br>
<br>
</font><a
href="https://github.com/tmux/tmux/issues/547"
target="_blank" moz-do-not-send="true">https://github.com/tmux/tmux/i<wbr>ssues/547</a>
or<br>
<br>
<a
href="https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html"
target="_blank" moz-do-not-send="true">https://developer.apple.com/li<wbr>brary/content/documentation/Po<wbr>rting/Conceptual/PortingUnix/c<wbr>ompiling/compiling.html</a><br>
<br>
Best Regards,<br>
/// Jürgen<br>
<br>
<br>
</font>
<div>
<div
class="m_-4955542798000717810m_9090577801925878262m_-2180885449486840444h5">
<div
class="m_-4955542798000717810m_9090577801925878262m_-2180885449486840444m_2032272456363789370moz-cite-prefix">On
11/30/2017
08:39 PM,
Alexey
Veretennikov
wrote:<br>
</div>
<blockquote
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hi,<br>
<br>
</div>
I've built GNU
APL with the
following
parameters on
my old (OSX
10.6.8)
macbook:<br>
</div>
<br>
./configure
--prefix=/Users/alexey/Applica<wbr>tions/gnu-apl<br>
make install<br>
</div>
<br>
So nothing
special(I did
a small change
though since
strndup is not
yet supported
on this OS).
I'm using gcc
7.2.0.<br>
</div>
However when I
try to run apl
from emacs, I
get the
following
error:<br>
<br>
Could not find
shared library
'libemacs'<br>
The following
directories
and file names
were tried:<br>
file
/Users/alexey/Applications/gnu<wbr>-apl/lib/apl/libemacs.so
(No such file
or directory)<br>
file
/Users/alexey/Applications/gnu<wbr>-apl/lib/apl/libemacs.dylib
( flat
namespace<br>
in
/Users/alexey/Applications/gnu<wbr>-apl/lib/apl/libemacs.dylib
)<br>
file
/Users/alexey/Applications/gnu<wbr>-apl/lib/apl/libemacs
(No such file
or directory)<br>
directory
/usr/lib/apl<br>
directory
/usr/local/lib/apl<br>
file
./libemacs.so <wbr>
(No such file
or directory)<br>
file
./libemacs.dylib <wbr>
(No such file
or directory)<br>
file
./libemacs <wbr>
(No such file
or directory)<br>
directory
./native<br>
directory
./emacs_mode<br>
<br>
<br>
</div>
The file
/Users/alexey/Applications/gnu<wbr>-apl/lib/apl/libemacs.dylib
exists.<br>
<br>
</div>
<div>Br,<br>
</div>
<div>/Alexey<br>
</div>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>