Opened 13 months ago

Last modified 13 months ago

#71656 new defect

vim build error: storage size of ‘vm_stat’ isn’t known

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: Cc: raimue (Rainer Müller)
Port: vim

Description

:info:build /usr/bin/gcc-4.2 -std=gnu99 -c -I.       -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X  -pipe -Os -arch ppc -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1              -o objects/optionstr.o optionstr.c
:info:build /usr/bin/gcc-4.2 -std=gnu99 -c -I. -Iproto -DHAVE_CONFIG_H   -I/opt/local/include -DMACOS_X  -pipe -Os -arch ppc -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/os_unix.o os_unix.c
:info:build In file included from vim.h:2414,
:info:build                  from optionstr.c:14:
:info:build proto.h:127: warning: ‘cold’ attribute directive ignored
:info:build proto.h:134: warning: ‘cold’ attribute directive ignored
:info:build proto.h:137: warning: ‘cold’ attribute directive ignored
:info:build In file included from vim.h:2414,
:info:build                  from os_unix.c:21:
:info:build proto.h:127: warning: ‘cold’ attribute directive ignored
:info:build proto.h:134: warning: ‘cold’ attribute directive ignored
:info:build proto.h:137: warning: ‘cold’ attribute directive ignored
:info:build os_unix.c: In function ‘mch_total_mem’:
:info:build os_unix.c:537: error: storage size of ‘vm_stat’ isn’t known
:info:build make[1]: *** [objects/os_unix.o] Error 1
:info:build make[1]: *** Waiting for unfinished jobs....

Attachments (1)

main.log (95.1 KB) - added by barracuda156 13 months ago.

Download all attachments as: .zip

Change History (3)

Changed 13 months ago by barracuda156

Attachment: main.log added

comment:1 Changed 13 months ago by barracuda156

The code probably should be:

# ifdef MACOS_X
    {
	// Mac (Darwin) way of getting the amount of RAM available
	mach_port_t		host = mach_host_self();
	kern_return_t		kret;
#  if defined(HOST_VM_INFO64) && !defined(__i386__) && !defined(__ppc__)
	struct vm_statistics64	vm_stat;
	natural_t		count = HOST_VM_INFO64_COUNT;

	kret = host_statistics64(host, HOST_VM_INFO64,
					     (host_info64_t)&vm_stat, &count);
#  else
	struct vm_statistics	vm_stat;
	natural_t		count = HOST_VM_INFO_COUNT;

	kret = host_statistics(host, HOST_VM_INFO,
					       (host_info_t)&vm_stat, &count);
#  endif

I.e. HOST_VM_INFO64 may be defined, but should not be used on 32-bit.

comment:2 Changed 13 months ago by kencu (Ken)

You might look at the macro that Apple and others recommend for checking for 32 vs 64 compilation, __LP64__.

https://forums.developer.apple.com/forums/thread/85816

https://bignerdranch.com/blog/64-bit-smorgasbord/

https://www.cita.utoronto.ca/~merz/intel_c10b/main_cls/mergedProjects/bldaps_cls/cppug_mac/bldaps_mac_target.htm

https://stackoverflow.com/questions/685124/how-to-identify-a-64-bit-build-on-linux-using-the-preprocessor

https://gcc.gnu.org/onlinedocs/gcc-4.4.0/cpp/Common-Predefined-Macros.html

__LP64__
_LP64
These macros are defined, with value 1, if (and only if) the compilation is for a target where long int and pointer both use 64-bits and int uses 32-bit.
Note: See TracTickets for help on using tickets.