Compiling [Linux] Ultimate compile guide for Debian (Ubuntu included)

Discussion in 'Basic' started by elf, Dec 28, 2007.

  1. elf

    elf Sing, sing blue silver

    Joined:
    Dec 11, 2007
    Messages:
    3,662
    Likes Received:
    104
    Best Answers:
    0
    I would like to note its my own guide, not copied from any other site, though, I gathered everything needed from many other tutorials- when compiling for the first time at my own server.
    I want also to doubt success on other debian-like distributions just because I didn't test them, but it shouldn't fail.
    It surely works, beause I can compile everything starting TFS 0.3 through otserv, so if it doesn't for You, then its probably only Your fault.
    Okay, here it goes.

    Pre. If you're using Ubuntu and you aren't logged on root user, do it by following command and type your password:
    Code (Text):
    1. sudo su
    1. On the begining, you need to update your packets database, then upgrade your operating system.
    Code (Text):
    1. apt-get update
    Code (Text):
    1. apt-get upgrade
    If update fails, you have to increase apt cache size. To do it, perform following actions:
    Code (Text):
    1. cd /etc/apt
    Code (Text):
    1. pico apt.conf
    and paste there:
    Code (Text):
    1. APT::Cache-Limit "125829120";
    Now press F2 to close Nano and answer YES/NO to save the file.

    2. Now you have to install some (maybe even alot of them :D) packets.
    Code (Text):
    1. apt-get install libboost1.41-dev libboost-system1.41-dev libboost-filesystem1.41-dev libboost-date-time1.41-dev libboost-regex1.41-dev libboost-thread1.41-dev libgmp3-dev liblua5.1-0 liblua5.1-0-dev liblua50 liblua50-dev liblualib50 liblualib50-dev lua50 lua5.1 libsqlite0-dev libsqlite3-dev sqlite3 libmysql++-dev libmysqlclient-dev mysql-client-5.1 mysql-server-5.1 mysql-common libxml2-dev libxml++2.6-dev cpp gcc g++ make automake autoconf pkg-config subversion liblua5.1-sql-mysql-dev liblua5.1-sql-sqlite3-dev zlib1g-dev zlib1g libcrypto++-dev libcrypto++8
    If your apt says some packages are missing, make sure you have set repositories in /etc/sources.list. After you fix things around (distribution-independent), perform again step 1.

    3. Ok, you have installed everything required to compile- easy, huh? Now you may do 'the job'.
    Here's an compilation example for TFS 0.3.5pl1:
    NOTE! If you are trying to compile TFS 0.2, please skip the step 6 (with autogen) and 7 (with configure) and finish with step 8 (just type make).

    If you receive a linker error saying something with 'libboost', try pasting the following commands to terminal and then move back to compiling again:
    Code (Text):
    1. cd ~
    Code (Text):
    1. wget http://garr.dl.sourceforge.net/sourceforge/asio/boost_asio_1_0_0.tar.gz
    Code (Text):
    1. tar -xzf boost_asio_1_0_0.tar.gz
    Code (Text):
    1. cp -ar boost_asio_1_0_0/boost/* /usr/include/boost/
    Code (Text):
    1. g++ boost_asio_1_0_0/libs/system/src/error_code.cpp -c -o /usr/lib/libboost_system.a
    Code (Text):
    1. ln /usr/lib/libboost_date_time-mt.so /usr/lib/libboost_date_time.so
    Code (Text):
    1. ln /usr/lib/libboost_date_time-mt.a /usr/lib/libboost_date_time.a
    Code (Text):
    1. ln /usr/lib/libboost_filesystem-mt.so /usr/lib/libboost_filesystem.so
    Code (Text):
    1. ln /usr/lib/libboost_filesystem-mt.a /usr/lib/libboost_filesystem.a
    Code (Text):
    1. ln /usr/lib/libboost_regex-mt.so /usr/lib/libboost_regex.so
    Code (Text):
    1. ln /usr/lib/libboost_regex-mt.a /usr/lib/libboost_regex.a
    Code (Text):
    1. ln /usr/lib/libboost_thread-mt.so /usr/lib/libboost_thread.so
    Code (Text):
    1. ln /usr/lib/libboost_thread-mt.a /usr/lib/libboost_thread.a
    Code (Text):
    1. ldconfig
    Code (Text):
    1. cd ~
    Code (Text):
    1. rm -rf boost_asio_1_0_0
    4. Congratulations! You've just compiled your engine. Yet you need to move files from 'source' directory...
    Code (Text):
    1. mv data doc mods schemas config.lua forgottenserver.s3db theforgottenserver theforgottenserver.s3db ..
    Now its up to run, you just have to configure it :)

    NOTE! If you're trying to run 0.2, please use the following:
    Code (Text):
    1. mv data doc config.lua forgottenserver.s3db forgottenserver.sql schema.sqlite forgottenserver ..
     
    Last edited: Mar 5, 2010
    gooden, Prest and Sheinen Highfive like this.
  2. Cato

    Cato 36.hopto.org

    Joined:
    May 28, 2007
    Messages:
    672
    Likes Received:
    4
    Best Answers:
    0
    Why remove the source files? And, you don't have to use sudo anywhere if you are root or turn into.
     
  3. elf

    elf Sing, sing blue silver

    Joined:
    Dec 11, 2007
    Messages:
    3,662
    Likes Received:
    104
    Best Answers:
    0
    Hmm... Updated :)
    And about sudo - as far as I know (I doubt it, since I've only heard it), Ubuntu doesn't have a root user...
     
    Last edited: Dec 28, 2007
  4. Basse

    Basse Expert Tutor

    Joined:
    Nov 28, 2007
    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    sorry, sudo aint required in Ubuntu ;)
     
  5. elf

    elf Sing, sing blue silver

    Joined:
    Dec 11, 2007
    Messages:
    3,662
    Likes Received:
    104
    Best Answers:
    0
    Short... Thanks :)
     
  6. Basse

    Basse Expert Tutor

    Joined:
    Nov 28, 2007
    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Ubuntu indeed have a root user :)
     
  7. kornholi

    kornholi Administrator Staff Member Administrator

    Joined:
    May 28, 2007
    Messages:
    1,017
    Likes Received:
    59
    Best Answers:
    0
    every *nix distro has a superuser.
     
  8. ins13

    ins13 New Member

    Joined:
    Jul 12, 2007
    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    You cant use the gui manager to log in as root however if you are running Ubuntu Desktop Edition. And by default root isn't configured you have to go in and set a password for root.
     
  9. Kiper

    Kiper Banned User

    Joined:
    May 28, 2007
    Messages:
    239
    Likes Received:
    0
    Best Answers:
    0
    Thats why you can do 'sudo -i'.
     
  10. korex

    korex New Member

    Joined:
    Feb 21, 2008
    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Welcome
    i can't compile TFS on Ubuntu 7.04
    i do all how it is on this tutorial

    My error:

    [email protected]:~/forgottenserver/forgottenserver/tags/0.2# make
    rm -rf *.o
    g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c account.cpp
    g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c actions.cpp
    g++ -I. -I/usr/include/libxml2 -I/usr/include/lua5.1 -D__NO_HOMEDIR_CONF__ -D__USE_MYSQL__ -D__USE_SQLITE__ -Werror -O1 -c admin.cpp
    In file included from /usr/local/include/boost/asio/impl/io_service.ipp:25,
    from /usr/local/include/boost/asio/io_service.hpp:517,
    from /usr/local/include/boost/asio/basic_io_object.hpp:20,
    from /usr/local/include/boost/asio/basic_socket.hpp:20,
    from /usr/local/include/boost/asio/basic_datagram_socket.hpp:25,
    from /usr/local/include/boost/asio.hpp:18,
    from connection.h:25,
    from admin.cpp:24:
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:29:59: error: boost/date_time/posix_time/posix_time_types.hpp: No such file or directory
    /usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: âtime_durationâ declared as a âvirtualâ field
    /usr/local/include/boost/asio/detail/timer_queue_base.hpp:43: error: expected â;â before âwait_durationâ
    /usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: âtime_durationâ declared as a âvirtualâ field
    /usr/local/include/boost/asio/detail/timer_queue.hpp:103: error: expected â;â before âwait_durationâ
    /usr/local/include/boost/asio/detail/timer_queue.hpp:110: error: expected `;' before âvirtualâ
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp: In member function âint boost::asio::detail::epoll_reactor<Own_Thread>::get_timeout()â:
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:547: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:547: error: expected `;' before âminimum_wait_durationâ
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:552: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:552: error: expected `;' before âwait_durationâ
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:554: error: âwait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:554: error: âminimum_wait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:558: error: âminimum_wait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/epoll_reactor.hpp:558: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/select_reactor.hpp: In member function âtimeval* boost::asio::detail::select_reactor<Own_Thread>::get_timeout(timeval&)â:
    /usr/local/include/boost/asio/detail/select_reactor.hpp:374: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/select_reactor.hpp:374: error: expected `;' before âminimum_wait_durationâ
    /usr/local/include/boost/asio/detail/select_reactor.hpp:379: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/select_reactor.hpp:379: error: expected `;' before âwait_durationâ
    /usr/local/include/boost/asio/detail/select_reactor.hpp:381: error: âwait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/select_reactor.hpp:381: error: âminimum_wait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/select_reactor.hpp:385: error: âminimum_wait_durationâ was not declared in this scope
    /usr/local/include/boost/asio/detail/select_reactor.hpp:385: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/time_traits.hpp: At global scope:
    /usr/local/include/boost/asio/time_traits.hpp:35: error: âposix_timeâ is not a member of âboostâ
    /usr/local/include/boost/asio/time_traits.hpp:35: error: âposix_timeâ is not a member of âboostâ
    /usr/local/include/boost/asio/time_traits.hpp:35: error: template argument 1 is invalid
    /usr/local/include/boost/asio/detail/deadline_timer_service.hpp: In member function âvoid boost::asio::detail::deadline_timer_service<Time_Traits, Timer_Scheduler>::wait(boost::asio::detail::deadline_timer_service<Time_Traits, Timer_Scheduler>::implementation_type&, boost::system::error_code&)â:
    /usr/local/include/boost/asio/detail/deadline_timer_service.hpp:144: error: âboost::posix_timeâ has not been declared
    /usr/local/include/boost/asio/detail/deadline_timer_service.hpp:144: error: expected `;' before âtimeoutâ
    /usr/local/include/boost/asio/detail/deadline_timer_service.hpp:147: error: âtimeoutâ was not declared in this scope
    /usr/local/include/boost/asio/deadline_timer.hpp: At global scope:
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: âposix_timeâ is not a member of âboostâ
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: âposix_timeâ is not a member of âboostâ
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 1 is invalid
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 2 is invalid
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: template argument 3 is invalid
    /usr/local/include/boost/asio/deadline_timer.hpp:32: error: invalid type in declaration before â;â token
    make: *** [admin.o] Error 1


    Sory for my english
     
  11. OhSnapple

    OhSnapple :]

    Joined:
    Aug 27, 2007
    Messages:
    116
    Likes Received:
    0
    Best Answers:
    0
    /usr/bin/ld: cannot find -llua5.1-sql-sqlite
    ye? ^^ tried to fix those one by one etc, but tbh, i have no clue what I'm doing. :D
     
  12. ntmr

    ntmr hi!

    Joined:
    Jul 7, 2007
    Messages:
    1,835
    Likes Received:
    13
    Best Answers:
    0
    On the first apt-get commands I got these errors:

    Code (Text):
    1. E: Imposs?*vel achar pacote libboost-date-time1.34.1
    2. E: Imposs?*vel achar pacote libboost-regex1.34.1
    3. E: Imposs?*vel achar pacote libboost-signals1.34.1
    4. E: Imposs?*vel achar pacote libboost-thread1.34.1
    5.  
    Translation:

    Code (Text):
    1. E: Unable to find package libboost-date-time1.34.1
    2. E: Unable to find package libboost-regex1.34.1
    3. E: Unable to find package libboost-signals1.34.1
    4. E: Unable to find package libboost-thread1.34.1
    5.  
     
  13. Fazlija

    Fazlija New Member

    Joined:
    Apr 24, 2008
    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
     
  14. Mr Evil

    Mr Evil New Member

    Joined:
    Mar 31, 2008
    Messages:
    279
    Likes Received:
    0
    Best Answers:
    0
    Elf you should upload ur dev-cpp it would make things easier..:p
     
  15. Mark

    Mark Administrator Staff Member Administrator

    Joined:
    May 27, 2007
    Messages:
    6,377
    Likes Received:
    1,345
    Best Answers:
    19
    @up: Debian is a GNU/Linux distribution, it's far from Windows which I assume you're using.
     
  16. k4non

    k4non New Member

    Joined:
    Mar 25, 2008
    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    I'm getting this error too when i compile
    Someone knows the solution?
    Thanks

    Edit:
    Resolved
     
    Last edited: Apr 28, 2008
  17. elf

    elf Sing, sing blue silver

    Joined:
    Dec 11, 2007
    Messages:
    3,662
    Likes Received:
    104
    Best Answers:
    0
    Updated the tutorial.
     
  18. Acubens

    Acubens Old Penguin

    Joined:
    May 6, 2008
    Messages:
    963
    Likes Received:
    66
    Best Answers:
    0
    Thanks alot <short>
     
  19. Basis

    Basis Member

    Joined:
    May 9, 2008
    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    I keep getting "virtual memory exhausted: Cannot allocate memory"

    I've got a small VPS and when I get to ~/forgottenserver and run the make command it gets to game.o and stops and gives me the memory error. Am I screwed, or should I just try to reboot the VPS? What do you guys think?

    Also - I'm using Ubuntu 8.04 And so far up until this point everything's been running smoothly, no problems :/


    EDIT
    Uninstalled Ubuntu, installed Debian. Same memory error.
     
    Last edited: May 14, 2008
  20. Keraxel

    Keraxel Ω Obfuscator Ω

    Joined:
    Feb 2, 2008
    Messages:
    941
    Likes Received:
    5
    Best Answers:
    0
    Probably you must type 'sudo' before command

    When I tried download packages i got this bug:
    Code (Text):
    1.  
    2. [email protected]:/home/keraxel# apt-get install libboost-date-time-dev libboost-date-time1.34.1 libboost-dev libboost-regex-dev libboost-regex1.34.1 libboost-signals-dev libboost-signals1.34.1 libboost-thread-dev libboost-thread1.34.1 libxml2 liblua5.1-0 liblua5.1-0-dev liblua50 liblua50-dev liblualib50 liblualib50-dev lua50 libsqlite0 libsqlite0-dev libsqlite3-0 libsqlite3-dev sqlite3 lua5.1 libmysql++-dev libgmp3-dev subversion make g++ libxml2-dev libxml++2.6-dev liblua5.1-sql-mysql-dev liblua5.1-sql-mysql-2 liblua5.1-sql-sqlite-dev liblua5.1-sql-sqlite2 libmysqlclient15-dev mysql-client-5.0 mysql-common mysql-server-5.0 gcc cpp
    3. Czytanie list pakietów... Gotowe
    4. Budowanie drzewa zależności      
    5. Reading state information... Gotowe
    6. libxml2 jest już w najnowszej wersji.
    7. libsqlite3-0 jest już w najnowszej wersji.
    8. make jest już w najnowszej wersji.
    9. E: Nie udało się odnaleźć pakietu liblua5.1-sql-mysql-2
    10.  
    11.  
    How to solve it?
     
    Last edited: May 19, 2008

Share This Page

Loading...