Paulie's world in a blog

  • May 31, 2011

Compiling Alpine on Solaris 11

Guest Author
I use alpine as my primary e-mail client. In order to get it compiled for Solaris 11 (snv_166 and later), you will need to make a few changes to the source.
[paulie@adrenaline ~]$ uname -orv
5.11 snv_166 Solaris
[paulie@adrenaline ~]$ ./configure --with-ssl-include-dir=/usr/include/openssl
[paulie@adrenaline ~]$ gmake

We run into a problem ...
In file included from osdep.c:66:
scandir.c: In function `Scandir':
scandir.c:45: error: structure has no member named `dd_fd'

Let's investigate:
[paulie@adrenaline ~]$ vi /usr/include/dirent.h
#if defined(__USE_LEGACY_PROTOTYPES__)
/* traditional SVR4 definition */
typedef struct {
int dd_fd; /* file descriptor */
int dd_loc; /* offset in block */
int dd_size; /* amount of valid data */
char *dd_buf; /* directory block */
} DIR; /* stream data from opendir() */
/* default definition (POSIX conformant) */
typedef struct {
int d_fd; /* file descriptor */
int d_loc; /* offset in block */
int d_size; /* amount of valid data */
char *d_buf; /* directory block */
} DIR; /* stream data from opendir() */
#endif /* __USE_LEGACY_PROTOTYPES__ */

Interesting, so alpine *should* be using POSIX instead of the older UNIX SVR4 definitions. Let's make a change to the scandir.c file, which is located in alpine-2.00/imap/c-client/scandir.c. On line 45 I see the following use of dd_fd:
  if ((!dirp) || (fstat (dirp->dd_fd,&stb) < 0)) return -1;

Let's change that dd_fd to d_fd.
  if ((!dirp) || (fstat (dirp->d_fd,&stb) < 0)) return -1;

After recompile, everything works as expected. I'm sure there is a better way of fixing this problem, but considering how trivial this issue is, a small edit is sufficient.

Join the discussion

Comments ( 4 )
  • guest Wednesday, June 13, 2012

    Thank you for posting this.

  • guest Sunday, March 24, 2013

    Thank you!!! I've been trying to install Alpine for a week & kept getting that error. Cheers!


  • guest Tuesday, April 23, 2013

    Thank you! That was extremely helpfu.

  • guest Thursday, May 30, 2013

    Interesting, you were able to solve the problem by modifying the source code and re-compiling. I wonder if talented non-oracle employees could do the same with an oracle product?

    Someone had to point out the hypocrisy :)

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.