Bug 11621 - Failed to compile on AIX 7.1.3 time.h
Summary: Failed to compile on AIX 7.1.3 time.h
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.3.1
Hardware: x64 AIX
: P2 critical (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
: 11214 11839 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-11-26 18:04 UTC by Andreas Paulat
Modified: 2019-01-23 23:04 UTC (History)
8 users (show)

See Also:


Attachments
Header Fille from ../lib/replace/system (2.29 KB, text/plain)
2015-11-26 18:04 UTC, Andreas Paulat
no flags Details
Proposed patch (2.08 KB, patch)
2016-02-22 20:09 UTC, Guillaume Xavier Taillon (mail address dead)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Paulat 2015-11-26 18:04:26 UTC
Created attachment 11624 [details]
Header Fille from ../lib/replace/system

I try to compile Samba 4.3.1 on AIX 7.1.3. Configure was finished successfully but if I compile Samba 4.3.1 I get the following error with time.h:

[ 582/3754] Compiling lib/util/time.c
In file included from ../lib/replace/system/time.h:31:0,
                 from ../lib/util/time.c:25:
../lib/util/time.c: In function 'clock_gettime_mono':
../lib/replace/system/time.h:85:32: error: missing binary operator before token "10"
 #define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC
                                ^
../lib/util/time.c:63:5: note: in expansion of macro 'CUSTOM_CLOCK_MONOTONIC'
 #if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME
     ^
Waf: Leaving directory `/opt/samba-4.3.1/bin'
Build failed:  -> task failed (err #1):
        {task: cc time.c -> time_12.o}
make: The error code from the last command is 1.


Stop.
Comment 1 Guillaume Xavier Taillon (mail address dead) 2016-01-25 22:20:55 UTC
AIX Version: 7100-03-05-1524
XLC Version: 13.01.0003.0000
Samba Version: 4.3.4

This is due to AIX defining CLOCK_* as cast expressions rather than integer constants which breaks

  #if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME

when CUSTOM_CLOCK_MONOTONIC is defined as CLOCK_MONOTONIC or CLOCK_HIGHRES in lib/replace/system/time.h. This was introduced by cf87f8587415df2119995e82ccf51bb64e44115b and there does not seem to be other occurrences of this problem elsewhere.

I'll see if I can get a legal authorization to contribute a patch from my dept.
Comment 2 Andreas Paulat 2016-01-27 09:37:37 UTC
Hi Guillaume,

this would be excellent if you could help me.

Good luck, many thanks in advance and best regards.

Andreas
Comment 3 Christian Ambach 2016-01-27 20:25:56 UTC
Is this the same problem as in Bug 11214?
Comment 4 Guillaume Xavier Taillon (mail address dead) 2016-01-27 21:14:16 UTC
I can't test it but it looks like it is.
Comment 5 Andreas Paulat 2016-01-28 05:55:16 UTC
Hi Christian,

I'm not sure. I have a problem with a preprozessor compare in the header file ../lib/replace/system/time.h. 

Best regards
Andreas
Comment 6 Andreas Paulat 2016-01-28 05:58:02 UTC
Hi Guillaume,

would you like to tell me that there is no solution for it?

Best regards
Andreas
Comment 7 Guillaume Xavier Taillon (mail address dead) 2016-02-22 20:09:33 UTC
Created attachment 11863 [details]
Proposed patch
Comment 8 Guillaume Xavier Taillon (mail address dead) 2016-02-22 20:28:14 UTC
Hi Andreas,
Sorry it took so long, I was waiting for my approvals from corp.

Here's the patch i used to fix this problem. Unfortunately it won't get you very far as there are several more bugs to fix after this one.

Christian,
On my AIX in <time.h>:
  #define CLOCK_MONOTONIC          ((clockid_t) 10)

This is probably what's causing Bug 11214 (missing binary operator before token "10").

Since there are no more aix machines in the build farm, can this patch, and the other ones I'll submit for aix compat. issues, still be integrated into 4-3-* (as long as they don't break other platforms) ?
Comment 9 Christian Ambach 2016-04-15 16:12:41 UTC
*** Bug 11839 has been marked as a duplicate of this bug. ***
Comment 10 Andreas Paulat 2016-04-17 12:00:42 UTC
Hi,

can somebody tell me, what I have to do, that I don't get the error any more?

If I insert the line "#define CLOCK_MONOTONIC          ((clockid_t) 10)" before the following block in ../lib/replace/system/time.h, I get the error at the end of this psoting.

#ifndef HAVE_CLOCK_GETTIME
/* CLOCK_REALTIME is required by POSIX */
#define CLOCK_REALTIME 0
typedef int clockid_t;
int rep_clock_gettime(clockid_t clk_id, struct timespec *tp);
#endif

/* make sure we have a best effort CUSTOM_CLOCK_MONOTONIC we can rely on */
#if defined(CLOCK_MONOTONIC)
#define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC
#elif defined(CLOCK_HIGHRES)
#define CUSTOM_CLOCK_MONOTONIC CLOCK_HIGHRES
#else
#define CUSTOM_CLOCK_MONOTONIC CLOCK_REALTIME
#endif



In file included from ../lib/util/time.c:25:0:
../lib/util/time.c: In function 'clock_gettime_mono':
../lib/replace/system/time.h:77:47: error: missing binary operator before token "10"
 #define CLOCK_MONOTONIC          ((clockid_t) 10)
                                               ^
../lib/replace/system/time.h:88:32: note: in expansion of macro 'CLOCK_MONOTONIC'
 #define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC
                                ^
../lib/util/time.c:63:5: note: in expansion of macro 'CUSTOM_CLOCK_MONOTONIC'
 #if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME
     ^
[ 554/3676] Compiling lib/util/sys_rw.c
Waf: Leaving directory `/opt/samba-4.4.2/bin'
Build failed:  -> task failed (err #1):
        {task: cc time.c -> time_14.o}
make: The error code from the last command is 1.


Many thanks in advance
Andreas
Comment 11 Peter (mail address dead) 2016-05-11 12:30:50 UTC
This also applies to Samba 4.4.3 with xlc compiler 13.1.3
This patch works correctly
Comment 12 Andreas Paulat 2016-05-17 06:31:57 UTC
I have tried to compile Samba 4.4.3 with xlc 13.1.3 and I still get the following error:

Waf: Entering directory `/opt/samba-4.4.3/bin'
    Selected embedded Heimdal build
[ 503/3338] Compiling lib/util/time.c
"../lib/util/time.c", line 63.5: 1506-294 (S) Syntax error in expression on #if directive.
Waf: Leaving directory `/opt/samba-4.4.3/bin'
Build failed:  -> task failed (err #1):
        {task: cc time.c -> time_14.o}
make: The error code from the last command is 1.


Stop.

Line 63 in time.c is the following statment and clolumn 5 is the String CUSTOM_CLOCK_MONOTONIC

/* then try the  monotonic clock: */
#if CUSTOM_CLOCK_MONOTONIC != CLOCK_REALTIME
	if (clock_gettime(CUSTOM_CLOCK_MONOTONIC,tp) == 0) {
		return;
	}
#endif
	clock_gettime(CLOCK_REALTIME,tp);
}

Who can help me? what I have to do?

P.S. Why is it so complicated that nobody give me an answer which helps.

Regards and hoping of a solution
Andreas
Comment 13 Volker Lendecke 2016-05-17 07:56:34 UTC
(In reply to Andreas Paulat from comment #12)

> P.S. Why is it so complicated that nobody give me an answer which helps.

It's not that the fix will be complicated. It's the fact that no developer I know has access to AIX. If we had, this would be fixed very quickly.

Volker
Comment 14 Andreas Paulat 2016-05-17 08:15:21 UTC
Hi Volker,

if it is possible please send me the changes which you like to make and I do it for you on my test AIX.

Best regards,
Andreas
Comment 15 Volker Lendecke 2016-05-17 08:24:50 UTC
(In reply to Andreas Paulat from comment #14)
> if it is possible please send me the changes which you like to make and I do
> it for you on my test AIX.

I'm afraid this is not the way I can do development. I need to take a look at the system, at what is there. If you want this fixed, make a contract with someone including terms that you can allow interactive logon to such a box or get someone on your premises to let her in.

Volker
Comment 16 Andreas Paulat 2016-05-17 08:53:31 UTC
Hi Volker,

it would be possible that you can connect to our Test-AIX with TeamViewer. Would you do this?

Regards,
Andreas
Comment 17 Andreas Paulat 2016-06-07 11:26:53 UTC
Hi Volker,

could you please give me an answer of my last request, so that I know if it is possible or not?

Many thanks and best regards
Andreas
Comment 18 Volker Lendecke 2016-06-07 12:24:25 UTC
(In reply to Andreas Paulat from comment #17)
> could you please give me an answer of my last request, so that I know if it
> is possible or not?

Technically it would of course be possible. But TeamViewer is such a pain in the <whatever> that this is not viable. Also, you definitely want a contract with someone for this, if only for the NDA piece. I would highly recommend to contact IBM to get you up-to-date SMB support for AIX or visit https://www.samba.org/samba/support/ to get build support.

Volker
Comment 19 Albert Chin (temp failure) 2017-06-03 02:39:21 UTC
(In reply to Guillaume Xavier Taillon from comment #7)

I tested this patch on AIX 5.3, 6.1, and 7.1 and it works. Please push.
Comment 20 Björn Jacke 2017-06-13 08:40:09 UTC
thanks, fixed with 67095c76f64c61a5472c0233e44520ccc4eddbc8, will be in 4.7.
Comment 21 Björn Jacke 2019-01-23 23:04:14 UTC
*** Bug 11214 has been marked as a duplicate of this bug. ***