11.4, Another undefined reference, 'stat', '__libc_csu_fini', and '__libc_csu_init'

I am including libc, libutil, and crt1.o, so, these should be available, any ideas?

link: ld -L/usr/lib64 -lc -lutil -lpthread -M -o Agent /usr/lib64/crt1.o agent.o EOD.o getSysID.o heartbeat.o socket.o sysInfo.o update.o utilsA.o utilsCommon.o utilsAlinux.o

compile: gcc -fms-extensions -I . -I /usr/include -pthread -Facs -c agent.c

Please help! Additional info:

  1. everything compiles without warnings (all files compiled with same command string in original post)
  2. this is a fresh 11.4 install, just added dev tools
  3. environment:
    ALSA_CONFIG_PATH=/etc/alsa-pulse.conf
    BASH=/bin/bash
    BASHOPTS=checkwinsize:cmdhist:expand_aliases:extquote:force_fignore:histappend:hostcomplete:interactive_comments:login_shell:progcomp:promptvars:sourcepath
    BASH_ALIASES=()
    BASH_ARGC=()
    BASH_ARGV=()
    BASH_CMDS=()
    BASH_LINENO=()
    BASH_SOURCE=()
    BASH_VERSINFO=([0]=“4” [1]=“1” [2]=“10” [3]=“1” [4]=“release” [5]=“x86_64-suse-linux-gnu”)
    BASH_VERSION=‘4.1.10(1)-release’
    COLORTERM=1
    COLUMNS=180
    CONSOLE_MAGIC=’(K’
    CPU=x86_64
    CSHEDIT=emacs
    CVS_RSH=ssh
    DIRSTACK=()
    EUID=0
    FROM_HEADER=
    GPG_TTY=/dev/pts/2
    GROUPS=()
    G_BROKEN_FILENAMES=1
    HISTCONTROL=ignoreboth
    HISTFILE=/root/.bash_history
    HISTFILESIZE=1000
    HISTSIZE=1000
    HOME=/root
    HOST=linux-m0vr
    HOSTFILE=
    HOSTNAME=linux-m0vr
    HOSTTYPE=x86_64
    IFS=$’

    INPUTRC=/etc/inputrc
    INSTALL_DESKTOP_EXTENSIONS=yes
    JAVA_BINDIR=/usr/lib64/jvm/jre/bin
    JAVA_HOME=/usr/lib64/jvm/jre
    JAVA_ROOT=/usr/lib64/jvm/jre
    JRE_HOME=/usr/lib64/jvm/jre
    KDE_USE_IPV6=yes
    LANG=POSIX
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64
    LESS=’-M -I -R’
    LESSCLOSE=‘lessclose.sh %s %s’
    LESSKEY=/etc/lesskey.bin
    LESSOPEN=‘lessopen.sh %s’
    LESS_ADVANCED_PREPROCESSOR=no
    LINES=127
    LOGNAME=root
    LS_COLORS=
    LS_OPTIONS=’-A -N --color=none -T 0’
    MACHTYPE=x86_64-suse-linux
    MAIL=/var/mail/root
    MAILCHECK=60
    MANPATH=/usr/lib64/mpi/gcc/openmpi/share/man:/usr/share/man:/usr/local/man
    MINICOM=’-c on’
    MORE=-sl
    NNTPSERVER=news
    OLDPWD=/root
    OPTERR=1
    OPTIND=1
    OSTYPE=linux
    PAGER=less
    PATH=/usr/lib64/mpi/gcc/openmpi/bin:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib64/jvm/jre/bin
    PIPESTATUS=([0]=“0”)
    PPID=10641
    PROFILEREAD=true
    PS1=$’\\E[1m\E[31m\]\h:\w # \\E[0;10m\]’
    PS2=’> ’
    PS4=’+ ’
    PWD=/RPlus
    PYTHONSTARTUP=/etc/pythonstart
    QT_SYSTEM_DIR=/usr/share/desktop-data
    SDL_AUDIODRIVER=pulse
    SHELL=/bin/bash
    SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
    SHLVL=1
    SSH_CLIENT=‘192.168.0.123 54699 22’
    SSH_CONNECTION=‘192.168.0.123 54699 192.168.0.203 22’
    SSH_TTY=/dev/pts/2
    TERM=cygwin
    UID=0
    USER=root
    WINDOWMANAGER=/usr/bin/gnome
    XCURSOR_THEME=DMZ
    XDG_CONFIG_DIRS=/etc/xdg
    XDG_DATA_DIRS=/usr/share
    XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
    XNLSPATH=/usr/share/X11/nls
    X_MOUSE_CURSOR=DMZ
    YAST=/sbin/yast
    YAST_MODLIST=()
    _=set
    _HOMEBASHRC=true
    __git_all_commands=
    __git_diff_common_options=$’–stat --numstat --shortstat --summary
    –patch-with-stat --name-only --name-status --color
    –no-color --color-words --no-renames --check
    –full-index --binary --abbrev --diff-filter=
    –find-copies-harder
    –text --ignore-space-at-eol --ignore-space-change
    –ignore-all-space --exit-code --quiet --ext-diff
    –no-ext-diff
    –no-prefix --src-prefix= --dst-prefix=
    –inter-hunk-context=
    –patience
    –raw
    –dirstat --dirstat= --dirstat-by-file
    –dirstat-by-file= --cumulative

    __git_fetch_options=$’
    –quiet --verbose --append --upload-pack --force --keep --depth=
    –tags --no-tags --all --prune --dry-run

    __git_log_common_options=$’
    –not --all
    –branches --tags --remotes
    –first-parent --merges --no-merges
    –max-count=
    –max-age= --since= --after=
    –min-age= --until= --before=

    __git_log_date_formats=‘relative iso8601 rfc2822 short local default raw’
    __git_log_gitk_options=$’
    –dense --sparse --full-history
    –simplify-merges --simplify-by-decoration
    –left-right

    __git_log_pretty_formats=‘oneline short medium full fuller email raw format:’
    __git_log_shortlog_options=$’
    –author= --committer= --grep=
    –all-match

    __git_merge_options=$’
    –no-commit --no-stat --log --no-log --squash --strategy
    –commit --stat --no-squash --ff --no-ff --ff-only

    __git_merge_strategies=
    __git_mergetools_common=$‘diffuse ecmerge emerge kdiff3 meld opendiff
    tkdiff vimdiff gvimdiff xxdiff araxis p4merge

    __git_porcelain_commands=
    __git_send_email_confirm_options=‘always never auto cc compose’
    __git_send_email_suppresscc_options=‘author self cc bodycc sob cccmd body all’
    __git_whitespacelist=‘nowarn warn error error-all fix’
    __pkcon_commandlist=$’
    accept-eula
    get-roles
    get-depends
    get-details
    get-distro-upgrades
    get-files
    get-filters
    get-groups
    get-packages
    download
    get-requires
    get-time
    get-transactions
    get-update-detail
    get-updates
    get-categories
    install
    install-local
    refresh
    remove
    repo-disable
    repo-enable
    repo-list
    repo-set-data
    resolve
    search
    update
    upgrade-system

    is=bash
    japanese_legacy_encoding=EUC-JP
    line=Exec=gnome
    mpi_selection=openmpi-1.2.8
    mpi_selector_dir=/var/mpi-selector/data
    mpi_selector_homefile=/root/.mpi-selector
    mpi_selector_sysfile=/etc/sysconfig/mpi-selector
    s=/etc/bash_completion.d/zypper.sh
    tty=/dev/pts/2

On Wed, 03 Aug 2011 19:26:02 +0000, spinlock1315 wrote:

> I am including libc, libutil, and crt1.o, so, these should be available,
> any ideas?
>
> link: ld -L/usr/lib64 -lc -lutil -lpthread -M -o Agent /usr/lib64/crt1.o
> agent.o EOD.o getSysID.o heartbeat.o socket.o sysInfo.o update.o
> utilsA.o utilsCommon.o utilsAlinux.o
>
> compile: gcc -fms-extensions -I . -I /usr/include -pthread -Facs -c
> agent.c

I don’t see an error message here - can you include that so someone who
knows about these things can help you?

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

And please use CODE tags when posting computer input/output: Posting in Code Tags - A Guide

Here are the error messages:

/usr/lib64/crt1.o: In function _start': /usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/start.S:106: undefined reference to __libc_csu_fini’
/usr/src/packages/BUILD/glibc-2.11.3/csu/…/sysdeps/x86_64/elf/start.S:107: undefined reference to __libc_csu_init' utilsCommon.o: In function sizeofFile’:
utilsCommon.c:(.text+0x1431): undefined reference to `stat’
make: *** [Agent] Error 1

On Fri, 05 Aug 2011 19:16:03 +0000, spinlock1315 wrote:

> Here are the error messages:
>
> /usr/lib64/crt1.o: In function `_start’:

/usr/src/packages/BUILD/glibc-2.11.3/csu/…/sysdeps/x86_64/elf/
start.S:106:
undefined reference to __libc_csu_fini' > /usr/src/packages/BUILD/glibc-2.11.3/csu/../sysdeps/x86_64/elf/ start.S:107: > undefined reference to __libc_csu_init’ utilsCommon.o: In function
sizeofFile': utilsCommon.c:(.text+0x1431): undefined reference to > stat’ make: *** [Agent] Error 1

Did you install the devel packages?

Are you certain you installed the 64-bit libraries (rather than the 32-
bit libraries, perhaps)?

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

> Are you certain you installed the 64-bit libraries

  1. During installation, there is no choice, I added “C/C++ Development” to the base installation and nothing else, tHere was no other choices or any description that indicated 32 or 64.

  2. I wrote a helloworld that indicates “hello, sizeof(size_t)=8” and none of the gcc-32bit options are checked under softwareManagement.

I think 64-bit installed.

On Sat, 06 Aug 2011 18:06:02 +0000, spinlock1315 wrote:

>> Are you certain you installed the 64-bit libraries
> 1) During installation, there is no choice, I added “C/C++ Development”
> to the base installation and nothing else, tHere was no other choices or
> any description that indicated 32 or 64.
>
> 2) I wrote a helloworld that indicates “hello, sizeof(size_t)=8” and
> none of the gcc-32bit options are checked under softwareManagement.
>
> I think 64-bit installed.

It’s always good to check and find out, especially when using a 64-bit
system.

That’s why I asked.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C

Try:

ld -L/usr/lib64 -L/lib64 ...

and report if this helps (or not).

I tried and had exact same result.

thanks,

I have a workaround, but it is very frustrating to have so much trouble trying to figure out where includes/libs are!

WORKAROUND: I concatenated all my C files together in all.c. Then I was able to compile with a single gcc command, i.e. I didn’t have to specify paths to ld command. It works fine with gcc defaults!

gcc -fms-extensions -I . -pthread -l c -l util -l pthread all.c -o agent