google-code-export / ghostplusplus

Automatically exported from code.google.com/p/ghostplusplus
Other
3 stars 0 forks source link

linux compiling issues #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to compile on linux (using ubuntu 9.04)

What version of the product are you using? On what operating system?
13.0, Ubuntu 9.04

Please provide any additional information below.

First of all, warden would not compile without adding:
#include <string.h>
to the warden.cpp file. It gets memcpy and memset errors.

There are also more libraries not mentioned in the wiki compiling
instructions it can't find to install bncsutil and StormLib. I had to
install libboost-dev and libmysqlclient-dev. I'm not sure if it's meant to
use the ones included in the zip and the Makefile has problems or if the
extra packages were just missed in the wiki. I'm not very good with makefiles.

It would be nice if the linux executable was included in the zip. I'm not
sure how many users want to deal with installing a bunch of extra packages
and then linking the .so files from bncsutil and stormlib to execute the
program.

Original issue reported on code.google.com by UndeadWa...@gmail.com on 16 May 2009 at 11:35

GoogleCodeExporter commented 9 years ago
If you don't have the proper dependencies than there is no reason for the 
program to
compile.

Libboost-dev and libmysqlclient-dev are library files (hence the "lib...") that 
are
used by a number of different programs.  Feel free to visit google to read up 
on more
on what these do (to be honest I have no idea what the boost one does).

Since Ghost++ uses these library files in its process, there are 3 ways around 
having
to install the extra programs:
1.  Install Ghost++ from a package manager like apt-get which will 
automatically see
you are missing the dependencies and install them for you.  To add a package to
apt-get or other package managers is a bit of work, and as far as I'm aware 
isn't
currently included in any package managers.
2.  Rewrite the parts of these lib files that are needed into the program.  
This will
be lots of work for the programmers, make the programs larger, and is ultimately
pointless.
3.  Include these library files in their entirety into the Ghost++ compile 
process. 
Again, this will make the program larger and is ultimately pointless and may 
violate
terms of use.

This is a very typical compilation/install process, you just may not see it 
since
most of the programs you probably use in Ubuntu have this entire process done 
for you.

Resolution: Get Ghost++ added to the Ubuntu repository or some other apt-get
repository so you can install this from apt-get.  This doesn't really relate to
Ghost++ itself and is a pretty independent effort (though it needs to be 
maintained
by someone who updates the repository with new dependency/version information as
Ghost++ updates).

Your #include <string.h> issue is a valid concern.  I'm just glad that someone 
put
together that nice guide in the forums that helped me through all these issues,
though this would be something that will hopefully be easy to fix in later 
versions.

Finally: The reason why it cannot contain the linux executable is because 
important
stuff happen in the compilation process.  For example, that executable still 
needs
those library files, so you'd still have to have libboost-dev and 
libmysqlclient-dev,
and those files are located during the process.  An executable file for Ubuntu
wouldn't work for Gentoo or other version of linux.  The only way to avoid 
having 20
different versions of Ghost++ for a ton of different versions of linux is to 
just
have everyone compile it themselves.

Even if you go try to get a more mature program like Firefox, if you download 
the
linux version you will just get the source code and are expected to install the
dependencies and then compile it from scratch very similar to how you had to do
Ghost++.  Most versions of linux are set up to install most main stream 
programs for you.

Original comment by Anything...@gmail.com on 19 May 2009 at 6:08

GoogleCodeExporter commented 9 years ago
Sorry, my previous comment was written late last night.  I apologize if I came 
off as
overly negative.  I think I may be incorrect that the executable requires the 
library
files... it might just be the installation like you implied, but I am not sure.

Anyway, another idea to make it more user friendly is to create a little script 
to
help linux users out.  Here is my first crack at a script (a few holes here... 
not
sure how to detect for the various dependencies)

#!/bin/bash
#This script will compile Ghost++ for you when run

#Make sure user is root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

#Check for build-essentials, zlib, and libbz2
echo -n "Checking for build-essentials..."
if [[ ??? ]]; then
   echo "Found."
else
   echo "Missing. Please install build-essentials."
   exit 1
fi

echo -n "Checking for zlib..."
if [[ ??? ]]; then
   echo "Found."
else
   echo "Missing. Please install zlib."
   exit 1
fi

echo -n "Checking for libbz2..."
if [[ ??? ]]; then
   echo "Found."
else
   echo "Missing. Please install libbz2."
   exit 1
fi

#Check for libboost-dev
echo -n "Checking for libboost-dev..."
if [[ ??? ]]; then
   echo "Found."
else
   echo "Missing. Please install libboost-dev."
   exit 1
fi
#Check for libmysqlclient-dev
echo -n "Checking for libmysqlclient-dev..."
if [[ ??? ]]; then
   echo "Found."
else
   echo "Missing. Please install libmysqlclient-dev."
   exit 1
fi

#Compile bncsutil and stormlib
CurrDir = $PWD

echo -n "Installing bncsutil..."
cd "$CurrDir/bncutil/"
make
if [[ $? ]]; then
  echo "Install Failed. Aborting."
  exit 1
fi
make install
if [[ $? ]]; then
  echo "Install Failed. Aborting."
  exit 1
else
  echo "Success."
fi

echo -n "Installing StormLib..."
cd "$CurrDir/StormLib/"
make
if [[ $? ]]; then
  echo "Install Failed. Aborting."
  exit 1
fi
make install
if [[ $? ]]; then
  echo "Install Failed. Aborting."
  exit 1
else
  echo "Success."
fi

echo -n "Compiling Ghost++..."
cd "$CurrDir/ghost/"
make
if [[ $? ]]; then
  echo "Compile Failed. Aborting."
  exit 1
else
  echo "Success."
  cp "$CurrDir/ghost/ghost++" "$CurrDir/ghost++"
  echo "Ghost++ is now successfully installed.  Please configure your ghost.cfg then
type \"ghost++\" to execute."
fi

Original comment by Anything...@gmail.com on 19 May 2009 at 9:05

GoogleCodeExporter commented 9 years ago
The reason I mentioned libboost and libmysql is because there is code for them
contained in the ghost++ zip but the makefile is not finding it. Unless those 
files
were only put there for Windows users it is a makefile problem. This would also
explain why I had to figure out the dependencies rather than following the 
wiki. My
point in the post is that either the wiki is in error or the makefile is.

Boost at least is only necessary to install bncsutil and/or stormlib, I can't
remember which. Both of those I compiled into .so files and then made a script 
to
link them with ghost++ and run. Originally I was thinking they could just be 
compiled
into .so files and shipped with an executable and a script but after looking 
into it
some I guess there are too many potential compatibility issues so I agree that 
is a
bad idea (though a compile script that compiles bncsutil, stormlib, ghost++, 
then
moves the .so files into a lib directory and makes a run script would be handy).

>>The reason why it cannot contain the linux executable is because important
stuff happen in the compilation process.  For example, that executable still 
needs
those library files, so you'd still have to have libboost-dev and 
libmysqlclient-dev,
and those files are located during the process.

This is false. The dev libraries are only needed for compiling. Hence the 
reason they
are separate in package managers and not generally installed by default.

Original comment by UndeadWa...@gmail.com on 22 May 2009 at 4:35

GoogleCodeExporter commented 9 years ago
1.) The boost directory included in GHost++ contains precompiled boost 
libraries for
Windows users only (more specifically, for Visual C++ users only). It is not 
used on
Linux and in either case it doesn't contain any headers so it's not a complete
package for anyone, it just makes it easier for Windows users to compile 
GHost++.

2.) Boost is only necessary to compile GHost++, not bncsutil or StormLib. It's
actually only used for threading at the moment, which means it's only necessary 
if
you want to compile GHost++ with MySQL support. This may change in the future as
there are quite a few additional features of Boost that I may choose to make 
use of
eventually.

3.) The dev libraries include things like headers which are needed for 
compiling, the
library files are still required in both cases. The non "-dev" versions of the
repository packages generally just install the shared objects and not much else 
as
far as I'm aware.

4.) I won't be including any "Linux binaries" because, as previously mentioned,
there's no such thing as a generic Linux binary since they are not portable 
between
distributions and sometimes even between fairly similar systems. I admit it 
would be
nice to provide a more traditional "configure, make, make install" process but 
I do
not know how to write a configure script and I don't plan to learn how. This is
because the last time I researched it a few years ago (e.g. I know that you use
autoconf and other tools to help you) I was unable to find any instructions 
that made
sense to me and I became too confused and gave up on it.

5.) The string.h thing in warden.cpp is a moot point now as that file has been
removed from the repository. This issue crops up occasionally because my 
compiler
doesn't complain about string.h so I often overlook it when I make use of
memset/memcpy/etc in a new file.

Original comment by hogantp on 24 May 2009 at 4:54

GoogleCodeExporter commented 9 years ago

Original comment by hogantp on 17 Jul 2009 at 6:15