bugGNU Octave - Bugs: bug #32192, 'gethostname' is not a member of...

 
 

bug #32192: 'gethostname' is not a member of 'gnulib' /oct-env.cc:449:20:

Submitter:  Tatsuro MATSUOKA <tmacchant>
Submitted:  Thu 20 Jan 2011 04:28:30 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 01 Feb 2011 04:24:21 PM UTC, comment #9: 

After rereading Benjamin's post at the gnulib ML I realized that the workaround is to include unistd.h twice in oct-env.cc and not in gnulib!

Sorry for the noise.

Kai (not logged in)

Anonymous
Tue 01 Feb 2011 09:13:38 AM UTC, comment #8: 

Tatsuro,

I try to compile on MinGW an ran into this error too. Can you be a bit more specific in which file (line) this workaround has to be applied.

I have changed
libgnu/gethostname.c @ line 29
(I know this is autogenerated from gnulib/lib/gethostname.c)

but that does not help. I still get the error you have described in your original submission.

I am using a gnulib from yesterday an gcc 4.5.2

Kai (not logged in)

Anonymous
Sat 29 Jan 2011 09:31:06 AM UTC, comment #7: 

As Benjamin posted the gnulib ML

http://old.nabble.com/Problem-with-including-%3Cunistd.h%3E-to30776696.html

Including twice unistd.h makes gnulib::gethostname was recognized correctly.

Tatsuro MATSUOKA <tmacchant>
Sun 23 Jan 2011 06:32:38 PM UTC, comment #6: 


>Why isn't that happening on your system?


I cannot find out the reason.
I will try to build octave other MinGW GCC complier.
Cygwin ships mingw-64 GCC-4.5.1 that also has 32 bit version.
And also try TDM version MinGW.

Tatsuro MATSUOKA <tmacchant>
Sat 22 Jan 2011 06:44:30 PM UTC, comment #5: 

Yes, but the difference you found is in the else part of and "if 1" block, so it would not be expanded anyway, as far as I can tell.

This part


_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));


of the code block that you posted should provide the gnulib::gethostname alias to the gnulib rpl_gethostname function  It looks like it is inside two "#if 1" blocks, so it should be expanded.  Why isn't that happening on your system?  I don't see this anywhere in the oct-env.ii file that you posted earlier.


John W. Eaton <jwe>
Group administrator
Sat 22 Jan 2011 06:14:41 PM UTC, comment #4: 

I prepare build directory besides source directory. Not every time but sometimes delete all files and directories in the build directory root.  I guess this is enough to cleanup. Am I right ?

*************************************************************
#if 1
/* Return the standard host name of the machine.
   WARNING! The host name may or may not be fully qualified.

   Put up to LEN bytes of the host name into NAME.
   Null terminate it if the name is shorter than LEN.
   If the host name is longer than LEN, set errno = EINVAL and return -1.
   Return 0 if successful, otherwise set errno and return -1.  */
# if 1
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef gethostname
#   define gethostname rpl_gethostname
#  endif
_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
                                    _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
# else
#  if !0
_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
                                    _GL_ARG_NONNULL ((1)));
#  endif
/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
   parameter is
                                                      int len.  */
_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
# endif
_GL_CXXALIASWARN (gethostname);
#elif 1
# undef gethostname
# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
#elif defined GNULIB_POSIXCHECK
# undef gethostname
# if HAVE_RAW_DECL_GETHOSTNAME
_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
                 "use gnulib module gethostname for portability");
# endif
#endif
*************************************
I found a difference to what you have shown
 
*******************
#  if !0
_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
                                    _GL_ARG_NONNULL ((1)));
#  endif
*************************************

In my case 'if !0' but that you show 'if !1'

Is this a problem?

Tatsuro MATSUOKA <tmacchant>
Sat 22 Jan 2011 04:46:41 PM UTC, comment #3: 

What does configure tell you when it checks for gethostname?

Maybe you need to run "make maintainer-clean" in your libgnu directory and then reconfigure?

In your generated libgnu/unistd.h file, do you have the following lines?  The #if 1 or 0 lines might be different, but you should still have parts that put gethostname in the gnulib namespace.


#if 1
/* Return the standard host name of the machine.
   WARNING! The host name may or may not be fully qualified.

   Put up to LEN bytes of the host name into NAME.
   Null terminate it if the name is shorter than LEN.
   If the host name is longer than LEN, set errno = EINVAL and return -1.
   Return 0 if successful, otherwise set errno and return -1.  */
# if 0
#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#   undef gethostname
#   define gethostname rpl_gethostname
#  endif
_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len)
                                    _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len));
# else
#  if !1
_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len)
                                    _GL_ARG_NONNULL ((1)));
#  endif
/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second
   parameter is
                                                      int len.  */
_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len));
# endif
_GL_CXXALIASWARN (gethostname);
#elif 0
# undef gethostname
# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname
#elif defined GNULIB_POSIXCHECK
# undef gethostname
# if HAVE_RAW_DECL_GETHOSTNAME
_GL_WARN_ON_USE (gethostname, "gethostname is unportable - "
                 "use gnulib module gethostname for portability");
# endif
#endif


John W. Eaton <jwe>
Group administrator
Sat 22 Jan 2011 10:27:02 AM UTC, comment #2: 


>Is your copy of gnulib up to date?

Yes.
When I build octave, I always use git pull at my gnulib directory before hg pull and then execute autogen.sh.  Therefore my build is carried out using up to date gnulib.

Tatsuro MATSUOKA <tmacchant>
Sat 22 Jan 2011 06:01:57 AM UTC, comment #1: 

Is your copy of gnulib up to date?

John W. Eaton <jwe>
Group administrator
Thu 20 Jan 2011 04:28:30 PM UTC, original submission:  

Hello

I have tried to build octave without my local patch according the suggestion.
 https://savannah.gnu.org/bugs/?32158
 >Please test the current sources with my patch applied
 >but without any of your local patches applied.

However an error
*************
octave-work/liboctave/oct-env.cc:449:20: error: 'gethostname' is not a member of 'gnulib'
*************

occurred.

This is already reported in the maintainer list.
http://octave.1599824.n4.nabble.com/compile-error-on-oct-env-cc-in-building-octave-3-3-52-on-MinGW32-td2549610.html

But good solution has not been founded at present so I register this error to the bug tracker.

I have attached a bz2 compressed oct-env.ii file.

Anyway I recall back my local patch to go ahead further.

Regards

Tatsuro

Tatsuro MATSUOKA <tmacchant>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by tmacchant (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-05-16 rik5 Open/ClosedOpen Closed
    2011-02-21 rik5 Dependencies- bugs #32200 is dependent
    2011-01-20 tmacchant Attached File- Added oct-env.ii.bz2, #22469

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code