Project

General

Profile

Bug #11733

Compile of ruby 2.2.3 fails on AIX 6.1 TL07 SP03

Added by pedz (Perry Smith) almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
cruby-aix
Target version:
-
[ruby-core:71646]

Description

The build on AIX fails in the ext/-test-/file directory with errors such as

compiling /usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c: In function 'get_fsname':
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:39:14: error: storage size of 'st' isn't known
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:44:5: warning: implicit declaration of function 'statvfs'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:39:14: warning: unused variable 'st'
make: *** [fs.o] Error 1

This can be avoided if line 65 is modified but then we encounter a second error:

compiling /usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c: In function 'get_fsname':
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:45:5: warning: implicit declaration of function 'statvfs'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:49:11: error: 'struct statfs' has no member named 'f_basetype'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:50:9: error: 'struct statfs' has no member named 'f_basetype'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:50:9: error: 'struct statfs' has no member named 'f_basetype'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:50:9: error: 'struct statfs' has no member named 'f_basetype'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:50:9: error: 'struct statfs' has no member named 'f_basetype'

In the extconf.rb, they test for struct statfs -- which AIX has but the code declares variables of statfs_t which AIX does not have.

The AIX statfs is defined in /usr/include/sys/statfs.h (which is included by vfs.h). It has an f_type field but not an f_basetype field.

To get around the issue, I kludged extconf.rb to fail to find the structures it was looking for and then it built but this is clearly not a real solution.

Associated revisions

Revision 4cd4556f
Added by nagachika (Tomoyuki Chikanaga) almost 4 years ago

merge revision(s) 50423: [Backport #11733]

    * ext/-test-/file/fs.c: need to include sys/statvfs.h
      to use statvfs().

    * ext/-test-/file/extconf.rb: check the existence of
      sys/statvfs.h

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 52973
Added by nagachika (Tomoyuki Chikanaga) almost 4 years ago

merge revision(s) 50423: [Backport #11733]

* ext/-test-/file/fs.c: need to include sys/statvfs.h
  to use statvfs().

* ext/-test-/file/extconf.rb: check the existence of
  sys/statvfs.h

History

Updated by pedz (Perry Smith) almost 4 years ago

Another set of errors (why I gave up on modifying fs.c were these:

compiling /usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c: In function 'get_fsname':
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:44:5: warning: implicit declaration of function 'statvfs'
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:48:24: error: subscripted value is neither array nor pointer
/usr/work/src/ruby-2.2.3/ext/-test-/file/fs.c:49:2: warning: passing argument 1 of 'strlen' makes pointer from integer without a cast

So it appears at first blush that AIX's statfs and statvfs structures are different from what is expected.

Updated by naruse (Yui NARUSE) almost 4 years ago

  • Assignee set to cruby-aix

Updated by usa (Usaku NAKAMURA) almost 4 years ago

  • Status changed from Open to Closed
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED

Updated by usa (Usaku NAKAMURA) almost 4 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
#5

Updated by ReiOdaira (Rei Odaira) almost 4 years ago

r50423 will be soon back-ported to the 2.2 branch.

In the meantime, I believe you can avoid the compile error by the following patch.

--- ruby-2.2.3/ext/-test-/file/fs.c     2015-05-23 10:15:12.000000000 -0700
+++ ../Contribution/ruby-2.2.3/ext/-test-/file/fs.c     2015-09-08 12:32:04.000000000 -0700
@@ -7,6 +7,9 @@
  #ifdef HAVE_SYS_VFS_H
  #include <sys/vfs.h>
  #endif
+ #ifdef _AIX
+ #include <sys/statvfs.h>
+ #endif

  #if defined HAVE_STRUCT_STATFS_F_FSTYPENAME
  typedef struct statfs statfs_t;

Updated by nagachika (Tomoyuki Chikanaga) almost 4 years ago

  • Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

Backported into ruby_2_2 branch at r52973.

Also available in: Atom PDF