Bug 6721 - Cannot compile RHEL rpms using samba 3.4.x series source
Cannot compile RHEL rpms using samba 3.4.x series source
Status: RESOLVED FIXED
Product: Samba 3.4
Classification: Unclassified
Component: Packaging
3.4.1
x86 Linux
: P3 normal
: ---
Assigned To: Björn Jacke
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-14 07:29 UTC by Eero Volotinen
Modified: 2009-10-18 23:59 UTC (History)
3 users (show)

See Also:


Attachments
Samba 3.4.1 patch to samba.spec file under RHEL directory to properly generate rpm. (1.97 KB, patch)
2009-10-15 17:14 UTC, Barry Sabsevitz
no flags Details
Changes to makerpms.sh to allow rpm generation on Samba 3.4.1 (227 bytes, patch)
2009-10-15 17:16 UTC, Barry Sabsevitz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eero Volotinen 2009-09-14 07:29:03 UTC
Looks like there is bug in samba packaging system, since it is impossible to rebuild samba rpms under RHEL 4, RHEL 5 (and centos 4,5) systems.

/usr/src/redhat/SOURCES/samba-3.4.1/packaging/RHEL

sh ./makerpms.sh

./makerpms.sh: line 43: cd: ../../source: No such file or directory 

--cut--
+ make pch
rm -f /usr/src/redhat/BUILD/samba-3.4.1/source3/include/includes.h.gch
make /usr/src/redhat/BUILD/samba-3.4.1/source3/include/includes.h.gch
make[1]: Entering directory `/usr/src/redhat/BUILD/samba-3.4.1/source3'
ccache gcc -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -I. -I/usr/src/redhat/BUILD/samba-3.4.1/source3 -I/usr/src/redhat/BUILD/samba-3.4.1/source3/iniparser/src -Iinclude -I./include  -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -DHAVE_CONFIG_H  -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -Iinclude -I./include -I. -I. -I./../lib/replace -I./../lib/talloc -I./../lib/tevent -I./../lib/tdb/include -I./libaddns -I./librpc -I./.. -I./../lib/popt -DLDAP_DEPRECATED  -I/usr/src/redhat/BUILD/samba-3.4.1/source3/lib -I.. -I../source4 -D_SAMBA_BUILD_=3 -D_SAMBA_BUILD_=3 -fPIC -c /usr/src/redhat/BUILD/samba-3.4.1/source3/include/includes.h -o /usr/src/redhat/BUILD/samba-3.4.1/source3/include/includes.h.gch
make[1]: Leaving directory `/usr/src/redhat/BUILD/samba-3.4.1/source3'
+ make 'CFLAGS=-O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE' -j2 all modules pam_smbpass
Using CFLAGS     = -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE
mkdir bin
      PICFLAG    = -fPIC
      LIBS       = -lresolv -lresolv -lnsl -ldl
      LDFLAGS    = -pie -Wl,-z,relro -L./bin
      DYNEXP     = -Wl,--export-dynamic
      LDSHFLAGS  = -shared -Wl,-Bsymbolic -Wl,-z,relro -L./bin
Compiling ../lib/talloc/talloc.c
      SHLIBEXT   = so
      SONAMEFLAG = -Wl,-soname=
Compiling ../lib/replace/replace.c
../lib/talloc/talloc.c:50:21: error: replace.h: No such file or directory
In file included from ../lib/replace/replace.c:25:
../lib/replace/replace.h:32:20: error: config.h: No such file or directory
../lib/talloc/talloc.c: In function ‘_talloc_realloc’:
../lib/talloc/talloc.c:987: error: ‘bool’ undeclared (first use in this function)
../lib/talloc/talloc.c:987: error: (Each undeclared identifier is reported only once
../lib/talloc/talloc.c:987: error: for each function it appears in.)
../lib/talloc/talloc.c:987: error: expected ‘;’ before ‘malloced’
../lib/talloc/talloc.c:1035: error: ‘malloced’ undeclared (first use in this function)
../lib/talloc/talloc.c:1035: error: ‘true’ undeclared (first use in this function)
../lib/talloc/talloc.c:1039: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/talloc/talloc.c: In function ‘_talloc_zero’:
../lib/talloc/talloc.c:1334: warning: incompatible implicit declaration of built-in function ‘memset’
../lib/talloc/talloc.c: In function ‘_talloc_memdup’:
../lib/talloc/talloc.c:1348: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/talloc/talloc.c: In function ‘__talloc_strlendup’:
../lib/talloc/talloc.c:1361: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/talloc/talloc.c: In function ‘talloc_strdup’:
../lib/talloc/talloc.c:1374: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/talloc/talloc.c: In function ‘__talloc_strlendup_append’:
../lib/talloc/talloc.c:1395: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/talloc/talloc.c: In function ‘talloc_strdup_append’:
../lib/talloc/talloc.c:1415: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/talloc/talloc.c: In function ‘talloc_strdup_append_buffer’:
../lib/talloc/talloc.c:1439: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/talloc/talloc.c: In function ‘talloc_strndup_append’:
../lib/talloc/talloc.c:1455: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/talloc/talloc.c:1486:1: warning: "va_copy" redefined
In file included from ../lib/talloc/talloc.h:30,
                 from ../lib/talloc/talloc.c:51:
