Configure fails under FreeBSD 8.2 amd64

Known issue. ffmpeg changed their API once again.

Compilation should work with both gcc-4.6 and 4.7, configure script will set all required flags.

These errors are weird. Are you sure that you’re using c++ compiler? (gcc is for c, g++ is for c++)
Check this in config.log file just in case - run search for “CXX=” line

Another option is to force linking to libstdc++ but this is rather a workaround, not a real fix:

LIBS="-lstdc++" ./configure

If nothing helps - upload your config.log (as attachment in post or on something like pastebin.com )

I configure and build VCMI with this options:

env CC="/usr/local/bin/ccache /usr/local/bin/g++46" CXX="/usr/local/bin/ccache /usr/local/bin/g++46" with_boost=yes enable_sdltest=yes LDFLAGS="-L/lib -L/usr/lib -L/usr/local/lib" CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/local/include/SDL -I/usr/local/include/boost -I/usr/local/lib/gcc46/include" CCFLAGS="-g -O3 -funroll-loops" CXXFLAGS="-g -O3 -funroll-loops" ./configure --prefix=/usr/local

If use:

env CC="/usr/local/bin/ccache /usr/local/bin/gcc46"

cofigure script stopped with error, because not find includes of boost and SDL

P.S.: I clean cache of ccache and “gmake clean” before and after each run “gmake all”
config_log_last.txt (86 KB)

I run autoreconf, and configure with CC=gcc46 option successful:

env CC="/usr/local/bin/ccache /usr/local/bin/gcc46" CXX="/usr/local/bin/ccache /usr/local/bin/g++46" with_boost=yes enable_sdltest=yes LDFLAGS="-L/lib -L/usr/lib -L/usr/local/lib" CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/local/include/SDL -I/usr/local/include/boost" CCFLAGS="-g -O3 -funroll-loops" CXXFLAGS="-g -O3 -funroll-loops" ./configure --prefix=/usr/local

But gmake provide the same errors after compile vcmiclient:

  ...   /usr/local/lib/gcc46/include/c++/bits/stl_pair.h:132: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)'
