Bug 4960 - Fails to compile on QNX
Summary: Fails to compile on QNX
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.4.0
Hardware: x86 Other
: P3 trivial
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-07 12:51 UTC by Matt Kraai (mail address dead)
Modified: 2009-09-19 11:34 UTC (History)
1 user (show)

See Also:
bjacke: review+
gd: review+


Attachments
Patch (5.69 KB, patch)
2007-09-07 12:52 UTC, Matt Kraai (mail address dead)
no flags Details
Patch (4.43 KB, text/x-patch)
2009-06-29 15:59 UTC, Matt Kraai (mail address dead)
no flags Details
Patch (4.98 KB, patch)
2009-07-01 12:44 UTC, Matt Kraai (mail address dead)
no flags Details
Patch to not redefine _INT32 (1.42 KB, patch)
2009-07-01 14:42 UTC, Matt Kraai (mail address dead)
metze: review+
Details
Patch to define _LARGEFILE64_SOURCE on QNX (715 bytes, patch)
2009-07-01 14:51 UTC, Matt Kraai (mail address dead)
metze: review+
Details
Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ (5.98 KB, patch)
2009-08-25 23:28 UTC, Matt Kraai (mail address dead)
metze: review-
Details
Do not redefine strupr (1.30 KB, patch)
2009-08-26 16:55 UTC, Matt Kraai (mail address dead)
no flags Details
Do not redefine strupr for v3-4-test (1.52 KB, patch)
2009-09-08 16:13 UTC, Stefan Metzmacher
metze: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Kraai (mail address dead) 2007-09-07 12:51:46 UTC
There are two problems that prevent Samba from compiling on QNX.  First, tr does not interpret "\n" correctly, which causes mkproto.h to hang because proto_src is empty, so awk hangs trying to read from standard input.  This can be resolved by using "\012" instead.  Second, it does not provide the uint type, which is used in various places.  I'll provide a patch shortly which fixes both of these issues.
Comment 1 Matt Kraai (mail address dead) 2007-09-07 12:52:17 UTC
Created attachment 2920 [details]
Patch
Comment 2 Matt Kraai (mail address dead) 2009-06-29 15:59:45 UTC
Created attachment 4366 [details]
Patch

To build Samba 3.3.6 on QNX 6.4.1, the only changes required are to replace occurrences of uint with unsigned, as done by this patch.
Comment 3 Matt Kraai (mail address dead) 2009-07-01 12:44:20 UTC
Created attachment 4385 [details]
Patch

The attached patch has been generated against the latest version of Samba in the Git repository.
Comment 4 Matt Kraai (mail address dead) 2009-07-01 14:42:25 UTC
Created attachment 4386 [details]
Patch to not redefine _INT32

When Samba is compiled, the compiler complains for almost every source file that _INT32 is redefined.  This patch makes includes.h define it only if it hasn't already been defined.

The comment for this macro definition indicates that the definition is necessary to work around a compile issue on HP-UX 11.x, but it doesn't indicate whether a patch of this type would be acceptable and I don't have access to such a system.
Comment 5 Matt Kraai (mail address dead) 2009-07-01 14:51:39 UTC
Created attachment 4387 [details]
Patch to define _LARGEFILE64_SOURCE on QNX

If _LARGEFILE64_SOURCE is not defined, the system headers don't declare fopen64 or readdir64.  When lib/system.c is compiled, it expects their return values to be pointers.  Since there aren't any prototypes, their return values default to int and the compiler warns about the mismatch.

This patch defines _LARGEFILE64_SOURCE on QNX to avoid this problem.
Comment 6 Björn Jacke 2009-07-03 04:53:42 UTC
patches from comment #4 and comment #5 are in master now, thanks.