/usr/lib/gcc/i386-redhat-linux/4.1.2/include/stdarg.h:54:1: warning: this is the location of the previous definition
../lib/talloc/talloc.c: In function ‘talloc_vasprintf_append’:
../lib/talloc/talloc.c:1580: warning: incompatible implicit declaration of built-in function ‘strlen’
The following command failed:
ccache gcc -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -c ../lib/talloc/talloc.c -o ../lib/talloc/talloc.o
In file included from ../lib/replace/replace.c:25:
../lib/replace/replace.h:125: error: conflicting types for ‘sys_errlist’
/usr/include/bits/sys_errlist.h:28: error: previous declaration of ‘sys_errlist’ was here
../lib/replace/replace.c:54:2: error: #error "you must have a ftruncate function"
../lib/replace/replace.c: In function ‘rep_strlcpy’:
../lib/replace/replace.c:65: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c:69: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c: In function ‘rep_strlcat’:
../lib/replace/replace.c:81: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c:92: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c: In function ‘rep_memmove’:
../lib/replace/replace.c:239: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c: In function ‘rep_strdup’:
../lib/replace/replace.c:293: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c:296: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c: In function ‘rep_strndup’:
../lib/replace/replace.c:351: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c:371:4: error: #error "You need a seteuid function"
../lib/replace/replace.c:382:4: error: #error "You need a setegid function"
../lib/replace/replace.c: In function ‘rep_strcasestr’:
../lib/replace/replace.c:461: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c:465: error: ‘uintptr_t’ undeclared (first use in this function)
../lib/replace/replace.c:465: error: (Each undeclared identifier is reported only once
../lib/replace/replace.c:465: error: for each function it appears in.)
../lib/replace/replace.c:465: error: expected ‘)’ before ‘s’
../lib/replace/replace.c: In function ‘rep_strtok_r’:
../lib/replace/replace.c:480: warning: incompatible implicit declaration of built-in function ‘strspn’
../lib/replace/replace.c:487: warning: incompatible implicit declaration of built-in function ‘strpbrk’
../lib/replace/replace.c:489: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c: In function ‘rep_setenv’:
../lib/replace/replace.c:541: warning: incompatible implicit declaration of built-in function ‘strlen’
../lib/replace/replace.c:548: warning: incompatible implicit declaration of built-in function ‘memcpy’
../lib/replace/replace.c: In function ‘rep_unsetenv’:
../lib/replace/replace.c:566: warning: incompatible implicit declaration of built-in function ‘strlen’
The following command failed:
ccache gcc -O2 -g -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -c ../lib/replace/replace.c -o ../lib/replace/replace.o
make: *** [../lib/talloc/talloc.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [../lib/replace/replace.o] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.6948 (%build)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.6948 (%build)
makerpms.sh: Done.

replace.h missing? 

find . -name "replace.h" -print in (/usr/src/redhat/SOURCES/samba-3.4.1)
./lib/replace/replace.h

Thanks,
Eero
Comment 1 Eero Volotinen 2009-09-14 07:32:55 UTC
I think that also affects on x86_64 environment.

affected OS:

- rhel 4, rhel 5 (and clones like centos)
Comment 4 Björn Jacke 2009-09-30 06:54:31 UTC
this one looks like a dup and should be fixed with 3.4.2.

*** This bug has been marked as a duplicate of bug 6742 ***
Comment 5 Barry Sabsevitz 2009-10-02 16:30:57 UTC
We also hit this problem. We dug into it a big and it looked like this problem was due to the redeclaration of CFLAGS in the samba.spec file on the line issuing the make all. This occurred in the samba.spec file for both Samba 3.4.0 and Samba 3.4.1. This redeclaration eliminates the -I options that were previously set in the CFLAGS and causes the compile errors that are seen above. Removing the setting of CFLAGS from that line in the samba.spec file fixed the problem for us. 
Comment 6 Eero Volotinen 2009-10-03 04:17:08 UTC
not same issue.
Comment 7 Eero Volotinen 2009-10-03 14:44:51 UTC
(In reply to comment #5)
> We also hit this problem. We dug into it a big and it looked like this problem
> was due to the redeclaration of CFLAGS in the samba.spec file on the line
> issuing the make all. This occurred in the samba.spec file for both Samba 3.4.0
> and Samba 3.4.1. This redeclaration eliminates the -I options that were
> previously set in the CFLAGS and causes the compile errors that are seen above.
> Removing the setting of CFLAGS from that line in the samba.spec file fixed the
> problem for us. 
> 

patch?
Comment 8 Björn Jacke 2009-10-05 16:02:57 UTC
Barry ist right, calling make and throw away the CFLAGS that had been fiddled out by configure is not the best idea. The spec file in this directory is not being actively used by any of the Samba developers, it's saver (better tested) to use the spec files from Red Hat, SuSE or SerNet. Because errors like this are sometimes not found or not even noticed for months - we already discussed to remove the spec from the packging directory and replace it with a readme pointing to the distributor packackes for this reason.

Can someone with knowledge about gcc's pch have another look at this problem?
Comment 9 Barry Sabsevitz 2009-10-07 21:27:11 UTC
Sorry was out of town and just saw this thread. If you would still like a patch, please let me know and we can try to provide one. There are a bunch more problems in the spec file beyond this make line clobbering the CFLAGS. The install part of the spec file is missing a bunch of file entries along with a few of them referring to "source" rather than the "source3" directory. This will cause the rpm generation to fail after the build completes. I'll leave it up to you folks as to whether you would like our patch for this or whether this file is going to be obsoleted. We are able to build an RPM successfully now using the makerpms.sh script with the above mentioned changes and a 1 line change to the makerpms.sh script itself (it also refers to source rather than source3 directory).
Comment 10 Jeremy Allison 2009-10-07 22:45:34 UTC
Yes please, patches always welcome !
Jeremy.
Comment 11 Barry Sabsevitz 2009-10-12 19:10:56 UTC
Ok will do. Will try to work on the patches this week. Thanks Jeremy!
Comment 12 Barry Sabsevitz 2009-10-15 17:14:29 UTC
Created attachment 4857 [details]
Samba 3.4.1 patch to samba.spec file under RHEL directory to properly generate rpm.

This attachment is my proposed patch to allow the Samba 3.4.1. rpm generation to work properly with the samba.spec file. This also requires a change to the makerpms.sh file which is included as a different patch. With this patch, I was able to build a Samba RPM using the makerpms.sh script underneath the packaging/RHEL directory.
Comment 13 Barry Sabsevitz 2009-10-15 17:16:54 UTC
Created attachment 4858 [details]
Changes to makerpms.sh to allow rpm generation on Samba 3.4.1

This 1 line change to makerpms.sh is required along with the changes to the samba.spec patch attached to build an rpm using the samba.spec file. I was able to build an rpm with these two patches. This patch applies to the makerpms.sh file that exists in the packaging/RHEL directory.
Comment 14 Barry Sabsevitz 2009-10-15 17:17:50 UTC
I uploaded the two patches that resolved this problem for us. The makerpms.sh patch and the samba.spec file patch are for the files located in the directory packaging/RHEL.
Comment 15 Karolin Seeger 2009-10-16 09:09:45 UTC
Pushed. The patch will be included in the next 3.4 bug fix release.
Oh, I just noticed, that the reporter got the credits in the commit message instead of you, Barry! I am really sorry for that!

Closing out bug report.

Thanks a lot for providing the patches, Barry! :-)
Comment 16 Barry Sabsevitz 2009-10-18 23:59:17 UTC
No problem at all. Glad to help. Thanks.