Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I'm trying to get Guile to work, but I'm having some issues. Here is my Makefile: guiletest : guiletest.o gcc -o guiletest guiletest.o guiletest.o : guiletest.c gcc "guile-config link" -c ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    108

    Getting Guile to work


    I'm trying to get Guile to work, but I'm having some issues.

    Here is my Makefile:
    guiletest : guiletest.o
    gcc -o guiletest guiletest.o
    guiletest.o : guiletest.c
    gcc "guile-config link" -c guiletest.c
    Here is my guiletest.c:
    #include <stdio.h>
    #include <stdlib.h>
    #include <libguile.h>

    int main(int argc, char *argv[])
    {
    SCM func_symbol;
    SCM func;

    scm_init_guile();

    scm_c_primitive_load ("script.scm");

    func_symbol = scm_c_lookup("do-hello");
    func = scm_variable_ref(func_symbol);

    scm_call_0(func);

    exit(EXIT_SUCCESS);
    }
    Yet when I compile, I'm getting these errors:
    gcc -o guiletest guiletest.o
    guiletest.o(.text+0x11): In function `main':
    : undefined reference to `scm_init_guile'
    guiletest.o(.text+0x1d): In function `main':
    : undefined reference to `scm_c_primitive_load'
    guiletest.o(.text+0x29): In function `main':
    : undefined reference to `scm_c_lookup'
    guiletest.o(.text+0x37): In function `main':
    : undefined reference to `scm_variable_ref'
    guiletest.o(.text+0x45): In function `main':
    : undefined reference to `scm_call_0'
    collect2: ld returned 1 exit status
    make: *** [guiletest] Error 1
    I am confused. I downloaded guile, did ./configure, make, and make install as root. Why isn't this working? I'm following this guile book.

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    You were using double-quotes (") instead of backticks (`) on the guile-config part of the gcc command line.

  3. #3
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    108
    I changed it to backticks, but it still gives me the same errors.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Just for shits and giggles, can you paste what you typed?

  6. #5
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    108
    What?

    I'll post the Makefile. I think that's what you're asking for.

    guiletest : guiletest.o
    gcc -o guiletest guiletest.o
    guiletest.o : guiletest.c
    gcc 'guile-config link' -c guiletest.c

  7. #6
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    a. Make sure that you've indented lines 2 and 4 with tabs
    b. Those still aren't backticks. The backticks are found directly under the escape key.

  8. #7
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    108
    The lines have been indented. For some reason it's not shown here.

    Here's my new Makefile again:
    guiletest : guiletest.o
    gcc -o guiletest guiletest.o
    guiletest.o : guiletest.c
    gcc `guile-config link` -c guiletest.c
    The errors are still there.

  9. #8
    Linux User
    Join Date
    Jul 2004
    Location
    Poland
    Posts
    368
    Quote Originally Posted by Comrade
    The lines have been indented. For some reason it's not shown here.

    Here's my new Makefile again:
    guiletest : guiletest.o
    gcc -o guiletest guiletest.o
    guiletest.o : guiletest.c
    gcc `guile-config link` -c guiletest.c
    The errors are still there.
    I guess `guile-config link` returns libraries and their paths necessary for linking the program, i.e. making executable from object files. They are useless during compilation, i.e. translating source code to object files. All this boils down to changing your makefile so that it looks like:

    Code:
    guiletest &#58; guiletest.o
            gcc `guile-config link` -o guiletest guiletest.o
    guiletest.o &#58; guiletest.c
            gcc  -c guiletest.c
    Hope this helps a little. I also strongly suggest using -Wall flag for compilation. Best regards.
    "I don't know what I'm running from
    And I don't know where I'm running to
    There's something deep and strange inside of me I see"

  10. #9
    Linux Newbie
    Join Date
    Apr 2005
    Posts
    108
    Foolish me!

    There was a makefile given with the Guile book that I linked to above.

    Here it is :
    CDEBUG = -g -Wall
    CFLAGS = $(CDEBUG) `guile-config compile`
    LDFLAGS = `guile-config link`

    SRCS = main.c
    OBJS = main.o

    hello_world: $(OBJS)
    $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
    Thanks for the help, anyway. I learned more about Makefiles now. Although I'm looking into Jam.

  11. #10
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    What's Jam?

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •