In principle, anyone can build the full OpendTect system from source. Fortunately, OpendTect has a plugin architecture which makes it much easier to start developing. Therefore, this manual will focus on plugin development rather than building the entire OpendTect from scratch. If for some reason you are interested in building the entire OpendTect, follow the instructions for plugin development before going here). Even if you want to build for a completely new platform, the first step would still be to get your environment ready for plugin development because the same environment is used for making the entire Opendtect.
For both types of development you should have installed a fully functional OpendTect system before you start. Even when you build the entire OpendTect, you'll want to be able to use some of the libraries from the distribution.
MS Windows-based developers should not be here: instead, go to the windows development section.
Before you can start developing, there are a few external programs that need to be installed.
The following programs should be available:
Recommended but fully optional are:
Pmake is used to build both the entire system aswell as plugins. It requires a few environment variables to be setup and it expects a certain directory structure in your OpendTect Work directory.
Before you can build anything, you should let OpendTect setup a new ODWork directory. The easiest way to do this is from within OpendTect, menu 'Utilities-Create Devel. Env.'. This function will make sure you get a full environment that is 'ready to go'. Note that the OpendTect application window will freeze while the development environment is created.
When OpendTect is finished, you will find a fresh ODWork directory with all sources, libs, Makefile and so forth, aswell as init scripts 'init.bash' and 'init.csh'. One of these must be sourced in order to setup the environment in such a way that Pmake and other tools should work immediately.
It is strongly recommended to make sure that there are no spaces in the path to your ODWork directory. A good place for your ODWork directory is your home directory.
The init.csh/init.bash scripts (created by the 'Create Devel. Env.' utility) are making guesses about a few pieces of information that are essential to the work of Pmake:
If the guessed values are not correct, you can overrule them by setting the variables before your init script is sourced. Of course you can source the init script from your login script, e.g. in your ~/.bashrc:
source ~/ODWork/init.bash
After you setup your environment, open a new shell and go to your ODWork directory. If you have sourced your init script from .bashrc or .login, the alias 'cdw' should bring you directly to your ODWork directory. Then go to the plugins directory, subdirectory Hello and type 'make'. You should see something like this:
% cd plugins/Hello % make Making Hello / Linux (Jan 16 09:37:18) DEBUG=yes. Compiling hellopi.cc ... Ranlib on libHello.a ... Creating /users/bert/ODWork/lib/lux/G/libHello.so ... Done ! %If this doesn't give similar output but errors, try the command 'make -n', which shows what make will do without actually doing it:
% make -n rm -f lslux echo " Making Hello / Linux (Jan 16 09:41:52) DEBUG=yes." | tee -a lslux echo "Compiling hellopi.cc ... " | tee -a lslux g++ -c -ggdb3 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DSYSV -D__debug__ -Dlux -D__shared__ -fsigned-char -Wconversion -Wimplicit -Wmissing-prototypes -Wparentheses -Wreturn-type -Werror -Wno-non-template-friend -I/users/bert/ODWork/include -I. hellopi.cc -o /tmp/hellopi.o 1>>lslux 2>&1 ar rv /users/bert/ODWork/lib/lux/G/libHello.a /tmp/hellopi.o 1>>lslux 2>&1 rm -f /tmp/hellopi.o echo "Ranlib on libHello.a ... " | tee -a lslux ranlib /users/bert/ODWork/lib/lux/G/libHello.a echo "Creating /users/bert/ODWork/lib/lux/G/libHello.so ..." | tee -a lslux /users/bert/ODWork/Pmake/base/bin/mkshobjlib /users/bert/ODWork/lib/lux/G/libHello.a --output /users/bert/ODWork/lib/lux/G/libHello.so \ g++ -L/users/bert/ODWork/lib/lux/G -shared -ggdb3 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DSYSV -D__debug__ -Dlux -D__shared__ -fsigned-char -Wconversion -Wimplicit -Wmissing-prototypes -Wparentheses -Wreturn-type -Werror -Wno-non-template-friend -I/users/bert/ODWork/include -I. 1>>lslux 2>&1 echo " Done !" | tee -a lslux %Anyway, when you have the 'Hello world' thing going, try a more 'demanding' plugin. For example the simple file seismic import:
% cd ../uiSeisIOSimple % make Making uiSeisIOSimple / Linux (Jan 16 09:38:13) DEBUG=yes. Compiling seisiosimple.cc ... Compiling uiseisiosimple.cc ... Compiling uiseisiosimplepi.cc ... Ranlib on libuiSeisIOSimple.a ... Creating /users/bert/ODWork/lib/lux/G/libuiSeisIOSimple.so ... Done ! %
The libraries should now be created in $WORK/lib/$HDIR (in the example case /users/bert/ODWork/lib/lux/G). If anything goes wrong during compile and/or link, the error messages are sent to a file lslux (or lssun5 or lssgi depending on your OS) in the source directory. If you want to see these immediately, set the environment variable OUTSTDOUT to yes. You can also add this for each make run, then type:
make OUTSTDOUT=yes
You can test your newly compiled plugins by loading them using the Utilities-plugins menu in OpendTect. For example, if you load the "libHello.so" plugin, you should see "Hello World" on the OpendTect console window. Note that when plugins depend on other plugins, the order of loading matters.
There is no way to un-load a plugin. That means you have to exit OpendTect to test a new version (e.g. after recompile).
Installing a plugin means: making it auto-loaded. This removes the nuisance of having to load the plugin each time you start OpendTect. On the other hand, when you're still developing you may not want the plugin to be loaded all the time. Anyway, the plugins are installed by linking or copying them to the correct plugin subdirectory in either your personal '.od' settings directory, or in the program installation directory and making a configuration ".alo" file.
This is the same on Unix and Windows, so please consult the plugins auto-load and installation documentation for more details.
The distribution of plugins is basically the same for Unix and windows.
Just copy the .alo files into the plugins/platform directory (
For distribution to the outside world, you'll need to package your plugins, documentation, etc. into .tar.gz files on Unix. For all details on what exactly should be packaged and how, we'd recommend contacting support at opendtect.org.
If you're really into it, you can build the entire OpendTect from source after you've installed OpendTect and built a plugin. For that, you will have to get hold of a Qt and a COIN source distribution. This is because you'll need the correct header files to go with the libraries.
Distributing your plugins
$DTECT_APPL/plugins/$HDIR) and copy the actual plugins into the libs subdirectory.
Building from source
Qt = http://www.trolltech.no
Any recent Qt distribution will do. We configure with:
./configure -shared -release -no-gif -enable-opengl -thread -no-g++-exceptions -disable-xml -disable-sql -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -qt-libpng -qt-libjpeg -qt-libmng -qt-imgfmt-jpeg -qt-imgfmt-mng -qt-imgfmt-png
COIN = http://www.sim.no
You need the main COIN library ('Coin-2') and SoQt. For the volume rendering plugin, find the SIMVoleon download too. In rare cases you also want simage. Our configuration:
./configure --disable-debug --disable-symbols --enable-shared --disable-static --enable-vrml97 --enable-threadsafe --enable-rtti --disable-warnings --disable-dependency-tracking --enable-html CFLAGS="-O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" CPPFLAGS="-O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" LDFLAGS="-s -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -lstdc++"
cd $WORK; ln -s Pmake/RootMakefile ./Makefile
Similarly, in the plugins directory use Makefile.od . But in this case you'd probably rather want to include that file in your own Makefile, see comments in Makefile.od for details.