Hi,
First, these build problems only occurs in MacOS. In Linux everything
works just fine as it is.
If you download the pre-compiled binaries, you will see that the non-lua
libraries are built as "dylib". The Lua modules that are loaded are built
as "so". I use "-undefined dynamic_lookup". You can check at the
"tecmake.mak" common makefile.
But then yes there is the issue with the RTLD_LOCAL flag. This works just
fine in Linux, but not in MacOS. So the clean solution would be to build a
separate dylib with all the exported utilities. This is on our to do list,
but has pros and cons. Since Mac is secondary and almost not used on out
current build, I decided not to do it for now. For the exception users were
easier to edit Lua and change the flag back to RTLD_GLOBAL. So that's what
I recommend to you at least for now.
Best,
Scuri
2017-09-01 17:36 GMT-03:00 Eric Wing <ewmail...@gmail.com>:
> I was trying to get IupLua built for some of the new platforms I’m
> working on, but I am getting blocked by a dependency problem. So I
> wanted to clarify how they are supposed to be built.
>
> I had assumed they were built as shared loadable modules and not
> regular dynamic libraries. (The distinction between the two is
> important because some platforms make a strong distinction and have
> consequences like what I’m facing.) But maybe my assumption is wrong…
>
> While trying to build iupweblua, I discovered there is a dependency on
> the C symbol iuplua_call in iuplua. If building modules, this
> dependency is problematic because I can’t directly link again iuplua
> in a lot of cases.
>
> For example, on Mac, I need to use the additional flags
> -flat_namespace -undefined suppress to remove the compile time issue.
>
> http://lua-users.org/wiki/BuildingModules
> gcc -bundle -flat_namespace -undefined suppress -o module.so module.o
>
> But there is still a runtime issue because when the iupluaweb module
> gets loaded, it fails because it still cannot find the iuplua_call
> symbol (even when the iuplua module was required before it). This is
> because Lua by default calls dlopen with RTLD_LOCAL instead of
> RTLD_GLOBAL.
>
> http://lua-users.org/lists/lua-l/2015-05/msg00297.html
>
> This means the symbols that got loaded when loading iuplua are not
> globally visible for iupluaweb to automatically pick up, which is why
> the module fails to load. (And this problem is true on all the Unices,
> not just Mac as far as I know.)
>
> Does IupLua do something special to get around this? (I heard
> something about a flag with package.loadlib in Lua 5.2 to force
> RTLD_GLOBAL.)
>
>
> But then for Windows/Visual Studio, this is even a bigger head
> scratcher for me because I don’t think there is any compiler flag to
> skip past the link dependency. Furthermore, when you build a module
> instead of a library for Windows, you don’t get an explicit .lib that
> you can link to, even if you wanted to try to explicitly link against
> it.
>
>
> So maybe my assumption is wrong and everything should be built as
> dynamic libraries? This would allow iupluaweb to link against iuplua.
> But this means your main app must always explicitly link against
> iuplua/iupluaweb, etc. And I think this has negative repercussions for
> standalone Lua interpreters/apps that hope to load iuplua* modules
> without having explicit knowledge of them (link beforehand) since some
> platforms make stronger distinctions between loadable modules and
> dynamic libraries.
>
>
> FYI, I’m testing against Lua 5.3.
>
> Thanks,
> Eric
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users