[XForms] How to tell my computer he should use a spezified version of xforms?

Angus Leeming angus.leeming at btopenworld.com
Tue Jun 1 18:56:24 EDT 2004


On Tuesday 01 June 2004 11:35 pm, Bernd Hahnebach wrote:
> To subscribers of the xforms list
>
>
> Hi,
>
> As a result of dot vs. comm problem I installed xforms 1.0.90 from
> source code. For compilation of my software it is easy to tell
> which version of the library should be used. Compiling my software
> using static labrary it works.
>
> Asuming I compile using
> shared library. I have got a problem. How do I know which
> library is my computer using during run time of my software?
> How can I tell him which library should he use?
>
> Both are versions 1.0.x

Hi, Bernd.

Generally speaking, a link line such as

$ cc -o trial trial.c -lforms -lX11

will link against the .so versions of the libraries if the compiler 
can find them.

On linux, 
$ ldd ./trial
will list the shared object dependencies.

If you look closely, you'll find that you have created executables 
fdesign and fd2ps, linked both statically and dynamically.

The static version of fdesign is found in $build_tree/fdesign/fdesign 
whilst the dynamic version is found in 
$build_tree/fdesign/.libs/fdesign

$ cd fdesign
$ ldd ./fdesign
        not a dynamic executable
$ ldd .libs/fdesign
        libforms.so.1 => /usr/local/lib/libforms.so.1 (0x005f6000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x00513000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x00a4e000)
        libXpm.so.4 => /usr/X11R6/lib/libXpm.so.4 (0x00ba4000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x00181000)
        libc.so.6 => /lib/tls/libc.so.6 (0x0029c000)
        libm.so.6 => /lib/tls/libm.so.6 (0x008a7000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x004cc000)
        libdl.so.2 => /lib/libdl.so.2 (0x00111000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00eda000)

It is the dynamicly-linked version that is installed.

The simplest way to make the two versions of your executable is:

Dynamically-linked:
$ gcc -o trial trial.c

Staticly-linked:
$ gcc -static -o trial trial.c

If you don't use gcc, then 'man cc' is your friend.

HTH,
Angus



More information about the Xforms mailing list