compiling in Fedora

From: Dave (kaatzd_at_hotmail.com)
Date: 08/18/04

  • Next message: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"
    Date: 17 Aug 2004 16:34:29 -0700
    
    

    Hello all,

    I have read with interest some recent threads about make files and
    such.
    I am trying to port a simple socket host example program from unix to
    linux - Fedora actually.
    It isn't working, so I created a hello world program. It also doesn't
    work, but I cannot tell why. I think a linking problem. But I read in
    other threads that I should let gcc do the linking for me. OK, here is
    my make file:
    ===================
    # hello world test program
    TARGET=hello
    SOURCE=$(TARGET).c
    OBJECTS=$(TARGET)$(OBJ)
    CC=gcc
    COPT= -Wall
    DFLAGS=
    EXE=
    OBJ=.o
    SLASH=/

    $(TARGET)$(EXE) : $(OBJECTS)
    $(CC) $(COPT) $(DFLAGS) $(OBJECTS) -o $@

    clean :
    - rm -f $(TARGET).o $(TARGET)$(EXE)
    ====================
    The output seen when compiling is this:
    gcc -c -o hello.o hello.c
    gcc -Wall hello.o -o hello

    And a hello file is made with execute permissions for all users.
    When I type hello at the command prompt, I get this:
    bash: hello: command not found

    So I tried compiling separately and linking with ld, thus:
    ===== separate linking makefile snippet ============
    COPT=-c -Wall

    $(TARGET)$(EXE) : $(OBJECTS)
    ld $(OBJECTS) -o $(TARGET)$(EXE)

    $(OBJECTS) : $(SOURCE)
    $(CC) $(COPT) $(DFLAGS) $(SOURCE)
    ==================================
    The results of running make:
    gcc -c -Wall hello.c #-o hello
    ld hello.o -o hello
    ld: warning: cannot find entry symbol _start; defaulting to 08048094
    hello.o(.text+0x19): In function `main':
    : undefined reference to `printf'
    make: *** [hello] Error 1

    Am I missing library files? Where should they reside? I cannot find
    any glibc* files on the system, except for a couple glibconfig.h files.
    Thanks,
    Dave


  • Next message: Jens.Toerring_at_physik.fu-berlin.de: "Re: compiling in Fedora"

    Relevant Pages

    • Re: Problem with Solaris 9 and mtr-0.58
      ... mtr.c:351: warning: assignment makes pointer from integer without a cast ... gcc: -lcurses: linker input file unused since linking not done ...
      (comp.unix.solaris)
    • Re: [uml-devel] Re: Partial fix! - Was: Re: [BUG report] UML linux-2.6 latest BK doesnt compile
      ... A note for Jeff: I forgot to send this email and complained to you because you ... the link failure was when linking the first object together in the final ... The symbol was referred to by the wrappers inserted by GCC for gprof / ... Also, maybe adding a dependency on static linking for GCOV is needed, maybe. ...
      (Linux-Kernel)
    • Re: g77 & gcc problem
      ... gcc: installation problem, cannot exec `f771': No such file or ... gcc: anal.inc: linker input file unused because linking not done ...
      (comp.lang.fortran)
    • g77 & gcc problem
      ... gcc: installation problem, cannot exec `f771': No such file or ... gcc: anal.inc: linker input file unused because linking not done ...
      (comp.lang.fortran)
    • Re: What Linux for: CC /LIST=x.lst
      ... Please forget what you know from previous systems as a starting point for your quest; sure, the models and the mechanisms used by the various and sundry IBM operating systems and by OpenVMS are quite valid and do certainly have their uses. ... That approach drives Unix folks to frustration and flames when they try it on OpenVMS, and it drives OpenVMS folks nuts when they're starting to use Unix. ... OpenVMS has NetBeans for Java as an IDE, but most of the OpenVMS development tends to be oriented toward the command line. ... gcc is big and hairy and definitely both massively powerful and equally incredibly arcane. ...
      (comp.os.vms)