Build From Package Gentoo

From Emergent

Jump to: navigation, search
Emergent Logo
Building and Installing Emergent
Disclaimer: While emergent developers created these instructions, it is up to Gentoo users to keep them up to date. We do not use Gentoo and cannot support it! --Brian.mingus 02:19, 16 March 2008 (MDT)

These instructions will walk you through compiling emergent on Gentoo doing it the Gentoo way. They assume the bash shell.

emerge emergent's prerequisites

First, the SoQt package only wants to link against Qt3, which is problematic for us, so we're going to create a Portage Overlay.

echo PORTDIR_OVERLAY="/usr/local/portage" >> /etc/make.conf
OVERLAY=/usr/local/portage/media-libs/SoQt
mkdir -p $OVERLAY
cd $OVERLAY
wget -qO- 'http://grey.colorado.edu/emergent/index.php/SoQt-1.4.1.ebuild?action=raw' > SoQt-1.4.1.ebuild
echo media-libs/SoQt ~x86 >> /etc/portage/package.keywords
ebuild SoQt-1.4.1.ebuild digest

We're also going to create one for Simage, since it's not available in Portage:

OVERLAY=/usr/local/portage/media-libs/simage
mkdir -p $OVERLAY
cd $OVERLAY
wget -qO- 'http://grey.colorado.edu/emergent/index.php/Simage-1.6.1.ebuild?action=raw' > simage-1.6.1.ebuild
echo media-libs/simage ~x86 >> /etc/portage/package.keywords
ebuild simage-1.6.1.ebuild digest

Next is Qt. Gentoo installs it in a very nonstandard way, so we'll set up symlinks to make it look like it's installed in the same way Trolltech would have done it:

emerge =x11-libs/qt-4.3.2-r1
export QTDIR=/usr/local/Trolltech/Qt-4.3.2
mkdir -p $QTDIR
cd $QTDIR
ln -s /usr/bin bin
ln -s /usr/lib/qt4 lib
ln -s /usr/lib/qt4/plugins plugins
ln -s /usr/include/qt4 include

Finally, the rest of our prerequisites:

emerge =media-libs/coin-2.4.6 \
=media-libs/SoQt-1.4.1 \
=media-libs/libsndfile-1.0.17 \
=sci-libs/gsl-1.9 \
=dev-games/ode-0.9 \
=dev-util/subversion-1.4.6

Prepare your environment

Paste this into your shell to permanently setup your PATH, LD_LIBRARY_PATH, EMERGENTDIR and QTDIR environment variables. If you've already done one of those, you may delete that particular line:

#!/bin/bash
BASHRC=~/.bashrc
touch $BASHRC

cat >> $BASHRC << Emergent

export PATH=\$PATH:/usr/local/bin
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib
export EMERGENTDIR=/home/`whoami`/emergent
# Check the following line to be sure it has the Qt version you're actually installing!
export QTDIR=/usr/local/Trolltech/Qt-4.3.2

Emergent
source $BASHRC
tail -n6 $BASHRC # Print what we just appended to this file

Download the emergent source code

This will download the latest source code to ~/emergent. Do the following logged in as the regular user, not the root user:

svn checkout --username anonymous --password emergent http://grey.colorado.edu/svn/emergent/emergent/trunk ~/emergent

Build Emergent

To build emergent, run these commands as the regular user:

cd ~/emergent && autoreconf && ./configure && make
sudo make install

With the default install, emergent will be in /usr/local/bin, and you can just type emergent to run it. Support files, including demos, test cases and standard library files for css are located in /usr/local/share/emergent

Optional: Add an Emergent icon to the startup menu

First become root: (sudo su on Ubuntu) and then paste this into the terminal

echo Creating /usr/share/applications/Emergent.desktop K menu item
cat > /usr/share/applications/Emergent.desktop <<Emergent

[Desktop Entry]
Categories=Education;
Exec=env LD_LIBRARY_PATH=/usr/local/lib /usr/local/bin/emergent %f
GenericName=Neural Network Simulation Software
Hidden=false
Icon=/usr/local/share/Emergent/images/emergent_32x32.png
Icon[en_US]=/usr/local/share/Emergent/images/emergent_32x32.png
Name=Emergent
Name[en_US]=Emergent
StartupNotify=true
Terminal=false
Type=Application
X-KDE-SubstituteUID=false
Comment[en_US]=Neural Network Simulation Software
Comment=Neural Network Simulation Software

Emergent

echo Creating /etc/xdg/menus/emergent.menu for application menu item
cat > /etc/xdg/menus/emergent.menu <<Emergent

<Menu>
 <Menu>
  <Name>Education</Name>
  <Layout>
   <Merge type="files" />
   <Filename>Emergent.desktop</Filename>
  </Layout>
  <Include>
   <Filename>Emergent.desktop</Filename>
  </Include>
 </Menu>
</Menu>

Emergent

In KDE, you can now navigate to K Menu > Edutainment > Miscellaneous > Emergent and drag that to your panel if you like. On Gnome it shows up in Menu > Education > Emergent.

Optional: Running Gentoo in VMWare to test these instructions

This is how I created these instructions. If you are updating them, you might like to do it the same way I did. I found the following links useful:

A Gentoo image for VMWare can be obtained from bagvapp. It's quite large and you will need sudo apt-get install p7zip to unpack it. My ethernet didn't work, so I edited gentoo.vmx and tried various network configuration settings listed on this page until I got one that worked. You'll know it works when ifconfig -a lists an ethernet adaptor and dhcpcd eth1 quickly finishes (if it delays at all, kill the virtual machine and try new settings in gentoo.vmx). These are the settings that worked for me:

# First network interface card
ethernet0.present = "true"
ethernet0.startConnected="true"
ethernet0.virtualDev = "vlance"
ethernet0.connectionType = "bridged

Next you'll need to resync with portage:

emerge --sync

Next you'll need to identify emergent's prerequisites using equery. For example, equery list -p SoQt returns:

localhost ~ # equery list -p SoQt
[ Searching for package 'SoQt' in all categories among: ]
 * installed packages
 * Portage tree (/usr/portage)
[-P-] [  ] media-libs/SoQt-1.0.2 (0)
[-P-] [M~] media-libs/SoQt-1.3.0 (0)
[-P-] [M~] media-libs/SoQt-1.4.1

Next identify appropriate packages for all of the prerequisites.

Personal tools