Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 234622
Alias:
Product:
Component:
Status: RESOLVED
Resolution: WONTFIX
Assigned To: Matti Bickel <mabi@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Davide Cendron <scen@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
lua_with_g++.diff patch for dev-lang/lua-5.1.3-r4 patch Davide Cendron 2008-08-13 12:45 0000 557 bytes Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 234622 depends on: Show dependency tree
Bug 234622 blocks: 188214 242170
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-08-13 12:44 0000
Hi, here's a trivial patch for compiling dev-lang/lua with g++ instead of gcc.

It solves some trouble with some package, e.g. games-fps/edge (see bug
#188214).

------- Comment #1 From Davide Cendron 2008-08-13 12:45:31 0000 -------
Created an attachment (id=162816) [details]
patch for dev-lang/lua-5.1.3-r4

------- Comment #2 From solar 2008-09-13 20:28:57 0000 -------
This patch is backwords. But it should not be required. Can you explain a bit
more  why it should be built with $CHOST-g++  vs $CHOST-gcc ? Perhaps if that
is introduced so should the nocxx USE flag to keep the existing behavior.

------- Comment #3 From Davide Cendron 2008-10-09 08:12:10 0000 -------
(In reply to comment #2)
> This patch is backwords. But it should not be required. Can you explain a bit
> more  why it should be built with $CHOST-g++  vs $CHOST-gcc ? Perhaps if that
> is introduced so should the nocxx USE flag to keep the existing behavior.
> 

I straight report the upstream's explanation:

"Lua MUST be compiled with g++ and not gcc. That's because it needs to use
special C++ exception stuff for handling errors properly.

That explains your missing symbols, the linker is looking for C++ mangled
symbol names instead of normal C symbol names (or vice versa)."

See also here: http://edge.sourceforge.net/phpBB2/viewtopic.php?p=2722#2722

------- Comment #4 From Matti Bickel 2008-10-09 21:29:21 0000 -------
I'd like to introduce a cxx flag to address this situation. Compiling with gcc
is the lua upstream default and it should be kept that way.

Are there any objections?

------- Comment #5 From Davide Cendron 2008-10-10 07:26:26 0000 -------
(In reply to comment #4)
> I'd like to introduce a cxx flag to address this situation. Compiling with gcc
> is the lua upstream default and it should be kept that way.
> 
> Are there any objections?
> 

No, it's a good solution for me.

So the edge ebuild just will need a classic "built_with_use || die" trick or,
in the future, the great USE dependencies feature (EAPI-2).

------- Comment #6 From Matti Bickel 2008-10-10 08:26:29 0000 -------
i just committed the ebuild (5.1.4-r1).

EAPI-2 is already live, so you can just say DEPEND="dev-lang/lua[cxx]" :)

------- Comment #7 From Rafał Mużyło 2008-10-10 10:25:44 0000 -------
This seems rather strange.
Shouldn't this rather be solved by adding
extern "C" {...}
around lua includes in src/i_luainc.h ?
(OK, I'm not sure if this would be a correct solution, 
but this seem more sane).

------- Comment #8 From Rafał Mużyło 2008-10-10 14:01:41 0000 -------
Consider above sort of confirmed.
I've just tried it and edge did run afterwards.

------- Comment #9 From Ryan Tandy 2008-10-13 06:52:44 0000 -------
This seems weird to me.  Now if Lua is built with g++, my programs that link
against it also have to be built with g++, or they don't link correctly. 
Adding USE="-cxx" for Lua fixed that issue, but I don't have a very hard time
imagining that sooner or later we will have one package in the tree that needs
lua built with g++ and another that needs it built with gcc, which would
prevent them from being installed at the same time.  I agree with Rafał that
this should be addressed with some more portable fix.

------- Comment #10 From Rafał Mużyło 2008-10-15 19:31:28 0000 -------
I'd say first bugs caused by this solution have hit bugzilla
(bug 242174 and bug 242170).

------- Comment #11 From Peter Volkov 2008-10-16 19:12:01 0000 -------
I think this fix should be reconsidered as it breaks packages. Lua is C
application and should be compiled with C compiler only! Please, explain in
little more details what exceptions C code of lua starts to use when it is
compiled with g++?

Missing symbols are quite understandable as g++ mangle symbols. Read about that
here:

http://en.wikipedia.org/wiki/Name_mangling#Handling_of_C_symbols_when_linking_from_C.2B.2B

Currently I consider what was added to the tree as very nasty hack. Please
revert.

I haven't tested but take a look at  Rafał's suggestion (comment #7). It looks
much more sane (and again read above link).

------- Comment #12 From Rafał Mużyło 2008-10-16 22:43:52 0000 -------
I think main problem here lies in the lua upstream (as I wrote in
bug 242170#c4).
Lua was designed to be too embeddable - upstream was so focused on static
linking,
that it hasn't considered the effect of some of its design choices
for shared libs.
Of course, I don't feel as an expert on this topic,
but I'd like to hear an opinion or two from such here.

------- Comment #13 From Peter Volkov 2008-10-17 07:44:27 0000 -------
Since there are ways to use lua in C++ code (see my comment in edge bug) I
think current problem lays in edge upstream. They should provide correct
solution...

Having system lua being built with C++ should be removed is it's not supported
by anybody.

And speaking about extern "C". lua provides lua.hpp for this exact case, but
although this'll possibly fix compilation this'll break error handling. And
error handling should be fixed by upstream...


Matti, could you revert that commit?

------- Comment #14 From Matti Bickel 2008-10-17 22:10:13 0000 -------
I've done so, and pulled the lua-5.1.4-r1 ebuild from the tree.
sorry for the confusion it caused.

Well, compiling lua with "extern C" causes some disadvantages to exception
handling it seems. While this may be a reason to compile lua with C++, as i've
written in the changelog entry, the benefits of doing this systemwide are much
lower than the disadvantages (other packages breaking, etc.)

Thus i think the burden really is on edge upstream. As i've seen on the other
bug, upstream is cooperative and a solution in the pipeline. Good news!

------- Comment #15 From Matti Bickel 2008-10-17 22:11:19 0000 -------
Should be finally resolved, then. As the "solution" is the status quo, bug is
marked wontfix.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug