Hi Luk,

Can you take a look at src/config.h after the failed build to figure out
which HAVE_XXX_OS is defined?  Also, the definition of ioctl() in the
header files?

The discussion and details are below.

Thanks,

-- John
--- Begin Message ---
A NOTE has been added to this issue. 
====================================================================== 
http://bugs.bacula.org/view.php?id=1359 
====================================================================== 
Reported By:                jgoerzen
Assigned To:                
====================================================================== 
Project:                    bacula
Issue ID:                   1359
Category:                   Storage Daemon
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             2009-08-28 22:52 BST
Last Modified:              2009-08-29 15:35 BST
====================================================================== 
Summary:                    Doesn't compile on Alpha
Description: 
During the attempt to autobuild bacula 3 on Debian, this error was
reported:

make[1]: Entering directory
`/build/buildd-bacula_3.0.2-3-alpha-1PG1hy/bacula-3.0.2/debian/tmp-build-sqlite3/src/stored'
Compiling dev.c
dev.c: In member function 'void DEVICE::init_backend()':
dev.c:307: error: invalid conversion from 'int (*)(int, long unsigned int,
...)throw ()' to 'int (*)(int, int, ...)'
make[1]: *** [dev.o] Error 1
make[1]: Leaving directory
`/build/buildd-bacula_3.0.2-3-alpha-1PG1hy/bacula-3.0.2/debian/tmp-build-sqlite3/src/stored'
make: *** [build-stamp-sqlite3] Error 2

The full error log is available at
https://buildd.debian.org/fetch.cgi?pkg=bacula;ver=3.0.2-3;arch=alpha;stamp=1251420917

The line of source in question is

      d_ioctl = ::ioctl;

Version 2.4.4 successfully built on this platform.
====================================================================== 

---------------------------------------------------------------------- 
 (0004556) ebollengier (administrator) - 2009-08-29 07:47
 http://bugs.bacula.org/view.php?id=1359#c4556 
---------------------------------------------------------------------- 
We have a specific define for Alpha that maps ioctl argument to int. Does
it mean that it should be mapped to long unsigned int ? Or it's a different
architecture ?

#ifdef __alpha__
#define OSF 1
#undef  ioctl_req_t
#define ioctl_req_t int
#endif 

---------------------------------------------------------------------- 
 (0004557) kern (administrator) - 2009-08-29 09:17
 http://bugs.bacula.org/view.php?id=1359#c4557 
---------------------------------------------------------------------- 
I don't understand why vendors don't simply follow the POSIX standard.  

Eric, for Alpha (and a few other that don't respect standards), the second
argument of an ioctl call is "unsigned int" rather than "int".

The definition you show above should be:

#define ioctl_req_t unsigned int

However, who knows if it is going to break something somewhere else. 

---------------------------------------------------------------------- 
 (0004562) jgoerzen (reporter) - 2009-08-29 14:59
 http://bugs.bacula.org/view.php?id=1359#c4562 
---------------------------------------------------------------------- 
It appears that your #ifdef __alpha__ is for HP Tru64 UNIX (previously
known as OSF/1) running on that platform.  Linux also runs on that
platform, and may have different semantics.

Kern, my reading of the error suggests that it should be 

#define ioctl_req_t long unsigned int

but I may be missing something. 

---------------------------------------------------------------------- 
 (0004563) jgoerzen (reporter) - 2009-08-29 15:02
 http://bugs.bacula.org/view.php?id=1359#c4563 
---------------------------------------------------------------------- 
I should clarify.  It is invalid to infer what OS is being used from what
architecture is in use.  You can't assume that an Alpha is running OSF/1,
as Debian, NetBSD, etc. all run on it as well. 

---------------------------------------------------------------------- 
 (0004565) kern (administrator) - 2009-08-29 15:28
 http://bugs.bacula.org/view.php?id=1359#c4565 
---------------------------------------------------------------------- 
Well, when we are compiling Bacula, we *must* know what OS is running. 
Perhaps it was a mistake for the author to use __alpha__ rather than the
OS. This code was submitted by a user, so I don't exactly know what
OS/platform it was for.

Perhaps if you have the system in front of you, you can figure out what
the correct #ifdefing should be.  In general, it should be something like:

#ifdef HAVE_xxx_OS
...
...
#endif

I suspect that we should leave the current __alpha__ #ifdefing alone and
just add a new one for your case after it.

What is actually used for ioctl_req_t varies a bit, but yes, you are right
in the case of the error you were seeing (and for most of the silly
non-POSIX compatible OSes) it should be:

#define ioctl_req_t unsigned long

For the system in question, I suggest you look in the system header files
for what is really defined rather than relying on the output from g++. 

---------------------------------------------------------------------- 
 (0004568) kern (administrator) - 2009-08-29 15:35
 http://bugs.bacula.org/view.php?id=1359#c4568 
---------------------------------------------------------------------- 
I forgot to mention that you can look in <bacula>/src/config.h after
running ./configure to know which HAVE_XXX_OS is defined. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-08-28 22:52 jgoerzen       New Issue                                    
2009-08-29 07:47 ebollengier    Note Added: 0004556                          
2009-08-29 07:47 ebollengier    Status                   new => feedback     
2009-08-29 09:17 kern           Note Added: 0004557                          
2009-08-29 14:59 jgoerzen       Note Added: 0004562                          
2009-08-29 15:02 jgoerzen       Note Added: 0004563                          
2009-08-29 15:28 kern           Note Added: 0004565                          
2009-08-29 15:35 kern           Note Added: 0004568                          
======================================================================



--- End Message ---

Reply via email to