From oetkenky at hotmail.com Mon Jan 4 21:31:16 2010 From: oetkenky at hotmail.com (Kyle Oetken) Date: Tue, 5 Jan 2010 02:31:16 +0000 Subject: [Pymilter] Adding -fPIE optoin when building sendmail srcrpm for RedHat 4 Message-ID: List, I've been workign with pymilter for a few weeks now and seem to have things worked out on Fedora 11. Now, I'm running into problems when trying to install pymilter-0.9.3 on Red Hat EL4 x86_64. I get the follwoing error when trying to install: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DMAX_ML_REPLY=32 -I/usr/local/include/python2.4 -c miltermodule.c -o build/temp.linux-x86_64-2.4/miltermodule.o gcc -pthread -shared build/temp.linux-x86_64-2.4/miltermodule.o -L/usr/lib/libmilter -lmilter -o build/lib.linux-x86_64-2.4/milter.so /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../lib64/libmilter.a(listener.o): relocation R_X86_64_PC32 against `mi_opensocket' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status error: command 'gcc' failed with exit status 1 I noticed the mailing list entry from August regaurding the issue installing on CentOS 5 but I am unable to figure out how to mofify the src rpm .spec file so that sendmail will complie with the -fPIE option. I tried to change the following lines in the .spec file as shown below: %if "%{enable_pie}" == "yes" %ifarch s390 s390 %define _fpie -fPIE %else %define _fpie -fPIE %endif so that _fpie is always set to -fPIE. I've also made sure that the enable_pie variable is set to "yes". Any help you can provide would be appreciated. Thanks, oetkenky -------------- next part -------------- An HTML attachment was scrubbed... URL: From stuart at bmsi.com Mon Jan 4 22:54:26 2010 From: stuart at bmsi.com (Stuart D. Gathman) Date: Mon, 4 Jan 2010 22:54:26 -0500 (EST) Subject: [Pymilter] Adding -fPIE optoin when building sendmail srcrpm for RedHat 4 In-Reply-To: References: Message-ID: On Tue, 5 Jan 2010, Kyle Oetken wrote: > %ifarch s390 s390 > %define _fpie -fPIE > %else > %define _fpie -fPIE > %endif > > > so that _fpie is always set to -fPIE. I've also made sure that the enable_pie variable is set to "yes". Any help you can provide would be appreciated. You probably don't want to set sendmail to PIE in general. Only libmilter is the problem. Here is the patch I added to CentOS5 for sendmail-8.14.3 on x86_64: $ cat sendmail-8.14.3-x86_64.patch diff -up ./libmilter/Makefile.m4.bms ./libmilter/Makefile.m4 --- ./libmilter/Makefile.m4.bms 2008-04-08 01:23:44.000000000 -0400 +++ ./libmilter/Makefile.m4 2009-08-21 16:13:53.000000000 -0400 @@ -10,6 +10,7 @@ SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSR PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ') bldPRODUCT_START(`library', `libmilter') +define(`confOPTIMIZE', `-O2 -g -m64 -mtune=generic -fPIC') define(`bldINSTALLABLE', `true') define(`LIBMILTER_EXTRAS', `errstring.c strl.c') APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf') -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From stuart at bmsi.com Mon Jan 4 23:00:47 2010 From: stuart at bmsi.com (Stuart D. Gathman) Date: Mon, 4 Jan 2010 23:00:47 -0500 (EST) Subject: [Pymilter] Adding -fPIE optoin when building sendmail srcrpm for RedHat 4 In-Reply-To: References: Message-ID: On Mon, 4 Jan 2010, Stuart D. Gathman wrote: > You probably don't want to set sendmail to PIE in general. Only libmilter > is the problem. Here is the patch I added to CentOS5 for sendmail-8.14.3 The packager of sendmail envisioned static C milter applications linking against libmilter, and optimized for that. Pymilter, as a python extension, is a dynamic library, and libmilter must be compiled appropriately. This should not hurt static C milters (other than being ever so immeasurably slightly slower). -- Stuart D. Gathman Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flammis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. From oetkenky at hotmail.com Tue Jan 5 18:25:36 2010 From: oetkenky at hotmail.com (Kyle Oetken) Date: Tue, 5 Jan 2010 23:25:36 +0000 Subject: [Pymilter] Adding -fPIE optoin when building sendmail srcrpm for RedHat 4 In-Reply-To: References: , Message-ID: Stuart, Thanks. I've got my milter working. For future reference I'm using RHEL 4 x86_64. I order to get the pymilter working I added the following line to the ./libmilter/Makefile.m4 file: define(`confOPTIMIZE', `-O2 -g -m64 -fPIC') I had to remove the mtune option in order to patch sendmail and recompile the src rpm successfully. Thanks for responding so promptly. I appreciate your work on the pymilter module. Thanks, Kyle Oetken > Date: Mon, 4 Jan 2010 22:54:26 -0500 > From: stuart at bmsi.com > To: oetkenky at hotmail.com > CC: pymilter at bmsi.com > Subject: Re: [Pymilter] Adding -fPIE optoin when building sendmail srcrpm for RedHat 4 > > On Tue, 5 Jan 2010, Kyle Oetken wrote: > > > %ifarch s390 s390 > > %define _fpie -fPIE > > %else > > %define _fpie -fPIE > > %endif > > > > > > so that _fpie is always set to -fPIE. I've also made sure that the enable_pie variable is set to "yes". Any help you can provide would be appreciated. > > You probably don't want to set sendmail to PIE in general. Only libmilter > is the problem. Here is the patch I added to CentOS5 for sendmail-8.14.3 > on x86_64: > > $ cat sendmail-8.14.3-x86_64.patch > diff -up ./libmilter/Makefile.m4.bms ./libmilter/Makefile.m4 > --- ./libmilter/Makefile.m4.bms 2008-04-08 01:23:44.000000000 -0400 > +++ ./libmilter/Makefile.m4 2009-08-21 16:13:53.000000000 -0400 > @@ -10,6 +10,7 @@ SMSRCDIR=ifdef(`confSMSRCDIR', `confSMSR > PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ') > > bldPRODUCT_START(`library', `libmilter') > +define(`confOPTIMIZE', `-O2 -g -m64 -mtune=generic -fPIC') > define(`bldINSTALLABLE', `true') > define(`LIBMILTER_EXTRAS', `errstring.c strl.c') > APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf') > > -- > Stuart D. Gathman > Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 > "Confutatis maledictis, flammis acribus addictis" - background song for > a Microsoft sponsored "Where do you want to go from here?" commercial. -------------- next part -------------- An HTML attachment was scrubbed... URL: