Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

older Linux: undefined reference to `clock_gettime' #44

Closed
cstrotm opened this issue Jun 4, 2020 · 1 comment
Closed

older Linux: undefined reference to `clock_gettime' #44

cstrotm opened this issue Jun 4, 2020 · 1 comment

Comments

@cstrotm
Copy link

cstrotm commented Jun 4, 2020

Hi,

I'm trying to install oksh on an older Debian 6 ARM linux (on a machine that cannot run a newer linux because of custom kernel. But I like the machine and would like to keep it running).

I install via pkgsrc. However the issue seems to be a oksh issue, not with pkgsrc.

The linking step fails with

cc -O2 -D_FORTIFY_SOURCE=2 -DEMACS -DVI -w -D_GNU_SOURCE  -c vis.c
cc -Wl,-R/usr/pkg/lib -o oksh alloc.o asprintf.o c_ksh.o c_sh.o c_test.o c_ulimit.o edit.o  emacs.o eval.o exec.o expr.o history.o io.o jobs.o lex.o mail.o  main.o misc.o path.o shf.o syn.o table.o trap.o tree.o tty.o var.o  version.o vi.o confstr.o reallocarray.o siglist.o signame.o  strlcat.o strlcpy.o strtonum.o unvis.o vis.o -lcurses
c_sh.o: In function `timex':
c_sh.c:(.text+0x18b8): undefined reference to `clock_gettime'
c_sh.c:(.text+0x1928): undefined reference to `clock_gettime'
c_sh.c:(.text+0x1acc): undefined reference to `clock_gettime'
mail.o: In function `mcheck':
mail.c:(.text+0x27c): undefined reference to `clock_gettime'
var.o: In function `setspec':
var.c:(.text+0x1130): undefined reference to `clock_gettime'
var.o:var.c:(.text+0x156c): more undefined references to `clock_gettime' follow
collect2: ld returned 1 exit status

This can be fixed by linking with "librt"

${PROG}: ${OBJS}        ${CC} ${LDFLAGS} -o ${PROG} ${OBJS} -lcurses -lrt

Maybe this can be detected in the configure script and added if needed.

@ibara ibara closed this as completed in 246e682 Jun 4, 2020
@ibara
Copy link
Owner

ibara commented Jun 4, 2020

Should be fixed now. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants