Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Building from source in Ubuntu - Solution found!  (Read 1046 times)

InfernoZeus

  • Bay Watcher
    • View Profile
Building from source in Ubuntu - Solution found!
« on: February 09, 2011, 01:23:29 pm »

Edit: I found the problem - I'd been trying to run it in a 64-bit version of Ubuntu, which doesn't seem to work. As soon as I switched over to a 32-bit version, everything worked fine.



I checked out a copy of the code from SVN, and noticed that there are two files on how to build/install LCS (INSTALL and LINUX_README.txt) - as far as I can tell, INSTALL is a auto-generated file, whereas LINUX_README.txt contains the correct instructions. I followed the instructions in LINUX_README.txt
Code: [Select]
bootstrap
./configure
make
but when I tried to run crimesquad, it shows the following errors:
Code: [Select]
*** buffer overflow detected ***: src/crimesquad terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f535cdd7537]
/lib/libc.so.6(+0xfe3f0)[0x7f535cdd63f0]
/lib/libc.so.6(__fread_chk+0x15b)[0x7f535cdd6bcb]
src/crimesquad[0x42f30b]
src/crimesquad[0x405ab3]
/lib/libc.so.6(__libc_start_main+0xfe)[0x7f535ccf6d8e]
src/crimesquad[0x4039a9]
======= Memory map: ========
00400000-00573000 r-xp 00000000 08:01 29493                              /home/ben/lcsgame/trunk/src/crimesquad
00772000-00773000 r--p 00172000 08:01 29493                              /home/ben/lcsgame/trunk/src/crimesquad
00773000-00775000 rw-p 00173000 08:01 29493                              /home/ben/lcsgame/trunk/src/crimesquad
00775000-00f6c000 rw-p 00000000 00:00 0
0268f000-026d0000 rw-p 00000000 00:00 0                                  [heap]
7f535cad4000-7f535cad6000 r-xp 00000000 08:01 152244                     /lib/libdl-2.12.1.so
7f535cad6000-7f535ccd6000 ---p 00002000 08:01 152244                     /lib/libdl-2.12.1.so
7f535ccd6000-7f535ccd7000 r--p 00002000 08:01 152244                     /lib/libdl-2.12.1.so
7f535ccd7000-7f535ccd8000 rw-p 00003000 08:01 152244                     /lib/libdl-2.12.1.so
7f535ccd8000-7f535ce52000 r-xp 00000000 08:01 152237                     /lib/libc-2.12.1.so
7f535ce52000-7f535d051000 ---p 0017a000 08:01 152237                     /lib/libc-2.12.1.so
7f535d051000-7f535d055000 r--p 00179000 08:01 152237                     /lib/libc-2.12.1.so
7f535d055000-7f535d056000 rw-p 0017d000 08:01 152237                     /lib/libc-2.12.1.so
7f535d056000-7f535d05b000 rw-p 00000000 00:00 0
7f535d05b000-7f535d070000 r-xp 00000000 08:01 129877                     /lib/libgcc_s.so.1
7f535d070000-7f535d26f000 ---p 00015000 08:01 129877                     /lib/libgcc_s.so.1
7f535d26f000-7f535d270000 r--p 00014000 08:01 129877                     /lib/libgcc_s.so.1
7f535d270000-7f535d271000 rw-p 00015000 08:01 129877                     /lib/libgcc_s.so.1
7f535d271000-7f535d2f3000 r-xp 00000000 08:01 152245                     /lib/libm-2.12.1.so
7f535d2f3000-7f535d4f2000 ---p 00082000 08:01 152245                     /lib/libm-2.12.1.so
7f535d4f2000-7f535d4f3000 r--p 00081000 08:01 152245                     /lib/libm-2.12.1.so
7f535d4f3000-7f535d4f4000 rw-p 00082000 08:01 152245                     /lib/libm-2.12.1.so
7f535d4f4000-7f535d5dc000 r-xp 00000000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7f535d5dc000-7f535d7db000 ---p 000e8000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7f535d7db000-7f535d7e3000 r--p 000e7000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7f535d7e3000-7f535d7e5000 rw-p 000ef000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7f535d7e5000-7f535d7fa000 rw-p 00000000 00:00 0
7f535d7fa000-7f535d83a000 r-xp 00000000 08:01 129896                     /lib/libncurses.so.5.7
7f535d83a000-7f535da39000 ---p 00040000 08:01 129896                     /lib/libncurses.so.5.7
7f535da39000-7f535da3d000 r--p 0003f000 08:01 129896                     /lib/libncurses.so.5.7
7f535da3d000-7f535da3e000 rw-p 00043000 08:01 129896                     /lib/libncurses.so.5.7
7f535da3e000-7f535da5e000 r-xp 00000000 08:01 145652                     /lib/ld-2.12.1.so
7f535dc3d000-7f535dc43000 rw-p 00000000 00:00 0
7f535dc5b000-7f535dc5e000 rw-p 00000000 00:00 0
7f535dc5e000-7f535dc5f000 r--p 00020000 08:01 145652                     /lib/ld-2.12.1.so
7f535dc5f000-7f535dc60000 rw-p 00021000 08:01 145652                     /lib/ld-2.12.1.so
7f535dc60000-7f535dc61000 rw-p 00000000 00:00 0
7fff2c2bc000-7fff2c2dd000 rw-p 00000000 00:00 0                          [stack]
7fff2c3ff000-7fff2c400000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

Has anyone come across this problem before? Are there any prerequisites that I could be missing? I'm trying to build on Ubuntu 10.10 running in a VM. Thanks
« Last Edit: February 10, 2011, 11:43:14 pm by InfernoZeus »
Logged

Ari Rahikkala

  • Bay Watcher
    • View Profile
Re: Building from source in Ubuntu
« Reply #1 on: February 09, 2011, 08:34:24 pm »

It's hard to tell what might be wrong from this data. Please try compiling with debugging symbols on:

Code: [Select]
make clean
env CFLAGS="-O0 -g" ./configure
make
Logged

InfernoZeus

  • Bay Watcher
    • View Profile
Re: Building from source in Ubuntu
« Reply #2 on: February 09, 2011, 08:57:40 pm »

Thanks for the suggestion, however that doesn't change anything. It still compiles without errors (although there are warnings), but the same errors come up. I have been able to get it working inconsistently, but then it just complains about sitemaps.txt missing form ./workspaces/ - I managed to fix that by copying the file from ./art/ but is that to be expected?

Edit: Alright, I've been poking around, trying to get it working, and it seems that it only throws up this issue if I'm still in the same shell that I compiled it in. If I restart the terminal, it works fine. Seems very strange.
« Last Edit: February 09, 2011, 09:04:12 pm by InfernoZeus »
Logged

Ari Rahikkala

  • Bay Watcher
    • View Profile
Re: Building from source in Ubuntu
« Reply #3 on: February 09, 2011, 09:30:01 pm »

The errors shouldn't be quite the same, the frames from crimesquad in the backtrace should be annotated with information about which function they're from. That would help track down the possible cause.
Logged

InfernoZeus

  • Bay Watcher
    • View Profile
Re: Building from source in Ubuntu
« Reply #4 on: February 09, 2011, 09:45:45 pm »

Alright, here it is:

Code: [Select]
*** buffer overflow detected ***: src/crimesquad terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7ff0155e3537]
/lib/libc.so.6(+0xfe3f0)[0x7ff0155e23f0]
/lib/libc.so.6(__fread_chk+0x15b)[0x7ff0155e2bcb]
src/crimesquad[0x42f30b]
src/crimesquad[0x405ab3]
/lib/libc.so.6(__libc_start_main+0xfe)[0x7ff015502d8e]
src/crimesquad[0x4039a9]
======= Memory map: ========
00400000-00573000 r-xp 00000000 08:01 169443                             /home/ben/lcsgame/trunk/src/crimesquad
00772000-00773000 r--p 00172000 08:01 169443                             /home/ben/lcsgame/trunk/src/crimesquad
00773000-00775000 rw-p 00173000 08:01 169443                             /home/ben/lcsgame/trunk/src/crimesquad
00775000-00f6c000 rw-p 00000000 00:00 0
02ef2000-02f2d000 rw-p 00000000 00:00 0                                  [heap]
7ff0152e0000-7ff0152e2000 r-xp 00000000 08:01 152244                     /lib/libdl-2.12.1.so
7ff0152e2000-7ff0154e2000 ---p 00002000 08:01 152244                     /lib/libdl-2.12.1.so
7ff0154e2000-7ff0154e3000 r--p 00002000 08:01 152244                     /lib/libdl-2.12.1.so
7ff0154e3000-7ff0154e4000 rw-p 00003000 08:01 152244                     /lib/libdl-2.12.1.so
7ff0154e4000-7ff01565e000 r-xp 00000000 08:01 152237                     /lib/libc-2.12.1.so
7ff01565e000-7ff01585d000 ---p 0017a000 08:01 152237                     /lib/libc-2.12.1.so
7ff01585d000-7ff015861000 r--p 00179000 08:01 152237                     /lib/libc-2.12.1.so
7ff015861000-7ff015862000 rw-p 0017d000 08:01 152237                     /lib/libc-2.12.1.so
7ff015862000-7ff015867000 rw-p 00000000 00:00 0
7ff015867000-7ff01587c000 r-xp 00000000 08:01 129877                     /lib/libgcc_s.so.1
7ff01587c000-7ff015a7b000 ---p 00015000 08:01 129877                     /lib/libgcc_s.so.1
7ff015a7b000-7ff015a7c000 r--p 00014000 08:01 129877                     /lib/libgcc_s.so.1
7ff015a7c000-7ff015a7d000 rw-p 00015000 08:01 129877                     /lib/libgcc_s.so.1
7ff015a7d000-7ff015aff000 r-xp 00000000 08:01 152245                     /lib/libm-2.12.1.so
7ff015aff000-7ff015cfe000 ---p 00082000 08:01 152245                     /lib/libm-2.12.1.so
7ff015cfe000-7ff015cff000 r--p 00081000 08:01 152245                     /lib/libm-2.12.1.so
7ff015cff000-7ff015d00000 rw-p 00082000 08:01 152245                     /lib/libm-2.12.1.so
7ff015d00000-7ff015de8000 r-xp 00000000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7ff015de8000-7ff015fe7000 ---p 000e8000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7ff015fe7000-7ff015fef000 r--p 000e7000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7ff015fef000-7ff015ff1000 rw-p 000ef000 08:01 395994                     /usr/lib/libstdc++.so.6.0.14
7ff015ff1000-7ff016006000 rw-p 00000000 00:00 0
7ff016006000-7ff016046000 r-xp 00000000 08:01 129896                     /lib/libncurses.so.5.7
7ff016046000-7ff016245000 ---p 00040000 08:01 129896                     /lib/libncurses.so.5.7
7ff016245000-7ff016249000 r--p 0003f000 08:01 129896                     /lib/libncurses.so.5.7
7ff016249000-7ff01624a000 rw-p 00043000 08:01 129896                     /lib/libncurses.so.5.7
7ff01624a000-7ff01626a000 r-xp 00000000 08:01 145652                     /lib/ld-2.12.1.so
7ff016449000-7ff01644f000 rw-p 00000000 00:00 0
7ff016467000-7ff01646a000 rw-p 00000000 00:00 0
7ff01646a000-7ff01646b000 r--p 00020000 08:01 145652                     /lib/ld-2.12.1.so
7ff01646b000-7ff01646c000 rw-p 00021000 08:01 145652                     /lib/ld-2.12.1.so
7ff01646c000-7ff01646d000 rw-p 00000000 00:00 0
7fff331ad000-7fff331ce000 rw-p 00000000 00:00 0                          [stack]
7fff331ff000-7fff33200000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted

I've also included the results from env CFLAGS="-O0 -g" ./configure
Code: [Select]
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking ncursesw/ncurses.h usability... no
checking ncursesw/ncurses.h presence... no
checking for ncursesw/ncurses.h... no
checking for addch in -lncurses... yes
checking for add_wch in -lncurses... no
checking for library containing initscr... -lncurses
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking return type of signal handlers... void
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for memset... yes
checking for mkdir... yes
checking for strchr... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
Logged

InfernoZeus

  • Bay Watcher
    • View Profile
Re: Building from source in Ubuntu
« Reply #5 on: February 10, 2011, 09:05:23 pm »

I think it might have been something to do with a corrupted save file. I've just been debugging it in Eclipse, and it was crashing during the loading phase at the start.

I don't suppose anyone knows how to get Eclipse to work properly with ncurses? At the moment, it just displays all of the escape characters. I'm pretty sure that Eclipse's 'console' isn't a proper console..

Edit: It seems the issue occurs any time that it loads the save.dat file. Here's the stack trace from gdb after it crashes..
Code: [Select]
#0  0x00007ffff70a9ba5 in raise () from /lib/libc.so.6
#1  0x00007ffff70ad6b0 in abort () from /lib/libc.so.6
#2  0x00007ffff70e343b in ?? () from /lib/libc.so.6
#3  0x00007ffff7175537 in __fortify_fail () from /lib/libc.so.6
#4  0x00007ffff71743f0 in __chk_fail () from /lib/libc.so.6
#5  0x00007ffff7174bcb in __fread_chk () from /lib/libc.so.6
#6  0x000000000042f35b in fread () at /usr/include/bits/stdio2.h:285
#7  load () at title/saveload.cpp:475
#8  0x0000000000405b03 in main (argc=<value optimized out>, argv=<value optimized out>) at game.cpp:426

Edit 2: I've confirmed this by temporarily removing commenting out the loading and it runs fine every time.

Edit 3: Problem found, LCS doesn't play well with 64-bit versions of Ubuntu.
« Last Edit: February 10, 2011, 11:43:56 pm by InfernoZeus »
Logged