c++ error

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: c++ error

Post by mhull »

hgm wrote:Which version of Polyglot are you compiling? The one I am used to doesn't contain the symbol 'leveldb' anywhwere in its sources. (And it doesn't have any .cpp files either, btw.)
Ah, version 1.4, which is rather old. A bit of digging produced a more recent version, 2.03. Thanks for the heads-up, HGM.

Skipped the configure/make thing and just did:

Code: Select all

m68k-linux-gcc -O3 -m68030 -o polyglot -lm -I/opt/cross/m68k-linux/include/ *.c
Successfully compiled. Next, test on target platform with CFish-m68k.
Matthew Hull
jdart
Posts: 4428
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: c++ error

Post by jdart »

What hardware do you have that is on a m68k architecture?

--Jon
User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: c++ error

Post by mhull »

jdart wrote:What hardware do you have that is on a m68k architecture?

--Jon
Macintosh IIsi, M68030 @20Mhz, 16Mb RAM.
Matthew Hull
User avatar
MikeB
Posts: 4889
Joined: Thu Mar 09, 2006 6:34 am
Location: Pen Argyl, Pennsylvania

Re: c++ error

Post by MikeB »

mhull wrote:
jdart wrote:What hardware do you have that is on a m68k architecture?

--Jon
Macintosh IIsi, M68030 @20Mhz, 16Mb RAM.
I actually had one of those - over 20 years ago...decent machine for its day...
User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: c++ error

Post by mhull »

MikeB wrote:
mhull wrote:
jdart wrote:What hardware do you have that is on a m68k architecture?

--Jon
Macintosh IIsi, M68030 @20Mhz, 16Mb RAM.
I actually had one of those - over 20 years ago...decent machine for its day...
Took some work to get mine running again.

1) Power supply re-capped (capacitors had leaked).
2) RAM Upgraded from 5Mb to 17Mb.
3) Installed a 10BASE-T/FPU card combo, Linux is happier with an FPU and a network card is the only practical way to get large files onto the machine.

So a bit of $$ outlay and an education in cross-compiling and Kernel/initramfs hacking. I'm booting Linux non-destructively using Penguin Boot under MacOS 7.5. This wastes a bit of the scarce RAM taken up by the MacOS.

Potential Upgrades:
1) SCSI-1_to_SD adapter to install Linux on SD and preserve/replace the MacOS installation on the creaky old 80Mb hard drive.
2) Mac Rominator II (http://www.bigmessowires.com/mac-rom-inator-ii/), install Linux kernel on a ROM device that fits the ROM expansion slot on IIsi (boot linux without a disk).
3) Upgrade to the maximum 64Mb RAM. <<--- I'll probably do this one for sure.
Matthew Hull
User avatar
mhull
Posts: 13447
Joined: Wed Mar 08, 2006 9:02 pm
Location: Dallas, Texas
Full name: Matthew Hull

Re: c++ error

Post by mhull »

POLYGLOT CROSS-COMPILE FOR M68K

Code: Select all

m68k-linux-gcc -O3 -m68030 -o polyglot -lm -I/opt/cross/m68k-linux/include/ *.c
This compiles successfully but it doesn't run on the target machine from a thin kernel/initramfs boot because dynamic libraries are missing. So I thought I'd try a static compile like this:

Code: Select all

m68k-linux-gcc -static -O3 -m68030 -o polyglot -lm -I/opt/cross/m68k-linux/include/ *.c
But the -static switch appears to conflict with the -lm switch, giving the same errors I was getting without the -lm switch, namely these:

Code: Select all

util.c:(.text+0x78): undefined reference to `floor'
/tmp/ccX9khs9.o: In function `my_round':
util.c:(.text+0xe8): undefined reference to `floor'
collect2: error: ld returned 1 exit status
Matthew Hull
User avatar
hgm
Posts: 28475
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: c++ error

Post by hgm »

It is a mystery to me why people would want to use floor() on floating point numbers that are guaranteed to be positive, as assigning a float to an intereger directly should do exactly the same in C. I vaguely remember having some trouble with this in another program, though, where the compiler inserted a call to _floor even when the source code did not explicitly reference it. I don't recall anymore what I did. Perhaps I just wrote my own floor in assembler, and included it in the linking; this seems so trivial that looking for any other solution probaly would take orders of magnitude more time.