The current configure.ac doesn't account for multiple instances of a blacklisted CFLAG being included. In my case, I had -fstack-protector-strong in both CFLAGS and in CPPFLAGS. The logic in the configure script would then remove one of those flags but then mangled the subsequent one via one of the other sed commands. gcc then failed to compile the program.
Here's a really quick reproducer:
$ CFLAGS='-fstack-protector-strong -I/usr/include/libdb4' CPPFLAGS='-fstack-protector-strong' ./configure |grep COB_CFLAGS
configure: COB_CFLAGS -I/usr/local/include -Wno-unused -fsigned-char -Wno-pointer-sign -strong -I/usr/include/libdb4 -pipe
Patch which fixes this attached but my autoconf and shell scripting skills are a bit rusty so you may end up changing it a little bit.
Related to [bugs:#528] and [bugs:#547].
Hmmm.... There's another problem in the sed handling which is exacerbated by my patch...
-gis being used in the gnucobolo build like this:-grecord-gcc-switches
This is munged by the first sed line which does:
-e 's/-g//'
If there's no -g flag given in CFLAGS, then the -g gets stripped from gnucobol's -grecord-gcc-switches line.
My patch makes it worse because it makes that sed command global and thus the -g gets stripped from -grecord-gcc-switches even if there is a prior -g switch but the underlying problem is independent of my change.
Last edit: Toshio Kuratomi 2020-04-17
In my review we're using this patch alongside %configure --enable-debug.
https://bugzilla.redhat.com/show_bug.cgi?id=1823419
Diff:
Related
Bugs:
#528Bugs:
#547Last edit: Simon Sobisch 2020-04-16
Thank you both for reporting this!
I've committed a fix to trunk in [r3531]. There have been changes to configure.ac since 2.2, so the fix is basically a merge of both your patches.
@sf-mensch Could you please move this ticket from patches to bugs?
Ticket moved from /p/open-cobol/patches/49/
Moved as requested. Thank you all three for taking care; I try to check and merge to 3.x tonight and would suggest that for Fedora a test-build with a 3.1-dev tarball is done instead of the old 3.0rc1 (which will not get a release and is outdated) after my merge. I'll drop a note here.
Changes merged with [r3533]. @abadger1999 and @limburgher can you please check if this removes the need for any patches on your side? You may do so using the nightly tarballs, in this case the URL is https://ci.appveyor.com/api/projects/GitMensch/gnucobol-3-x/artifacts/gnucobol-3.1-dev.tar.gz?job=Image:%20Ubuntu1804
In any case two notes to the spec file:
I get the following with the nightly and no patches:
Making all in extras
make[2]: Entering directory '/home/gwyn/rpmbuild/BUILD/gnucobol-3.1-dev/extras'
("../pre-inst-env" cobc -m -Wall -O2 -o "CBL_OC_DUMP.so" "CBL_OC_DUMP.cob" || \
"../pre-inst-env" cobc -m -Wall -o "CBL_OC_DUMP.so" "CBL_OC_DUMP.cob" || \
"../pre-inst-env" cobc -m -Wall -vv -o "CBL_OC_DUMP.so" "CBL_OC_DUMP.cob")
cobc: symbol lookup error: cobc: undefined symbol: cob_is_valid_uri
cobc: symbol lookup error: cobc: undefined symbol: cob_is_valid_uri
cobc: symbol lookup error: cobc: undefined symbol: cob_is_valid_uri
make[2]: *** [Makefile:594: CBL_OC_DUMP.so] Error 127
Thank you for the feedback. This likely means that it uses a system-installed libcob instead of the one that should be taken by means of pre-inst-env.
Can you please investigate why this is the case? Would LD_PRELOAD be evil to use there?
You would appear to be correct, uninstalling 3.0-rc1 allows 3.1-dev to build, and it builds with 3.1-dev installed.
I think LD_PRELOAD as part of the build process is fine. IIRC, it doesn't encode anything into the built object; it just tells the currently running code to looks for a library somewhere it normally wouldn't.
@abadger1999 and @limburger - I don't run Fedora currently and am a bit confused what's going on, can you please recheck?
This is what I've done on a Debian system (with GnuCOBOL 2.2 installed, which also don't have the entry point that was the issue in your case) and after
makeof GnuCOBOL 3.1-dev (with nearly the maximum of optional dependencies [you may consider to add some of these to the .spec file, ideally as "--with-xyz"]) :What we can see and should know:
pre-inst-env, which sets, along to other entries,PATH(which is the reason your not-yet-installedcobcis found) andLD_LIBRARY_PATHSomething must be different on your side, there should be no need to uninstall something before building the new version.
Can you check what's going on?
As a secondary thing: pre-inst-env should likely setup the libtool wrapper in PATH as those are explicit there to prevent issues like this. Is there any difference if you change pre-inst-env (either after configure or before in build_aux) as follows?
Thank you for your report in advance,
Simon
BTW:
LD_PRELOADseems wrongm as it would force a use of a different ABI file, too (OpenCOBOL 1.1 and GnuCOBOL 2.2-3.x have a different ABI version than GnuCOBOL 4.0), if I'm not wrong.It would appear that cobc/.libs/cobc is linked against the system version:
gwyn@gwythsefyll .libs]$ ldd cobc
linux-vdso.so.1 (0x00007ffe7d682000)
libcob.so.4 => /usr/lib64/libcob.so.4 (0x00007fb4513b7000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00007fb4511ee000)
libm.so.6 => /usr/lib64/libm.so.6 (0x00007fb4510a8000)
libgmp.so.10 => /usr/lib64/libgmp.so.10 (0x00007fb45102b000)
libncursesw.so.6 => /usr/lib64/libncursesw.so.6 (0x00007fb450feb000)
libtinfo.so.6 => /usr/lib64/libtinfo.so.6 (0x00007fb450fbb000)
libdb-5.3.so => /usr/lib64/libdb-5.3.so (0x00007fb450dee000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fb450de7000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb451547000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fb450dc5000)
@limburgher can you please recheck with current 3.x branch if this is still an issue for you? Thank you.
Note: if you want to run ldd against cobc/.libs/cobc you'll always have to either invoke the
pre-inst-envscript or setup your dynamic loader to prefixlibcob/.libs.Ok, so on the previous nightly, if I use pre-inst-env, it shows linkage to the .libs version. If not, it shows linkage to the installed system version. On trunk, if I use pre-inst-env, it shows linkage to the .libs version, if not, it gives, among other things, libcob.so.5 => not found, as expected. The rpm build fails due to missing translation, as they don't appear to be building.
Do we know when 3.1 might come out?
@limburgher 3.1-rc1 is out now (NEWS entry says 3.1 final, depending on feedback to be expected within the next 3 monhs).
Is there anything open from this ticket for you (3.1rc1 + trunk) or can we close it?
Note: if you experience any issues with translations you likely need to add gettext in your environment, but in both the 3.1-rc1 tarball and in the CI-created tarball for trunk there should be no need for this.
If you stumble over any issue related to this and want to go on you could go with the configure option
--disable-nlsto work around this issue.I suggest to update the 3.1 fedora package to the rc-1 from https://alpha.gnu.org/gnu/gnucobol/, possibly with signature and sha256 check if that is something Fedora does during build. Using the rc1 will also remove the need to use the autogen script and therefore the build-dependecies bison flex help2man texinfo.
I also highly suggest to compare your spec file with https://sourceforge.net/p/open-cobol/code/HEAD/tree/branches/gnucobol-3.x/gnucobol.spec - as some entries, for example URL and license, are currently wrong in the fedora spec.
You may want to add a libxml2 dependency. While it is an optional one (if not explicit specified configure will check if it is available and add it in this case) and relative big, it is needed to support
GENERATE XMLwhich is otherwise non-functional.Personal question: can you try to make it available in EPEL-7, too?
Last edit: Simon Sobisch 2020-07-02
I'll fix the spec, and add the sig verification and build deps. I notice that the soname has gone from 5 back to 4, is this intended to be stable now?
I can try EPEL7, yes.
There's nothing going back here :-)
Explanation: soname is at 5 in trunk (because 4.x is incompatible to previous versions; so "fun" to tackle when targetting this in rpms some later date), GC3.1 is compatible back to GC 2.2 and therefore sticks with the soname 4.
Ahh, ok. SO I just need to wark people to recompile.
For EL-7 it looks like test 696 is failing. Any idea why?
I guess you mean "warn" - this is something that would be needed when upgrading from 3.x to 4.x (and also the other way around or when downgrading from 3.x to 2.2). It is not needed when going from 2.2 to 3.x. Because of the different soname one could theoretically install both, even into the same directory with using an exec-suffix; but 4.0 is too far away to think about this now.
I'Ve just rechecked the first rpm that I've seen - it is named "gnucobol-3.1-3.el8.src.rpm" and contains (according to configure.ac) "4.0-early-dev" - at least this one (= everyone with the soname 5) has to be considered broken because: it says "a" (3.1) and contains "b" (4.0) - and in any case it contains an unstable version with no guarantee at all that generated modules will work after the next change (without recompilation).
So yet: please "revert" that one if possible and try to provide a 3.1 based on the 3.1rc1 quick, telling people that they may need to recompile (actually they are likely to get a nice message like "version mismatch, module version 4, libcob version 3").
Which EL-7 is broken - GC3.1-rc1 or GC4.0-early-dev? In the case of 3.1 it should be the test "DELETE FILE, INDEXED", that is not a test that is known to fail "under special circumstances" - please provide the file tests/testsuite.log if possible as this would allow us to recheck.
I do. :)
I only need to warn the few people using the previous trunk snapshot, that's all. I'm releasing 3.1-rc1 for rawhide, fc32 and epel8 now. And yes, that's the one. Here's the log.
Thank you for the log - does this only happen on EL7 but not on EL-8? Can you send the file tests/testuite.log for comparision?
In any case: that's only a minor issue (internally there's a wrong error code returned, but still an error code, so this is mainly confusing).
Correct, 8 is fine, here's the log.
Also, gnucobol doesn't currently build on ppc64le.