`singletonBody' undeclared (first use this function)

3 views
Skip to first unread message

Oyster

unread,
Oct 15, 2008, 3:31:04 AM10/15/08
to Avian
I am in win2k, with mingw/msys

I found that singletonBody is assigend in avian.git\build\windows-i386-
compile-fast\type-declarations.cpp, but not in avian.git\src\*.h/*.cpp

thus while make, I get
[msg]
compiling build/windows-i386-compile-fast/machine.o
In file included from src/jnienv.h:14,
from src/machine.cpp:11:
src/machine.h: In function `uint32_t* vm::singletonMask(vm::Thread*,
vm::Object*)':
src/machine.h:2256: error: `singletonBody' undeclared (first use this
function)
src/machine.h:2256: error: (Each undeclared identifier is reported
only once for each function it appears in.)
src/machine.h: In function `vm::Object*&
vm::singletonObject(vm::Thread*, vm::Object*, unsigned int)':
src/machine.h:2279: error: `singletonBody' undeclared (first use this
function)
src/machine.h: In function `uintptr_t& vm::singletonValue(vm::Thread*,
vm::Object*, unsigned int)':
src/machine.h:2286: error: `singletonBody' undeclared (first use this
function)
make: *** [build/windows-i386-compile-fast/machine.o] Error 1
[/msg]

[my mingw]
$ make -v
GNU Make 3.81
This program built for i386-pc-mingw32

$ gcc -v
Thread model: win32
gcc version 3.4.2 (mingw-special)
[/my mingw]

Frank Jacobs

unread,
Oct 15, 2008, 11:26:41 AM10/15/08
to av...@googlegroups.com
> I found that singletonBody is assigend in avian.git\build\windows-i386-compile-fast\type-declarations.cpp, but not in avian.git\src\*.h/*.cpp

One possibility is a path issue in your environment. It appears that
the source has all the necessary includes and function declarations.
First, build/windows-i386-compile-fast/type-declarations.cpp does
define a function named singletonBody:

inline uintptr_t&
singletonBody(Thread* t UNUSED, object o, unsigned i) {

Second, src/machine.h is including type-declarations.cpp, so any
references to that function in machine.h should be resolved properly.

When I was debugging the Windows build initially, I used echos a lot
to confirm path settings. For example, a certain line in the makefile
might be something like this:

$(gcc) $(CFLAGS) -I$(JAVA_HOME) ...

I would change the entry to:

echo $(gcc) $(CFLAGS) -I$(JAVA_HOME) ...

Then, when running the build, I could see what flags and paths are
being used. This helped to pinpoint paths that needed some adjusting
for the Windows build. If you give this a try, you might see that some
path is incorrect.


> $ gcc -v
This probably won't solve your problem, but I did my Windows/MSys
build with gcc 3.4.5. I suppose there is a small chance that gcc 3.4.2
has some kind of bug that is causing this issue to occur.

Joel Dice

unread,
Oct 15, 2008, 11:53:42 AM10/15/08
to av...@googlegroups.com
On Wed, 15 Oct 2008, Frank Jacobs wrote:

> When I was debugging the Windows build initially, I used echos a lot
> to confirm path settings. For example, a certain line in the makefile
> might be something like this:
>
> $(gcc) $(CFLAGS) -I$(JAVA_HOME) ...
>
> I would change the entry to:
>
> echo $(gcc) $(CFLAGS) -I$(JAVA_HOME) ...
>
> Then, when running the build, I could see what flags and paths are
> being used. This helped to pinpoint paths that needed some adjusting
> for the Windows build. If you give this a try, you might see that some
> path is incorrect.

Or you can just remove the "MAKEFLAGS = -s" line at the top of the
makefile. That will allow you to see every command that is executed
(except for a few prefixed with "@").

Joel Dice

unread,
Oct 15, 2008, 12:02:53 PM10/15/08
to Avian

The bizarre thing about this is that the compiler is not complaining about
any of the other functions declared in type-declarations.cpp, like
byteArrayBody and stringHashCode - only singletonBody. Upgrading your
compiler might be a good idea.

Frank Jacobs

unread,
Oct 15, 2008, 12:28:20 PM10/15/08
to av...@googlegroups.com
> Or you can just remove the "MAKEFLAGS = -s" line at the top of the makefile.

That is way better than echos -- thanks for the tip. I haven't used
make all that much.

Oyster

unread,
Oct 16, 2008, 9:42:12 AM10/16/08
to Avian
On 10月15日, 下午11时26分, "Frank Jacobs" <forkj...@gmail.com> wrote:
> > I found that singletonBody is assigend in avian.git\build\windows-i386-compile-fast\type-declarations.cpp, but not in avian.git\src\*.h/*.cpp
>
> One possibility is a path issue in your environment. It appears that
> the source has all the necessary includes and function declarations.
> First, build/windows-i386-compile-fast/type-declarations.cpp does
> define a function named singletonBody:
>
> inline uintptr_t&
> singletonBody(Thread* t UNUSED, object o, unsigned i) {
So bad, there is no function singletonBody in type-declarations.cpp.
but there are
[code]
inline uintptr_t&
singletonBody0(Thread* t UNUSED, object o, unsigned i)

and

inline uintptr_t&
singletonBodyUnsafe0(Thread* t UNUSED, object o, unsigned i) {
[/code]
so if I change singletonBody in compile.cpp, machine.cpp and machine.h
to singletonBody0. then I get
[msg]
cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC
++ but not for C
[/msg]
again, I modify makefile to replace '-fno-rtti' with blank.

now, I got avian.exe finnally!

it is a very strange process. I donno why :(

btw, I can compile ming/libharu and many other projects with my mingw

Oyster

unread,
Oct 22, 2008, 2:57:46 AM10/22/08
to Avian
This problem exists in the current gitted source and the solution is
same on my windows and mingw.
Is there anybody else meet the same problem?
Can sombody write this in the makefile ( I don't know the linux
command, else I will do it myself sorry. And I believe this process
does not yield bad effect)
[pcode]
if CaseSensitiveFind singletonBody0 in file[build\windows-i386-compile-
fast\type-declarations.cpp, build\windows-i386-compile-fast\type-
constructors.cpp]
change singletonBody0 to singletonBody
[/pcode]

Oyster 写道:

Joel Dice

unread,
Oct 22, 2008, 10:55:30 AM10/22/08
to Avian
On Tue, 21 Oct 2008, Oyster wrote:

> This problem exists in the current gitted source and the solution is
> same on my windows and mingw.
> Is there anybody else meet the same problem?

I haven't been able to reproduce this, but I've made a change that might
fix it.

The code in type-declarations.cpp, type-initializations.cpp, etc. is
generated by type-generator (compiled from type-generator.cpp), which uses
types.def as input. There was code in type-generator.cpp which added a
"0" to the name of the accessor for any field marked with the "hide"
keyword in types.def, allowing us to override that accessor with
hand-written code. However, types.def does not have any "hidden" fields
anymore, so the code was unecessary, and I've removed it.

Please let me know if this fixes your problem.

Oyster

unread,
Oct 22, 2008, 10:57:21 PM10/22/08
to Avian
Great, type-generator gives right code now

But one more thing is
[code]
compiling build/windows-i386-compile-fast/x86-asm.o
cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC
++ but not for C
make: *** [build/windows-i386-compile-fast/x86-asm.o] Error 1
[/code]
so I have to delete -fno-rtti in makefile as I mentioned before. Now
everything is ok

Joel Dice 写道:

Joel Dice

unread,
Oct 23, 2008, 6:58:09 PM10/23/08
to Avian
I've removed unecessary flags, including -fno-rtti, from the assembly
compile command. Please let me know if that works for you.

> --‾--‾---------‾--‾----‾------------‾-------‾--‾----‾
> You received this message because you are subscribed to the Google Groups "Avian" group.
> To post to this group, send email to av...@googlegroups.com
> To unsubscribe from this group, send email to avian+un...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/avian?hl=en
> -‾----------‾----‾----‾----‾------‾----‾------‾--‾---
>

Oyster

unread,
Oct 23, 2008, 9:29:45 PM10/23/08
to Avian
of cause it works! ^-^

Joel Dice ��
> I've removed unecessary flags, including -fno-rtti, from the assembly
> compile command. Please let me know if that works for you.
>
> On Wed, 22 Oct 2008, Oyster wrote:
>
> >
> > Great, type-generator gives right code now
> >
> > But one more thing is
> > [code]
> > compiling build/windows-i386-compile-fast/x86-asm.o
> > cc1.exe: warning: command line option "-fno-rtti" is valid for C++/ObjC
> > ++ but not for C
> > make: *** [build/windows-i386-compile-fast/x86-asm.o] Error 1
> > [/code]
> > so I have to delete -fno-rtti in makefile as I mentioned before. Now
> > everything is ok
> >
> > Joel Dice $B<LF;!' (J
Reply all
Reply to author
Forward
0 new messages