Compilation error in plugins

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
wiz
Private First Class
Private First Class
Posts: 46
Joined: Sat Dec 07, 2002 1:19 am
Location: Moline, IL, USA

Compilation error in plugins

Post by wiz » Sat Aug 20, 2005 3:26 pm

When compiling the chathistory, vocaliser and scorereset plugins, I get an error. Below is the output for the chathistory compilation (anon cvs from 20 August 2005 - Debian 3.1):

Code: Select all

g++ -fPIC -frtti -I../../include -O   -c -o chathistory.o chathistory.cpp
In file included from ../../include/TextUtils.h:20,
                 from chathistory.cpp:5:
../../include/common.h:24:21: config.h: No such file or directory
In file included from ../../include/TextUtils.h:20,
                 from chathistory.cpp:5:
../../include/common.h:203: error: redefinition of `template<class comparable>
   const comparable& std::max(const comparable&, const comparable&)'
/usr/include/c++/3.3/bits/stl_algobase.h:169: error: `template<class _Tp> const
   _Tp& std::max(const _Tp&, const _Tp&)' previously declared here
../../include/common.h:217: error: redefinition of `template<class comparable>
   const comparable& std::min(const comparable&, const comparable&)'
/usr/include/c++/3.3/bits/stl_algobase.h:149: error: `template<class _Tp> const
   _Tp& std::min(const _Tp&, const _Tp&)' previously declared here
chathistory.cpp: In member function `virtual bool LastChatCommand::handle(int,
   bzApiString, bzApiString, bzAPIStringList*)':
chathistory.cpp:113: warning: cannot pass objects of non-POD type `struct
   std::basic_string<char, std::char_traits<char>, std::allocator<char> >'
   through `...'; call will abort at runtime
/usr/include/c++/3.3/bits/basic_string.h: In member function `int
   std::basic_string<_CharT, _Traits, _Alloc>::compare(const
   std::basic_string<_CharT, _Traits, _Alloc>&) const [with _CharT = char,
   _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]':
/usr/include/c++/3.3/bits/basic_string.h:948:   instantiated from `bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]'
/usr/include/c++/3.3/bits/stl_function.h:197:   instantiated from `bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = std::string]'
/usr/include/c++/3.3/bits/stl_tree.h:1271:   instantiated from `std::_Rb_tree_iterator<_Val, _Val&, _Val*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) [with _Key = std::string, _Val = std::pair<const std::string, tvChatHistory>, _KeyOfValue = std::_Select1st<std::pair<const std::string, tvChatHistory> >, _Compare = std::less<std::string>, _Alloc = std::allocator<std::pair<const std::string, tvChatHistory> >]'
/usr/include/c++/3.3/bits/stl_map.h:468:   instantiated from `typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) [with _Key = std::string, _Tp = tvChatHistory, _Compare = std::less<std::string>, _Alloc = std::allocator<std::pair<const std::string, tvChatHistory> >]'
chathistory.cpp:95:   instantiated from here
/usr/include/c++/3.3/bits/basic_string.h:830: error: call of overloaded `min(
   size_t&, size_t&)' is ambiguous
/usr/include/c++/3.3/bits/stl_algobase.h:149: error: candidates are: const _Tp&
   std::min(const _Tp&, const _Tp&) [with _Tp = size_t]
../../include/common.h:217: error:                 const comparable&
   std::min(const comparable&, const comparable&) [with comparable = size_t]
make: *** [chathistory.o] Error 1
Any ideas?

User avatar
wiz
Private First Class
Private First Class
Posts: 46
Joined: Sat Dec 07, 2002 1:19 am
Location: Moline, IL, USA

Post by wiz » Sat Aug 20, 2005 3:31 pm

Ooooh - inspiration about 5 minutes too late. I see that common.h was modified 3 days ago, adding template functions for std::min and std::max. These functions are mentioned in the above error message...

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5182
Joined: Fri Dec 13, 2002 4:11 am
Location: https://github.com/OmniTanks
Contact:

Post by JeffM » Sat Aug 20, 2005 4:19 pm

some plugins need the sources to BZ. make sure you run the autogen and configure for the main BZ, and that it's all up to date

User avatar
wiz
Private First Class
Private First Class
Posts: 46
Joined: Sat Dec 07, 2002 1:19 am
Location: Moline, IL, USA

Post by wiz » Sat Aug 20, 2005 4:52 pm

I ran update on the whole source tree, ran autogen.sh and then ./configure --disable-client --enable-plugins and make prior to compiling the plugins.

User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once » Sat Aug 20, 2005 6:03 pm

THis might not be helpful, but I haven't had any problems compiling anything since I learned how to properly.

When I download anon CVS, I cd to the director of the source...

./autogen.sh
./configure --prefix=/home/death/bzflag
su
make && make install

THEN - I cd to each directory there is a plugin forn and I simply run "make" Like:

cd '/home/death/bzflag/plugins/RogueGenocide'

Running make creates the .so

Sometimes, it'll create an .o file... Now, since I --prefix into the same folders every day, I do end up manually deleting the old .so and .o files and running "make" on the new sources. Never had a problem.

Hope to be of help.

...and I do be posting core dumps everytime my CVS version of bzfs crashes. Anyone reading those? Is it crashing for the same reason every time or something different?
...This has been a recording.

trepan
Dev Wizard
Dev Wizard
Posts: 704
Joined: Fri Feb 21, 2003 7:50 pm

Post by trepan » Sat Aug 20, 2005 6:07 pm

This may help.

Stick this in plugins/ to make your compilation easier.
Don't forget to 'chmod 755' the file to make it executable.
You can uncomment the first part if you want to be able
to assign the destination directory.

Code: Select all

#!/bin/sh

#if [ $# -lt 1 ]; then
#  echo;
#  echo "Usage: " $0 " <dirname>";
#  echo;
#  exit 1;
#fi
#
#PDIR=$1

PDIR=~/.bzf/2.0

for i in *; do
  if [ -e $i/Makefile ]; then
    (cd $i; make; cp *.so $PDIR);
  fi
done
P.S. There should probably be a Makefile for the directory.

User avatar
wiz
Private First Class
Private First Class
Posts: 46
Joined: Sat Dec 07, 2002 1:19 am
Location: Moline, IL, USA

Post by wiz » Sat Aug 20, 2005 10:52 pm

Just to be clear that I'm doing this correctly, I did the following (starting in ~/cvs/bzflag/), all with no reported errors:

Code: Select all

cvs update -dP
sh autogen.sh
cd work
../configure --disable-client --enable-plugins
make
I didn't see any .so files for the plugins, so I went to ~/cvs/bzflag/plugins and ran the following:

Code: Select all

for i in RogueGenocide/ airspawn/ chathistory/ fixedspawn/ hiddenAdmin/ playHistoryTracker/ scorereset/ shockwaveDeath/ vocaliser/ ; do (cd $i; make); done
All plugins except for chathistory, scorereset and vocaliser compiled fine, but those three gave errors roughly the same as I put in my initial post.

Post Reply