vcmiclient-mapHandler.o: In function `pair<std::basic_string<char>, CDefEssential*>':
/usr/local/lib/gcc46/include/c++/bits/stl_pair.h:137: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)'
/usr/local/lib/gcc46/include/c++/bits/stl_pair.h:137: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)'
collect2: ld returned 1 exit status
gmake[2]: *** [vcmiclient] Error 1
gmake[1]: *** [all] Error 2
gmake: *** [all-recursive] Error 1

I attached full stderr output. Who have any ideas how to fix that?
gmake_stderr_log.txt (52.3 KB)

I think I got it . You’re using gcc-4.6 but your libstdc++ is from older gcc version (e.g. 4.2).
This looks to be bsd-specific problem: http://forums.freebsd.org/showthread.php?t=28054

Quoting from that thread:

(In your case it will be gcc46/)

(I assume that your /path_to_lib_dir will be /usr/local/lib/gcc46/)

Edit:
One more probably essential part I missed - add “-L/usr/local/lib/gcc46” to your LD_FLAGS

I have modify my /etc/libmap.conf for use gcc46/, in this case:

libstdc++.so.6 gcc46/libstdc++.so.6

configure with this optins:

env LD_FLAGS="-L/usr/local/lib/gcc46" CC="/usr/local/bin/ccache /usr/local/bin/g++46" CXX="/usr/local/bin/ccache /usr/local/bin/g++46" with_boost=yes enable_sdltest=yes LDFLAGS="-L/lib -L/usr/lib -L/usr/local/lib -L/usr/local/lib/gcc46" CPPFLAGS="-I/usr/include -I/usr/local/include -I/usr/local/include/SDL -I/usr/local/include/boost -I/usr/local/lib/gcc46" CFLAGS="-g -O3 -funroll-loops" CXXFLAGS="-g -O3 -funroll-loops -std=c++0x" ./configure --prefix=/usr/local

configure process still ok, but after run “gmake all” I have the same errors…
Error log attached
gmake_stderr_log.txt (53.7 KB)

IIRC “-L/usr/local/lib/gcc46” should be at the beginning of LD_FLAGS (first directory for search):

LDFLAGS="-L/usr/local/lib/gcc46 -L/lib -L/usr/lib -L/usr/local/lib"

Successful! It’s work! We have builds of all native libs and binaries of VCMI on FreeBSD! Configure options:

env CC="/usr/local/bin/ccache /usr/local/bin/g++46" CXX="/usr/local/bin/ccache /usr/local/bin/g++46" with_boost=yes enable_sdltest=yes LDFLAGS="-L/usr/local/lib/gcc46 -L/usr/local/lib -L/usr/lib -L/lib" LD_FLAGS=$LDFLAGS CPPFLAGS="-I/usr/local/lib/gcc46/include/c++/x86_64-portbld-freebsd8.1/bits -I/usr/local/lib/gcc46/include/c++ -I/usr/local/lib/gcc46/include -I/usr/local/include/boost -I/usr/local/include/SDL -I/usr/local/include -I/usr/include" CFLAGS="-g -O3 -funroll-loops" CXXFLAGS="-g -O3 -funroll-loops -std=c++0x" ./configure --prefix=/usr/local

With modified /etc/libmap.conf:

libstdc++.so.6 gcc46/libstdc++.so.6

But I need some help about configuration options and right way of installation.
After “gmake all” i run “gmake install” and install script copy all libs and bins to my prefix (/usr/local).
But I can’t find directory /usr/local/share/vcmi.
Anyway I make it by hands.
After run “vcmiclient” I receive this message:

$ vcmiclient            
Starting... 
Creating console and logfile: 1
At 	 Error: Properties entry is missing for struct in schema
At 	 Error: Schema not found!
Loading settings: 4
VCMI 0.88b (client)
Error: SDL says that 0x0 resolution is not available!
	Initializing screen: 146
Abort trap (core dumped)

After this i run "vcmclient --help:

$ vcmiclient --help
Starting... 
VCMI 0.88b - A Heroes of Might and Magic 3 clone
Copyright (C) 2007-2012 VCMI dev team - see AUTHORS file
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Usage:
Allowed options:
  -h  --help ]         display help and exit
  -v  --version ]      display version information and exit
  -b  --battle ] arg   runs game in duel mode (battle-only
  --start arg           starts game from saved StartInfo file
  --onlyAI              runs without GUI, all players will be default AI
  --oneGoodAI           puts one default AI and the rest will be EmptyAI
  --autoSkip            automatically skip turns in GUI
  -i  --nointro ]      skips intro movies

And run “vcmiclient --version”:

$ vcmiclient --version
Starting... 
VCMI 0.88b
  data directory:    /usr/local/share/vcmi
  library directory: /usr/local/lib/vcmi
  binary directory:  /usr/local/bin

After reading README.linux I’ve mount directory of installed WOG (Windows wersion) to /usr/local/share/vcmi,
copy “Sprites”, “Data” and “config” directories
from “/PATH_TO_SOURCE/” (/home/admin/VCMI/SVN/trunk) to “/DATA_PATH/vcmi”
(/usr/local/share/vcmi in my case) and run vcmiclient,
but program crashed and I receive very strange message:

$vcmiclient
Starting... 
Creating console and logfile: 1
Loading settings: 16
VCMI 0.88b (client)
Warning: SDL says that 24bpp is wrong and suggests 32
New screen flags: 0
	Initializing screen: 187

My Xorg server support 16 and 24 bit of video output, how it’s possible?
What I need configure/fix after installation for correct work of vcmiclient on FreeBSD?
I try make FreeBSD port, and I really need to know how do that correctly.

You have to populate data directory manually with H3+WoG+VCMI data.
Check this: wiki.vcmi.eu/index.php?title=Ins … aring_data

This is how it should look like:

$ pwd
/usr/local/share/vcmi
$ ls
config # copied from source (trunk/config). It also present in data package but configs were changed a bit since 0.88 release
Data    # original H3 folder
Maps    # original H3 folder
Mp3     # original H3 folder
Sprites # from VCMI data package

VCMI works with 16/24/32 bit screen. “SDL thinks that 32 bit will be more faster” is probably best description. This can be changed from config

Ok, I’ve tried edit defaultSettings.json, and replace 24 with 32:
before:

"bitsPerPixel" : {
                                "type" : "number",
                                "default" : 24

and after:

"bitsPerPixel" : {
                                "type" : "number",
                                "default" : 32

In “video” section. And run vcmclient again:

$ vcmiclient
Starting... 
Creating console and logfile: 1
Loading settings: 16
VCMI 0.88b (client)
New screen flags: 0
	Initializing screen: 155
Abort trap (core dumped)

I think it’s because FreeBSD Xorg server not native supported 32bpp.
If I’ve edit defaultSettings.json and paste 16 or 24 bpp vcmiclient crashed with SDL warnings:

Creating console and logfile: 1
Loading settings: 16
VCMI 0.88b (client)
Warning: SDL says that 16bpp is wrong and suggests 32
New screen flags: 0
	Initializing screen: 154
Abort trap (core dumped)

Creating console and logfile: 1
Loading settings: 15
VCMI 0.88b (client)
Warning: SDL says that 24bpp is wrong and suggests 32
New screen flags: 0
	Initializing screen: 155
Abort trap (core dumped)

After googling I find something like of this situation, but on the MaxOS:
haikuware.com/directory/view-det … -magic-iii
I think it’s OS/Xorg/SDL depended VCMI error,
and may be I need some patches for code
or configure script need some additions
and tests for really right way to compile VCMI on FreeBSD.

I don’t think that this is related to SDL - you get “Initializing screen” line only after screen init.
Can you create stacktrace from gdb?

$ gdb vcmiclient
(gdb) set logging on
(gdb) run
< wait for crash >
(gdb) bt full
< press enter until all stack will be printed >
(gdb) quit

This should give you file gdb.txt with full log including stacktrace - post it here.

I run it:

$gdb vcmiclient
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) set logging on
Copying output to gdb.txt.
(gdb) run
Starting program: /usr/local/bin/vcmiclient 
[New LWP 100179]
[New Thread 8090041c0 (LWP 100179)]
Starting... 
[New Thread 80900ae40 (LWP 100220)]
Loading settings: 7
VCMI 0.88b (client)
[New Thread 80900ac80 (LWP 100223)]
[New Thread 80900a900 (LWP 100253)]
[Thread 80900a900 (LWP 100253) exited]
Error: SDL says that 0x0 resolution is not available!
	Initializing screen: 147

Program received signal SIGABRT, Aborted.
[Switching to Thread 8090041c0 (LWP 100179)]
0x000000080608f03c in thr_kill () from /lib/libc.so.7
(gdb) bt full
#0  0x000000080608f03c in thr_kill () from /lib/libc.so.7
No symbol table info available.
Die: DW_TAG_unspecified_type (abbrev = 89, offset = 11484014)
	has children: FALSE
	attributes:
		DW_AT_name (DW_FORM_strp) string: "decltype(nullptr)"
Dwarf Error: Cannot find type of die [in module /usr/local/bin/vcmiclient]
(gdb) quit
The program is running.  Exit anyway? (y or n) y

In file defaultSettings.json I find this:

           "screenRes" : {
                                "type" : "object",
                                "properties" : {
                                        "width"  : { "type" : "number" },
                                        "height" : { "type" : "number" }
                                },
                                "default": {"width" : 0, "height": 0 }

And replace 0x0 with 800x600, like this:

"default": {"width" : 800, "height": 600 }

and run vcmiclient with gdb again:

gdb vcmiclient
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) set logging on
Copying output to gdb.txt.
(gdb) run
Starting program: /usr/local/bin/vcmiclient 
[New LWP 100253]
[New Thread 8090041c0 (LWP 100253)]
Starting... 
[New Thread 80900ae40 (LWP 100129)]
[New Thread 80900ac80 (LWP 100223)]
[New Thread 80900a900 (LWP 100235)]
[Thread 80900a900 (LWP 100235) exited]
Warning: SDL says that 24bpp is wrong and suggests 32
New screen flags: 0
	Initializing screen: 157
	Initializing video: 1
[New Thread 80900a740 (LWP 100235)]
	Initializing minors: 0
[New Thread 80b3e8ac0 (LWP 100250)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 80900a740 (LWP 100235)]
0x000000080608f03c in thr_kill () from /lib/libc.so.7
(gdb) bt full
#0  0x000000080608f03c in thr_kill () from /lib/libc.so.7
No symbol table info available.
Die: DW_TAG_unspecified_type (abbrev = 89, offset = 11484014)
	has children: FALSE
	attributes:
		DW_AT_name (DW_FORM_strp) string: "decltype(nullptr)"
Dwarf Error: Cannot find type of die [in module /usr/local/bin/vcmiclient]
(gdb) quit
The program is running.  Exit anyway? (y or n) y

And I see the black screen of SDL window of VCMI.
I run program in sh and vcmclient crashed with this error:

vcmiclient
Starting... 
Creating console and logfile: 1
Loading settings: 16
VCMI 0.88b (client)
Warning: SDL says that 24bpp is wrong and suggests 32
New screen flags: 0
	Initializing screen: 154
	Initializing video: 1
	Initializing minors: 0
Abort (core dumped)

gdb1.txt (1.61 KB)
gdb.txt (751 Bytes)

For reason: I’ve recompile VCMI without aggressive optimizations, and reinstall VCMI:

$env CC="/usr/local/bin/ccache /usr/local/bin/g++46" CXX="/usr/local/bin/ccac /usr/local/bin/g++46" with_boost=yes enable_sdltest=yes LDFLAGS="-L/usr/local/lib/gcc46 -L/usr/local/lib -L/usr/lib -L/lib" LD_FLAGS=$LDFLAGS CPPFLAGS="-I/usr/local/lib/gcc46/include/c++/x86_64-portbld-freebsd8.1/bits -I/usr/local/lib/gcc46/include/c++ -I/usr/local/lib/gcc46/include -I/usr/local/include/boost -I/usr/local/include/SDL -I/usr/local/include -I/usr/include" CFLAGS="-g -O2" CXXFLAGS="-g -O2 -std=c++0x" ./configure --prefix=/usr/local

But problem still the same.

Ah. It seems that programs crash a bit differently on FreeBSD :slight_smile:

You shouldn’t edit defaultSettings.json - screenRes should be set automatically, so 0x0 resolution problem is coming from somewhere else. You’d better revert this file to default. Try removing ~/.vcmi/config/settings.json instead.
BTW - default resolution set by game is “gameRes”, “screenRes” is remain from porting to 800x480.

To get usable stacktrace of crash use this:

$ gdb vcmiclient 
(gdb) set logging on 
(gdb) run 
< wait for crash > 
(gdb) thread apply all backtrace full
< press enter until all stack will be printed > 
(gdb) quit

I’ve revert changes in defaultSettings.json,
remove ~/.vcmi/config/settings.json
and run gdb. Attachment here.

Maybe I need to add -pthreads to CXXFLAGS before compile?
gdb2.txt (3.46 KB)

-pthread flag is already present. Othervice you won’t compile VCMI at all.

gdb log is still not useful:

Dwarf Error: Cannot find type of die [in module /usr/local/bin/vcmiclient]

From what I found you need to either update gdb to 7.0+ OR recompile vcmi with CXXFLAGS="-gdwarf-3" or even CXXFLAGS="-gdwarf-2"

I build and install gdb from sources:

$ gdb74 --version
GNU gdb (GDB) 7.4 [GDB v7.4 for FreeBSD]
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd8.1".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.

And run “gdb74 vcmiclient” for two different compilations of VCMI:

  1. with CXXFLAGS="-gdwarf-2 -g3 -O0"
  2. and CXXFLAGS="-gdwarf-3 -g3 -O0"
    Results attached
    gdb74_CXXFLAGS_-gdwarf-3_-g3_-O0.txt (8 KB)
    gdb74_CXXFLAGS_-gdwarf-2_-g3_-O0.txt (8.29 KB)

Yes! I don’t think that you need any of those -gsomething switches but it works anyway.

It looks that VCMI can’t play videos for some reason.
Crash itself comes from intro videos. You can skip them via “vcmiclient --nointro” it will crash in main menu anyway but loading should be successful (You’ll see “Initialization of VCMI (together): 12345” line)

It’s possible that VCMI can’t find these files for some reason.

  1. Check if you have /usr/local/share/vcmi/Data/VIDEO.VID file. It must have exactly same case.
    If file is not here - try checking H3 data or H3 CD. It has to be somewhere
  2. If file is here: make sure that it has intro video:
strings VIDEO.VID | grep -i 3DOLOGO

It should print 3DOLOGO.SMK line.

Edit: or it can be some bug in our video player. If nothing helps I’ll make switch to disable player.

Thanks for help, that the good news!
I think it’s problem depended with deprecated ffmpeg declarations for video player.
I’ve find this strings in VIDEO.VID:

$ strings VIDEO.VID | grep -i LOGO
3DOLOGO.SMK
BUKALOGO.SMK
LoGo

Maybe vcmiclient crashed because in VIDEO.VID two *LOGO.SMK files?

This may be some ffmpeg issue not necessary related to those deprecation warnings. Fixing it may be complicated since I can’t reproduce it on my system.

Renaming VIDEO.VID to something else - VCMI will complain about missing file but should work. Upload stacktrace of crash, if any.

Can you upload your VIDEO.VID somewhere and send me link via PM?

I think problem is not in my file VIDEO.VID,
in Windows VCMI started correctly with the same file.
I’ve renamed VIDEO.VID file in /usr/local/share/vcmi/Data directory,
but problem is still.
gdb log attached.
gdb_without_VIDEO.VID.txt (8.43 KB)