Serpent 2.1.31 compile fails on Mac OS X Mojave

Report all good and bad behavior here
Post Reply
User avatar
markdehart
Posts: 40
Joined: Fri May 17, 2013 6:10 pm
Security question 1: No
Security question 2: 92
Location: Idaho National Laboratory

Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by markdehart » Thu May 16, 2019 5:13 pm

I can't build Serpent 2.1.31 on Mac OSX (10.14.4):

In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/strings.h:97:0,
from header.h:12,
from initsocket.c:15:
initsocket.c: In function 'InitSocket':
initsocket.c:59:23: error: 'struct hostent' has no member named 'h_addr'
bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
^
make: *** [initsocket.o] Error 1

Any known fix?

Ville Valtavirta
Posts: 457
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by Ville Valtavirta » Thu May 16, 2019 5:35 pm

Hi Mark,

could you try changing the bcopy statement on lines 59-60 of initsocket.c from

Code: Select all

  bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
        server->h_length);
to

Code: Select all

  memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length); 
Some of the routines for the new socket-based communications capabilities seem to be quite platform dependent.

-Ville

User avatar
markdehart
Posts: 40
Joined: Fri May 17, 2013 6:10 pm
Security question 1: No
Security question 2: 92
Location: Idaho National Laboratory

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by markdehart » Thu May 16, 2019 5:43 pm

Nope, same error:

Code: Select all

gcc -Wall -ansi -ffast-math -O3 -I/usr/local/Cellar/gd/2.2.5/include -Wunused -DOPEN_MP -fopenmp -pedantic -c initsocket.c
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:190:0,
                 from header.h:11,
                 from initsocket.c:15:
initsocket.c: In function 'InitSocket':
initsocket.c:62:44: error: 'struct hostent' has no member named 'h_addr'
   memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length);
                                            ^
make: *** [initsocket.o] Error 1
The problem is that h_addr is not a member of this structure.

Ville Valtavirta
Posts: 457
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by Ville Valtavirta » Thu May 16, 2019 5:50 pm

Ah,

I see. One thing that you can try as a test subject is to add

Code: Select all

#define h_addr h_addr_list[0]
to the top of the initsocket.c file (~line 15 or so). If that does not work, you can simply delete the contents of the subroutine to end up with

Code: Select all

void InitSocket()
{
}
which should let you compile it. As you most likely will not be using the socket based communications capabilities, this should not affect any calculations.

-Ville

User avatar
markdehart
Posts: 40
Joined: Fri May 17, 2013 6:10 pm
Security question 1: No
Security question 2: 92
Location: Idaho National Laboratory

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by markdehart » Thu May 16, 2019 8:23 pm

The first option,

Code: Select all

#define h_addr h_addr_list[0]
worked and I was able to compile. Thanks Ville.

User avatar
markdehart
Posts: 40
Joined: Fri May 17, 2013 6:10 pm
Security question 1: No
Security question 2: 92
Location: Idaho National Laboratory

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by markdehart » Thu May 16, 2019 8:25 pm

In fact, I was able to go back to the original source so all I needed to change in the source was the added #define.

Ville Valtavirta
Posts: 457
Joined: Fri Sep 07, 2012 1:43 pm
Security question 1: No
Security question 2: 92

Re: Serpent 2.1.31 compile fails on Mac OS X Mojave

Post by Ville Valtavirta » Fri May 17, 2019 10:44 am

Thanks for testing Mark,

the

Code: Select all

h_addr_list[0]
version seems to be working on Linux too so we'll move to that for future versions for portability.

-Ville

Post Reply