Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, 24 March 2011

Adding External Library as OpenDtect Module

If we wanted to use external library(ies) for opendtect, we need to compile or get the compiled *.so and *.a files.

In my case, I use alglib, which should be compiled by user. Here's the makefile:

# Alglib sample makefile
# Tested on ubuntu 10.4 LTS
# Used for OpenDtect 4.0.1 ( http://opendtect.org )

CC=gcc
AR=ar
SRC=*.cpp
FLAGS=-Wall
OUT=/home/user/lib/libAlglib3
all:
$(CC) -c -fPIC $(SRC) $(FLAGS)
$(AR) -rcs $(OUT).a *.o
$(CC) -shared -Wl,-soname,$(OUT).so.1 -o $(OUT).so *.o $(FLAGS)
rm *.o
clean:
rm *.o


Then we need to add our external library into ODWork environment.
The steps are:

  1. Copy (or link) *.so file into $(ODWork)/bin/lux32/G/so

  2. Copy (or link) *.a and * so into $(ODWork)/lib/lux32/G

  3. Copy *.h files of our external library into $(ODWork)/include/Alglib

  4. Copy *.cpp/*.cc files of our external library into $(ODWork)/src/Alglib

  5. Edit make.od.ModDeps file in $(ODWork)/Pmake, adding LAlglib := -lAlglib3 and IAlglib := Alglib

  6. Edit our plugin makefile, add Alglib to our MODDEPS variable



If there's any question please feel free to ask.

and thanks to Mas Toto for helping me with this.

Some extra note:

  • Don't forget to use "ldd" to help you determine which lib needed by your plugin.

Thursday, 10 February 2011

Linux C++ error (double free or corruption error)

if your program suddenly crashed during runtime and give you this kind of error:

*** glibc detected *** double free or corruption (fasttop): 0x08097c40 ***

use this command before executing your program:

export MALLOC_CHECK_=0
start_program &

Monday, 24 January 2011

Cleaning process for OpenDtect Objects

Previously: there is a pmake configuration to make OpenDtect Plugin...

If there's any change to the SRC.cc list then we should clean some objects created before, or those unused objects will make our plugin malfunctioned. (in other word: OpenDtect couldn't load the plugin)

Now, I just use this script (executed exactly on our plugin folder ? ):


#!/bin/bash
make source1.rmlib
make source2.rmlib

#and so on..


Simple... but without knowing this, making a plugin can give you (a pretty bad) headache!

oh c++...

Tuesday, 18 January 2011

Ubuntu??

Ubuntu is Linux

OpenDtect (Preparing & Deploying Plugin)

Preparing:

1. Always use function below (XXX is your plugin name):

#include "plugins.h"

extern "C" int GetXXXPluginType()
{
return PI_AUTO_INIT_EARLY;
}

extern "C" int GetXXXPluginInfo()
{
static PluginInfo retpi ={
"Plugin Name",
"Author",
"Version Number",
"Description" };
return &retpi;
}



And don't forget the init function!!!!

(Part Of) Deploying:
2. Setting *.alo files
Place your *.alo files on :

  • The plugins/platform_dir of the installation directory ($DTECT_APPL/plugins/$HDIR)

  • The '.od' directory in your 'Personal directory' ($HOME/.od/plugins/$HDIR on Unix)


Example of: odmain.xxx.alo <-- this is the "default" file naming format

Annotations
Madagascar
uiMadagascar
CmdDriver
GMT
uiGMT


3. Distribute your plugin files (those *.dll or *.so files)

Further Resources:

Wednesday, 12 January 2011

OpenDtect (Linux Development Install)

Hi...
  1. Install GCC v3.4.6 (g++, gcc-base, cpp, gcc, libstdc++6-dev. ubuntu, hardy)

  2. download opendtect binary package and developer source package here

  3. chmod downloaded files to executables, run the file, it will extract *tar.gz file into the same directory
    chmod +x [filename]

  4. extract to home directory (e.g: /home/someone)
    tar -xf [extracted downloaded files]

  5. Install opendtect, setup development environment from
    Utilities > Tools  > Create Devel. Env.

  6. Setup IDE (in my case eclipse CDT), Create a new c++ project with existing source, pointing to ODWork directory.

  7. Start developing! in plugin folder of ODWork

Tuesday, 11 January 2011

Old GCC (Ubuntu Releases) & How to add them (on Later Version of Ubuntu)

To Install: (currently trying Hardy's release)
gcc-3.x.x
- gcc-3.4.x-base
- cpp-3.4.x
- gcc-3.4.x
- g++-3.4.x
- libstdc++6-dev (=3.4)
Note

  1. Hardy Devel <- Use This

  2. Hardy-update Devel
Adding repository & Installing (GUI way, using hardy package):
1. software-properties-gtk &
2. add deb http://ubuntu.pesat.net.id/archive/ hardy main universe
3. Update
4. synaptic &
5. Search & install g++-3.4
6. Done

Some extras: (earlier package search)

  1. Ye Olde Ubuntu Releases (Headers, No Hardy)

  2. Not So Olde Ubuntu Releases (ISO)

Wednesday, 5 January 2011

Showing NetworkManager Applet in LXDE (Ubuntu 10.4)


Langkahnya:
1. Alt+F2
2. Masukkan perintah nm-applet
3. Enjoy