LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   SIMH diesn't compile "undefinied reference to [fmod|clock_getres" although -lrt/-lm (https://www.linuxquestions.org/questions/linux-software-2/simh-diesnt-compile-undefinied-reference-to-%5Bfmod%7Cclock_getres-although-lrt-lm-908338/)

thosch97 10-15-2011 01:18 PM

SIMH diesn't compile "undefinied reference to [fmod|clock_getres" although -lrt/-lm
 
Hello,

I wanted to compile SIMH (http://simh.trailing-edge.com/), but following happens:
Code:

<thosch97@darkstar:~/simh>
zsh 6 % make   
gcc -std=c99 -U__STRICT_ANSI__ -g -lrt -lm -D_GNU_SOURCE -I . PDP1/pdp1_lp.c PDP1/pdp1_cpu.c PDP1/pdp1_stddev.c PDP1/pdp1_sys.c PDP1/pdp1_dt.c PDP1/pdp1_drm.c PDP1/pdp1_clk.c PDP1/pdp1_dcs.c scp.c sim_console.c sim_fio.c sim_timer.c sim_sock.c sim_tmxr.c sim_ether.c sim_tape.c -I PDP1 -o BIN/pdp1
/tmp/ccANdat7.o: In function `drm':
/home/thosch97/simh/PDP1/pdp1_drm.c:205: undefined reference to `fmod'
/home/thosch97/simh/PDP1/pdp1_drm.c:236: undefined reference to `fmod'
/home/thosch97/simh/PDP1/pdp1_drm.c:246: undefined reference to `fmod'
/home/thosch97/simh/PDP1/pdp1_drm.c:257: undefined reference to `fmod'
/tmp/ccmSIFWD.o: In function `sim_os_ms_sleep_init':
/home/thosch97/simh/sim_timer.c:306: undefined reference to `clock_getres'
collect2: ld gab 1 als Ende-Status zurück (ld exited with 1)
make: *** [BIN/pdp1] Fehler 1 (error 1)

I'm using gcc-Version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) on 3.0.0-12-generic/Ubuntu 11.10

What is wrong with it?
Thank you for you help,

thosch97

knudfl 10-15-2011 02:23 PM

1) sudo apt-get install g++-4.4

2) Edit line 15 in 'makefile' from
Code:

  CC = gcc -std=c99 -U__STRICT_ANSI__ -g $(OS_CCDEFS) -I .
to :
Code:

  CC = gcc-4.4 -std=c99 -U__STRICT_ANSI__ -g $(OS_CCDEFS) -I .
... Then 'make' will create all 26 binaries to the BIN/ directory.

.

thosch97 10-16-2011 05:19 AM

Thanks! It works great now!
(Well, that also explains why it worked on a Sun Ultra5 with Debian Lenny: it has gcc version 4.3.2 (Debian 4.3.2-1.1))


All times are GMT -5. The time now is 06:03 PM.