Bug 1823134 - Review Request: GnuCOBOL - GnuCOBOL is a free implementation of the COBOL programming language.
Summary: Review Request: GnuCOBOL - GnuCOBOL is a free implementation of the COBOL pro...
Keywords:
Status: CLOSED DUPLICATE of bug 1823419
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Nobody's working on this, feel free to take it
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-11 21:53 UTC by Ron Olson
Modified: 2020-04-13 16:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-13 15:59:26 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
My spec for reference (2.38 KB, text/x-rpm-spec)
2020-04-13 15:38 UTC, Gwyn Ciesla
no flags Details

Description Ron Olson 2020-04-11 21:53:08 UTC
Spec URL: https://tachoknight.fedorapeople.org/cobol-lang/cobol-lang.spec
SRPM URL: https://tachoknight.fedorapeople.org/cobol-lang/GnuCOBOL-2.2-1.fc31.src.rpm
Description: GnuCOBOL is a free implementation of the COBOL programming language.
Fedora Account System Username: tachoknight

Comment 1 Ron Olson 2020-04-11 21:53:56 UTC
Rawhide scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=43250184

Comment 2 Artur Frenszek-Iwicki 2020-04-12 16:57:04 UTC
>%global debug_package %{nil}
This is hardly ever needed. If your rpmbuild is failing due to debuginfo missing from the executables, then you need to enable debuginfo generation during build.
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_debuginfo_packages

>Source0:        http://ftp.gnu.org/gnu/gnucobol/gnucobol-2.2.tar.gz
You can use %{version} as part of the URL so you don't have to edit this line every time.

>./configure --prefix=/usr --libdir=%{_libdir}
You should probably use %configure here. It sets up both --prefix and --libdir correctly, and will also make sure Fedora's CFLAGS/LDFLAGS are applied (which will may fix the missing debuginfo issue).

>%files
>%{_includedir}/libcob.h
>%{_includedir}/libcob
>%{_libdir}/libcob.so
>%{_libdir}/libcob.a
These should probably be separated into some -devel or -libs-devel subpackage.

>%{_datadir}/locale/de/LC_MESSAGES/gnucobol.mo                                                                                                                
>%{_datadir}/locale/en@boldquot/LC_MESSAGES/gnucobol.mo                                                                                                       
>%{_datadir}/locale/en@quot/LC_MESSAGES/gnucobol.mo                                                                                                           
>%{_datadir}/locale/es/LC_MESSAGES/gnucobol.mo                                                                                                                
>%{_datadir}/locale/it/LC_MESSAGES/gnucobol.mo                                                                                                                
>%{_datadir}/locale/ja/LC_MESSAGES/gnucobol.mo
>%{_datadir}/locale/nl/LC_MESSAGES/gnucobol.mo
>%{_datadir}/locale/pt/LC_MESSAGES/gnucobol.mo
You can use a wildcard here: "%{_datadir}/locale/**/LC_MESSAGES/gnucobol.mo".

>%{_mandir}/man1/cobc.1.gz
>%{_mandir}/man1/cobcrun.1.gz
Do not assume that man pages will be gzipped. Use a wildcard that can match any compression method (including no compression at all).
https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages

Comment 3 Ron Olson 2020-04-12 18:21:05 UTC
Hey Artur-

Thanks for taking a look. I did have %configure initially, but when using that, the build fails because some of the extra flags that are added:

COB_CFLAGS = -I/usr/include -Wno-unused -fsigned-char -Wno-pointer-sign -pipe -Wall -Werror=format-security -Wp, -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -strong record-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fstack-clash-protection -fcf-protection -pipe

Specifically, note that it's trying to pass "-strong record-gcc-switches", and doesn't understand the '-strong' flag and has no idea what to do with 'record-gcc-switches':

make[2]: Entering directory '/home/rolson/rpmbuild/BUILD/gnucobol-2.2/extras'
. ../tests/atconfig && . ../tests/atlocal extras-CBL_OC_DUMP.so \
	&& $COBC -m -Wall -O -o CBL_OC_DUMP.so CBL_OC_DUMP.cob
gcc: error: record-gcc-switches: No such file or directory
gcc: error: unrecognized command line option '-strong'
make[2]: *** [Makefile:578: CBL_OC_DUMP.so] Error 1


Also, interestingly enough, if I don't have %global debug_package %{nil} at the top of the file, I get this error at the end of packaging:

error: Empty %files file /home/rolson/rpmbuild/BUILD/gnucobol-2.2/debugsourcefiles.list

A bit of searching suggests that having %global debug_package %{nil} is the solution; I can confirm that it does package with the line.

I made the other suggestions, including creating a -devel package for the headers and libs

I have updated the latest spec and SRPM file

Comment 4 Artur Frenszek-Iwicki 2020-04-12 22:35:34 UTC
Fedora's CFLAGS include "-fstack-protector-strong -grecord-gcc-switches". It's possible that the upstream autoconf/automake script is subtly broken and mangles the CFLAGS somewhere along the way to produce "-strong record-gcc-switches".

Comment 5 Artur Frenszek-Iwicki 2020-04-12 22:54:18 UTC
After some investigation: yep, that's the case. Look at line 18504 and beyond in the configure file (the pre-processed one, not the autoconf one). Inside you'll find this little thing:

