Bug#755561: berusky2: FTBFS on mips*: undefined reference to `mmalloc'
Dejan Latinovic
Dejan.Latinovic at imgtec.com
Thu Jul 24 11:30:01 UTC 2014
Hello,
I have investigated this a little bit more
This seems not to be a compile issue.
The reason for build failure on mips/mipsel is
improper usage of inline functions.
For example in a file:
src/age/graph/mesh.cpp
a functions mmalloc is used.
Declaration of mmalloc function is included from
src/age/utils/mem_alloc.h,
but a definition of the mentioned function
is in src/komat/mmalloc.h.
mmalloc.h is not visible to mesh.cpp, and during compilation of mesh.cpp
it is not possible to inline mmalloc function.
So, object file mesh.o is created, but implementation of mmalloc function is missing.
This is the reason of an error:
mesh.cpp:59: undefined reference to `mmalloc'
durign linking of berusky2on mips/mipsel with gcc-4.9.
Using gcc-4.8 on mips, in some other object file (in this case Berusky3d_light.o)
it seems that compiler decided not to inline mmalloc function.
As a result, during creating of berusky2,
linker is capable to resolve mmalloc symbol,
because Berusky3d_light.o contains implementation of mmalloc function.
In ./komat/Berusky3d_light.cpp definition of mmalloc function
is visible from src/komat/mmalloc.h
The same situation happens on amd64 with gcc-4.9,
but in other object file: Keyframe.o.
The point is that we could not guarantee that inline function
mmalloc would not be inlined in some cases.
For mesh.cpp which is not aware of mmalloc definition,
implementation of mmalloc during linking is needed.
Of course,
we could use -fno-inline flag but, this seems to be wrong solution to me.
The same usage of mmalloc function without a definition visible,
is noticed in files:
age/utils/mem_alloc.cpp
age/graph/gext.cpp
age/utils/utils.cpp
The solution could be to include mmalloc.h in mem_alloc.h,
so the definition of mmalloc function will be visible
in all files where mmalloc function is used.
The patch that contains this solution is attached.
Could you please consider to include it?
Best Regards,
Dejan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-mmalloc-usage.patch
Type: text/x-patch
Size: 373 bytes
Desc: fix-mmalloc-usage.patch
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20140724/f2928d31/attachment.bin>
More information about the Pkg-games-devel
mailing list