Opened 17 years ago

Closed 16 years ago

Last modified 14 years ago

#13166 closed defect (fixed)

Gkrellm fails to build on Mac OS X 10.5 Leopard (kvm.h not found)

Reported by: daniel@… Owned by: markd@…
Priority: Normal Milestone:
Component: ports Version: 1.5.0
Keywords: kvm Cc:
Port: gkrellm

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Gkrellm fails to build, problem with kvm.h, found somewhere in Xcode the line :

/*
 * Although Darwin does have a kvm.h file, kvm_openfiles etc. always
 * return null because /dev/kmem was removed completely in OS X 10.5.
 */
#undef HAVE_KVM_H
#undef HAVE_KVM_GETPROCS
#undef HAVE_KVM_OPENFILES

When building ports, this happens:

port install gkrellm
--->  Building gkrellm with target darwin
Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_sysutils_gkrellm/work/gkrellm-2.3.0" && gnumake darwin " returned error 2
Command output: (cd po && gnumake all)
gnumake[1]: Nothing to be done for `all'.
(cd src && gnumake GTK_CONFIG=gtk-config STRIP= HAVE_GETADDRINFO=1 \
		EXTRAOBJS= SYS_LIBS="-lkvm -framework IOKit" \
		LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation -lX11" \
		gkrellm )
cc -Wall -O2 -I.. `pkg-config --cflags gtk+-2.0 gthread-2.0`   -DENABLE_NLS -DLOCALEDIR=\"/opt/local/share/locale\" -DHAVE_GETADDRINFO -I/opt/local/include -L/opt/local/lib -I/opt/local/include  -c -o sysdeps-unix.o sysdeps-unix.c
In file included from sysdeps-unix.c:34:
sysdeps/darwin.c:24:17: error: kvm.h: No such file or directory
In file included from sysdeps-unix.c:34:
sysdeps/darwin.c:30: error: syntax error before '*' token
sysdeps/darwin.c:30: warning: type defaults to 'int' in declaration of 'kvmd'
sysdeps/darwin.c:30: warning: data definition has no type or storage class
sysdeps/darwin.c: In function 'gkrellm_sys_main_init':
sysdeps/darwin.c:40: warning: implicit declaration of function 'kvm_openfiles'
sysdeps/darwin.c:40: warning: assignment makes pointer from integer without a cast
sysdeps/darwin.c: In function 'gkrellm_sys_cpu_read_data':
sysdeps/darwin.c:69: warning: pointer targets in passing argument 3 of 'host_processor_info' differ in signedness
sysdeps/darwin.c: In function 'gkrellm_sys_cpu_init':
sysdeps/darwin.c:95: warning: pointer targets in passing argument 3 of 'host_processor_info' differ in signedness
In file included from sysdeps-unix.c:34:
sysdeps/darwin.c: In function 'gkrellm_sys_proc_read_data':
sysdeps/darwin.c:158: error: array type has incomplete element type
sysdeps/darwin.c:190: warning: implicit declaration of function 'kvm_nlist'
sysdeps/darwin.c:192: warning: implicit declaration of function 'kvm_read'
sysdeps/darwin.c:158: warning: unused variable 'nl'
sysdeps/darwin.c: In function 'gkrellm_sys_proc_read_users':
sysdeps/darwin.c:220: warning: 'utmp' is deprecated (declared at /usr/include/utmp.h:97)
gnumake[1]: *** [sysdeps-unix.o] Error 1
gnumake: *** [darwin] Error 2

Error: Status 1 encountered during processing.

Attachments (1)

gkrellm.diff (1.8 KB) - added by blb@… 16 years ago.
diff to gkrellm

Download all attachments as: .zip

Change History (12)

comment:1 Changed 17 years ago by nox@…

Cc: markd@… added
Milestone: MacPorts 1.5Port Bugs

comment:2 Changed 17 years ago by nox@…

Summary: Gkrellm fails on kvm.hGkrellm fails to build on Mac OS X 10.5 Leopard (kvm.h not found)

Seems somewhat the same as #13201.

comment:3 Changed 17 years ago by markd@…

I can solve the missing kvm.h (it is in /Developer/SDKs/MacOSX10.4u.sdk/usr/include), but another set of problems just crops up, so I'll have to wait until someone can help out on this.

comment:4 in reply to:  description Changed 17 years ago by daniel@…

still the same with MacPorts 1.6 on 10.5 :/

comment:5 in reply to:  2 ; Changed 17 years ago by afb@…

Replying to nox@macports.org:

Seems somewhat the same as #13201.

Difference being that this port actually uses kvm, while the other didn't (just a extra #include)

comment:6 Changed 17 years ago by jmroot (Joshua Root)

Cc: markd@… removed
Owner: changed from macports-tickets@… to markd@…

Assigning to maintainer.

comment:7 in reply to:  5 Changed 16 years ago by syrinx@…

Replying to afb@macports.org:

Replying to nox@macports.org:

Seems somewhat the same as #13201.

Difference being that this port actually uses kvm, while the other didn't (just a extra #include)

I was able to get it to compile and work. Here's what I did:

  1. Observe 'sudo port install gkrellm' fails with the above message.
  2. cd to /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_sysutils_gkrellm/work/gkrellm-2.3.0/src
  3. Attempt to manually compile the one file by including the extra -I for kvm.h:
    sudo cc -Wall -O2 -I.. `pkg-config --cflags gtk+-2.0 gthread-2.0`   -DENABLE_NLS -DLOCALEDIR=\"/opt/local/share/locale\" -DHAVE_GETADDRINFO -I/opt/local/include -L/opt/local/lib -I/opt/local/include -I/Developer/SDKs/MacOSX10.4u.sdk/usr/include  -c -o sysdeps-unix.o sysdeps-unix.c
    Password:
    In file included from sysdeps-unix.c:34:
    sysdeps/darwin.c: In function ‘gkrellm_sys_cpu_read_data’:
    sysdeps/darwin.c:69: warning: pointer targets in passing argument 3 of ‘host_processor_info’ differ in signedness
    sysdeps/darwin.c: In function ‘gkrellm_sys_cpu_init’:
    sysdeps/darwin.c:95: warning: pointer targets in passing argument 3 of ‘host_processor_info’ differ in signedness
    In file included from /System/Library/Frameworks/IOKit.framework/Headers/IOKitLib.h:51,
                     from sysdeps/darwin.c:250,
                     from sysdeps-unix.c:34:
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h: At top level:
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:85: error: ‘io_user_reference_t’ undeclared here (not in a function)
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:87: error: syntax error before ‘OSAsyncReference64’
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:92: error: syntax error before ‘OSAsyncReference64’
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:99: error: syntax error before ‘}’ token
    /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h:103: error: syntax error before ‘io_user_reference_t’
    
  4. sudo vi /System/Library/Frameworks/IOKit.framework/Headers/OSMessageNotification.h' to edit the file and include this
    typedef  uint64_t io_user_reference_t;
    

This should go just before the enum that first references it (search for the first occurance of io_user_reference_t, and stick the typedef just before the struct)

  1. Retry step 3, it should work.
  2. Try again to 'sudo port install gkrellm' - observe another failure about a missing kvm library:
    sudo port install gkrellm
    --->  Building gkrellm with target darwin
    Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_sysutils_gkrellm/work/gkrellm-2.3.0" && gnumake darwin " returned error 2
    Command output: (cd po && gnumake all)
    gnumake[1]: Nothing to be done for `all'.
    (cd src && gnumake GTK_CONFIG=gtk-config STRIP= HAVE_GETADDRINFO=1 \
    		EXTRAOBJS= SYS_LIBS="-lkvm -framework IOKit" \
    		LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation -lX11" \
    		gkrellm )
    cc -Wall -O2 -I.. `pkg-config --cflags gtk+-2.0 gthread-2.0`   -DENABLE_NLS -DLOCALEDIR=\"/opt/local/share/locale\" -DHAVE_GETADDRINFO main.o alerts.o battery.o base64.o clock.o cpu.o disk.o fs.o hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o chart.o panel.o config.o gui.o krell.o plugins.o pixops.o smbdes.o smbencrypt.o smbmd4.o smbutil.o client.o utils.o  deprecated.o winops-x11.o sysdeps-unix.o  -o gkrellm `pkg-config --libs gtk+-2.0 gthread-2.0`  -L/usr/X11R6/lib -lSM -lICE -lkvm -framework IOKit -lssl -lcrypto  -prebind -Wl,-bind_at_load -framework CoreFoundation -lX11
    ld: library not found for -lkvm
    collect2: ld returned 1 exit status
    gnumake[1]: *** [gkrellm] Error 1
    gnumake: *** [darwin] Error 2
    
    Error: Status 1 encountered during processing.
    
  1. Go back to the same directory, and try to manually link the gkrellm binary and omit the -lkvm:
    sudo cc -Wall -O2 -I.. `pkg-config --cflags gtk+-2.0 gthread-2.0`   -DENABLE_NLS -DLOCALEDIR=\"/opt/local/share/locale\" -DHAVE_GETADDRINFO main.o alerts.o battery.o base64.o clock.o cpu.o disk.o fs.o hostname.o inet.o mail.o mem.o net.o proc.o sensors.o uptime.o chart.o panel.o config.o gui.o krell.o plugins.o pixops.o smbdes.o smbencrypt.o smbmd4.o smbutil.o client.o utils.o  deprecated.o winops-x11.o sysdeps-unix.o  -o gkrellm `pkg-config --libs gtk+-2.0 gthread-2.0`  -L/usr/X11R6/lib -lSM -lICE  -framework IOKit -lssl -lcrypto  -prebind -Wl,-bind_at_load -framework CoreFoundation -lX11
    

It works! To quickly try the binary, just type './gkrellm'

  1. Copy the binary to your location of choice.
  2. Puke in a bucket, wash your hands, and say your hail mary's because this is a HUGE hack that has unknown consequences to all other apps, and should only be used to do the 'real' fix.

comment:8 Changed 16 years ago by blb@…

Keywords: gkrellm removed
Port: gkrellm added

Updating to 2.3.2 and removing the -lkvm during linking appears to get it to build fine on my 10.5.5 MBP. Attaching patch to do so.

Changed 16 years ago by blb@…

Attachment: gkrellm.diff added

diff to gkrellm

comment:9 Changed 16 years ago by markd@…

Resolution: fixed
Status: newclosed

Committed. Thanks!

comment:10 Changed 16 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:11 Changed 14 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Note: See TracTickets for help on using tickets.