># Include CFLAGS / CPPFLAGS in COB_CFLAGS without optimization/debug options.
>if test "x$CFLAGS" != "x"; then
>	cob_temp_flags="$CFLAGS"
>else
>	cob_temp_flags=""
>fi
>if test "x$CPPFLAGS" != "x"; then
>	if test "x$cob_temp_flags" != "x"; then
>		cob_temp_flags="$CPPFLAGS $cob_temp_flags"
>	else
>		cob_temp_flags="$CPPFLAGS"
>	fi
>fi
>if test "x$cob_temp_flags" != "x"; then
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-g3//' -e 's/-g//' -e 's/ $//' -e 's/^ //'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/[+-]O[0-9s]//' -e 's/ $//' -e 's/^ //'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-O//' -e 's/ $//' -e 's/^ //'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fmessage-length=0//'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-D_FORTIFY_SOURCE=.//'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fstack-protector//'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-funwind-tables//'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/-fasynchronous-unwind-tables//'`
>	cob_temp_flags=`echo "$cob_temp_flags" | sed -e 's/  */ /g' -e 's/ $//' -e 's/^ //'`
>fi

The configure script is trying to create COB_FLAGS, based on CFLAGS and remove some unwated options, but because the regexes are not specified to match on a word boundary, it ends up mangling the options and producing stuff that the compiler rejects.

Comment 6 Ron Olson 2020-04-13 02:59:52 UTC
Hey, thanks for digging into the problem! I figured out which of the lines, specifically, was mangling the output and replaced them with a patch; it now builds correctly with %configure. I've updated the spec and SRPM.

Comment 7 Artur Frenszek-Iwicki 2020-04-13 11:43:05 UTC
I wanted to try and build the package locally, but I get a 404 when I try to fetch the SRPM.

>Also, interestingly enough, if I don't have %global debug_package %{nil} at the top of the file, I get this error at the end of packaging:
>error: Empty %files file /home/rolson/rpmbuild/BUILD/gnucobol-2.2/debugsourcefiles.list
That's because by default, rpmbuild tries to also create a debuginfo package. Adding "%global debug_package %{nil}" disables debuginfo generation. In Fedora, we typically want debuginfo to be generated, so once again, I urge you to enable debuginfo generation and try to get the package to build with debuginfo.

>%package devel
>Provides:   %{name}-devel = %{version}-%{release}
The Provides is unnecessary.

>%configure --prefix=/usr --libdir=%{_libdir}
Now that you use %configure, you can drop --prefix and --libdir - %configure sets them up appropriately.

Also, looking at files - everything related to libcob has been moved to the -devel subpackage. An important question now is: can cobc run without the -devel subpackage installed? Can cobc-generated programs run? If not, you'll need to add a Requires: on the -devel subpackage to the main package.

Continuing the library topic, I was personally thinking of something more along the lines of:
- GnuCobol - cobc and related stuff
- GnuCobol-libs - libcob, the versioned .so files
- GnuCobol-libs-devel - unversioned libcob and includes

I haven't really done much work when it comes to packaging libraries, so you may want to take all of this with a grain of salt. It'll probably be a good idea to ask someone more experienced in Fedora packaging to come and take a look.

Comment 8 Ron Olson 2020-04-13 14:35:37 UTC
Hi Artur-

Sorry, I changed the package name to be more Fedora-friendly. The SRPM is at https://tachoknight.fedorapeople.org/cobol-lang/gnucobol-2.2-1.fc31.src.rpm.

The package requires all the files to work properly. For runtime, the libcob.so.4 library is necessary, along with the other libraries in %Requires. I guess I don't understand the need for the -devel subpackage, a -runtime seems more appropriate to run Cobol-compiled binaries. 

The %configure macro doesn't include -g in the CFLAGS, so the debuginfo list isn't built. Honestly I'm not sure what purpose the debuginfo provides.

Comment 9 Artur Frenszek-Iwicki 2020-04-13 14:52:58 UTC
Snooping around the configure script once again, you can pass "--enable-debug" to %configure to make the script leave the -g switch alone. No idea why upstream made the script so adamant to remove it.

>Honestly I'm not sure what purpose the debuginfo provides.
debuginfo is extracted from the executables/libraries and put inside -debuginfo packages. You can install a debuginfo package and use it to, well, debug a program/library installed from the Fedora repositories.

Comment 10 Ron Olson 2020-04-13 14:59:50 UTC
Ah, that did the trick! I have uploaded the new spec file and SRPM to https://tachoknight.fedorapeople.org/cobol-lang/. 

What do you think of my -devel question; I figure that since the whole package is just a Cobol compiler, I don't see what an additional -devel Subpackages provides; I can see a -runtime for the one library, but I guess I just don't see why we need -devel.

Comment 11 Gwyn Ciesla 2020-04-13 15:36:29 UTC
Was just packaging this myself and thought to search bugzilla before submitting my own review. :)

I don't think a -devel package is needed for a compiler.

Comment 12 Gwyn Ciesla 2020-04-13 15:37:09 UTC
Upstream indicates 3.0-rc1 is more stable than 2.2, I'd recommend packaging that.

Comment 13 Gwyn Ciesla 2020-04-13 15:38:58 UTC
Created attachment 1678467 [details]
My spec for reference

Comment 14 Ron Olson 2020-04-13 15:55:39 UTC
Hey Gwyn-

Funny, I was going off ftp.gnu.org and they don't have a 3.0, but yeah it seems like that's the version to go with. Would you like to package this? It's fine by me as yours looks more complete than mine.

Comment 15 Gwyn Ciesla 2020-04-13 15:57:34 UTC
Sure, that works for me if it works for you. The tooling requires the maintainer to submit the review but I'll CC you on the new one.

Comment 16 Ron Olson 2020-04-13 15:59:26 UTC
Okay, that's fine by me. I'll close this ticket. Thanks Artur for the review!

Comment 17 Gwyn Ciesla 2020-04-13 16:11:45 UTC

*** This bug has been marked as a duplicate of bug 1823419 ***


Note You need to log in before you can comment on or make changes to this bug.