still open is the uint/unsigned thing - maybe we need to find a better way to fix that.
Comment 7 Matt Kraai (mail address dead) 2009-07-06 10:54:53 UTC
(In reply to comment #6)
> patches from comment #4 and comment #5 are in master now, thanks.

Thanks.

> still open is the uint/unsigned thing - maybe we need to find a better way to
> fix that.

The other way I've thought of fixing this is to define (either via the preprocessor or using a typedef) uint if it's not provided by the OS, but this seems more complex and fragile.  If this it what you'd prefer, I can try to prepare a patch.
Comment 8 Björn Jacke 2009-07-07 17:00:05 UTC
the uint compile problem is fixed, too (a28596964b4)

Matt asked if this could go into 3.4. I think merging the following patches are  uncritical and apropriate to make 3.4 compile well on QNX, too:

0b06aa23049f s3:configure: define _LARGEFILE64_SOURCE on QNX

dcf03b9d431b do not redefine _INT32

a28596964b44 s3: QNX doesn't know uint - replace with uint_t

Karolin, I hand this over to you.
Comment 9 Matt Kraai (mail address dead) 2009-07-07 17:27:48 UTC
(In reply to comment #8)
> 0b06aa23049f s3:configure: define _LARGEFILE64_SOURCE on QNX
> 
> dcf03b9d431b do not redefine _INT32
> 
> a28596964b44 s3: QNX doesn't know uint - replace with uint_t

Just to be clear, a28596964b44 is the only patch that's required to allow Samba to build on QNX.  The other two patches, while nice to have, just eliminate warnings.
Comment 10 Karolin Seeger 2009-07-18 01:13:49 UTC
Michael, could you review the patch(es), please?

I would prefer to pick a28596964b44 only, what do you think?

Thanks!
Comment 11 Matt Kraai (mail address dead) 2009-08-25 23:28:45 UTC
Created attachment 4596 [details]
Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ

Samba 4 currently fails to build on QNX 6.4.1 because it can't build strptime.ho (cf. http://build.samba.org/?function=View+Build;host=qnx18;tree=samba_4_0_test;compiler=gcc).  This patch fixes that problem by prepending "$libreplacedir/" to strptime.o in LIBREPLACEOBJ, as is done for the objects that do build successfully.  It also makes similar changes for the rest of the libreplace object files so that they'll build on platforms that need them.
Comment 12 Matt Kraai (mail address dead) 2009-08-25 23:32:07 UTC
(In reply to comment #11)
> Created an attachment (id=4596) [details]
> Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ
> 
> Samba 4 currently fails to build on QNX 6.4.1 because it can't build
> strptime.ho (cf.
> http://build.samba.org/?function=View+Build;host=qnx18;tree=samba_4_0_test;compiler=gcc).
>  This patch fixes that problem by prepending "$libreplacedir/" to strptime.o in
> LIBREPLACEOBJ, as is done for the objects that do build successfully.  It also
> makes similar changes for the rest of the libreplace object files so that
> they'll build on platforms that need them.

To reproduce this problem on a system that has a working strptime, modify main in lib/replace/test/strptime.c so that it always returns 1.
Comment 13 Matt Kraai (mail address dead) 2009-08-26 16:55:19 UTC
Created attachment 4599 [details]
Do not redefine strupr

The latest Samba 3 on the master branch fails to build on QNX 6.4.1 because the definition of strupr in source3/libaddns/dnsgss.c conflicts with a declaration in /usr/include/string.h.  This patch fixes this by checking whether strupr is provided and, if it is, not redefining it.
Comment 14 Guenther Deschner 2009-09-02 06:13:27 UTC
Comment on attachment 4596 [details]
Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ

Metze, could you please review this patch and the comment #11 ? I think this could resolve many issues on the buildfarm.
Comment 15 Karolin Seeger 2009-09-08 08:15:57 UTC
Is there a chance to get that into 3.4.1?
Comment 16 Stefan Metzmacher 2009-09-08 16:08:31 UTC
Comment on attachment 4596 [details]
Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ

We have this in configure.in:

LIBREPLACE_OBJS=""
for obj in ${LIBREPLACEOBJ}; do
»·······LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}"
done
AC_SUBST(LIBREPLACE_OBJS)

I don't understand why this would be needed in 3.4.x

metze
Comment 17 Stefan Metzmacher 2009-09-08 16:13:17 UTC
Created attachment 4662 [details]
Do not redefine strupr for v3-4-test

This patch avoids the need of manual conflict resolving...
Comment 18 Stefan Metzmacher 2009-09-08 16:23:35 UTC
Comment on attachment 4386 [details]
Patch to not redefine _INT32

Please cherry pick
0b06aa23049f49b985432c6b18c8a888a079eca1
Comment 19 Stefan Metzmacher 2009-09-08 16:24:50 UTC
Comment on attachment 4387 [details]
Patch to define _LARGEFILE64_SOURCE on QNX

Please cherry-pick
0b06aa23049f49b985432c6b18c8a888a079eca1
Comment 20 Stefan Metzmacher 2009-09-08 16:26:41 UTC
Comment on attachment 4386 [details]
Patch to not redefine _INT32

Please cherry-pick
dcf03b9d431bf5733bde76143da7405650ba119a

sorry, I've pasted the wrong commit for this patch before...
Comment 21 Matt Kraai (mail address dead) 2009-09-09 10:45:41 UTC
(In reply to comment #16)
> (From update of attachment 4596 [details])
> We have this in configure.in:
> 
> LIBREPLACE_OBJS=""
> for obj in ${LIBREPLACEOBJ}; do
> »·······LIBREPLACE_OBJS="${LIBREPLACE_OBJS} ${LIBREPLACE_DIR}/${obj}"
> done
> AC_SUBST(LIBREPLACE_OBJS)
> 
> I don't understand why this would be needed in 3.4.x

I've verified that this patch isn't necessary for the 3.4 series.
Comment 22 Björn Jacke 2009-09-14 15:21:03 UTC
The 'Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ' fix is now checked in to master. Thanks Matt! But in the future, please open new bug reports for different problems.
Comment 23 Matt Kraai (mail address dead) 2009-09-15 10:47:40 UTC
(In reply to comment #22)
> The 'Prepend "$libreplacedir/" to all objects in LIBREPLACEOBJ' fix is now
> checked in to master. Thanks Matt! But in the future, please open new bug
> reports for different problems.

Will do.
Comment 24 Björn Jacke 2009-09-15 11:20:41 UTC
... reopen, and review+ for the merge of a28596964b44 to 3.4. Karolin, can you please cherry-pick this one so we can finally close this bug?
Comment 25 Guenther Deschner 2009-09-15 11:23:02 UTC
seems ok, thanks!
Comment 26 Karolin Seeger 2009-09-19 11:34:07 UTC
Pushed, closing out bug report.

Thanks!