guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

static linking


From: Rouben Rostamian
Subject: static linking
Date: Thu, 15 Jan 2004 00:50:53 -0500

I am having trouble compiling and linking a C program with Guile
libraries on Linux.  I hope to get useful suggestions from you folks.

The C program is shown below in its entirety.  It is extracted from
Guile's documentation:

/* -------- try.c ------------------- */

#include <libguile.h>

static void inner_main(void *closure, int argc, char **argv)
{
        scm_shell(argc, argv);
}

int main(int argc, char **argv)
{
        scm_boot_guile(argc, argv, inner_main, 0);
        return 0;
}

/* ---------------------------------- */


Compiling this with:

   gcc try.c -lguile

produces a dynamically linked executable a.out.  It compiles
and runs just fine.

However, I wish to link against Guile's static libraries.
To that end, I do:

   gcc try.c libguile.a libguile-ltdl.a -lcrypt -ldl -lm

which also compiles successfully and produces an executable a.out.
The trouble is, a.out does not run:

   linux> ./a.out 
   Segmentation fault (core dumped)

I tried playing with various compilation flags (-static -g -O0)
unsuccessfully.

If you have hints about compiling with guile's static libraries
I would be interest to know.

System info:

   Linux kernel: 2.4.21
   gcc: 3.3.1
   guile: 1.6.4


-- 
Rouben Rostamian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]