Bug 1326581

Summary: swipl-ld error: unrecognized command line option '-mtu'
Product: [Fedora] Fedora Reporter: osallou <olivier.sallou>
Component: plAssignee: Petr Pisar <ppisar>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 23CC: bagnara, mefoster, ppisar
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://groups.google.com/forum/embed/#!topic/swi-prolog/APOFiVd4xrk
Whiteboard:
Fixed In Version: pl-7.2.3-3.fc25 pl-7.2.3-3.fc24 pl-7.2.3-2.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-18 17:26:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description osallou 2016-04-13 07:27:04 UTC
Description of problem:

When using swipl-ld to compile C+Prolog, compilation fails with error:

swipl-ld error: unrecognized command line option '-mtu'

this does not occur in Fedora 22.



Version-Release number of selected component (if applicable): pl-7.2.3-1.fc23.x86_64


How reproducible:


Steps to Reproduce:
1. Use swipl-ld to compile a C + Prolog executable


Actual results:

[makerpm@9d7a7e7ec9d3 prolog]$ swipl-ld -Lm   -goal true -initfile swi-logol.pl -o preanalyse.exe -v preSwiMain.c sicstus.pl logol.pl	eval `swipl --dump-runtime-variables`
		CC="gcc"
		PLBASE="/usr/lib64/swipl-7.2.3"
		PLARCH="x86_64-linux"
		PLLIBS=""
		PLLIB="-lswipl"
		PLCFLAGS="-fno-strict-aliasing -pthread -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtu"
		PLLDFLAGS="-rdynamic -Wl,--enable-new-dtags -pthread -Wl,-rpath=/usr/lib64/swipl-7.2.3/lib/x86_64-linux"
		PLSOEXT="so"
		PLTHREADS="yes"
	gcc -c -fno-strict-aliasing -pthread -fPIC -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtu -D_REENTRANT -D__SWI_PROLOG__ -D__SWI_EMBEDDED__ -I/usr/lib64/swipl-7.2.3/include -o preSwiMain.o preSwiMain.c
cc1: error: unrecognized command line option '-mtu'

I did not find any clue on "-mtu" and don't find a way to disable/override it. This seems to be introduced by package itself with flags used at pl package build.

Expected results:

exe generation

Additional info:

I talked with upstream author and here is what he said

"I don't really understand what is going on. PLCFLAGS is initialized from
the Prolog flag `c_cflags`, which is in turn set during the build
process from the CFLAGS used. No clue what -mtu means (see manual), but
I'd assume if they use a particular set of flags for compiling the
packages you can use the same flags for compiling your own applications
... Apparently this assumption is wrong!?"

Comment 1 Petr Pisar 2016-04-13 10:29:11 UTC
I confirm swipl-ld produces invalid -mtu CC flag. It looks like something truncates the PLCFLAGS value. On the other hand, it worked on 2015-08-27. I found a compiled test on my machine.

Comment 2 Petr Pisar 2016-04-13 10:56:32 UTC
I think I found it. It's a bug in SWI swipl-ld. The src/swipl-ld.c parses "swipl --dump-runtime-variables" output. It segments lines into 256-byte long buffer. And fgets(3) hits the 256-byte limit on PLCFLAGS value:

Fedora 22:

$ swipl --dump-runtime-variables | grep PLCFLAGS | wc -c
222

Fedora 23:

$ swipl --dump-runtime-variables | grep PLCFLAGS | wc -c
268

Comment 3 osallou 2016-04-13 11:40:22 UTC
ok, upstream pushed a fix, thanks for analysis

Waiting for new release... :-)

Comment 4 Petr Pisar 2016-04-13 12:13:39 UTC
I will try the fix and if everything is fine, I will push the fixed build into Fedora. Thanks for alerting the upstream.

Comment 5 Fedora Update System 2016-04-13 12:50:14 UTC
pl-7.2.3-3.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-12fe2d64e1

Comment 6 Fedora Update System 2016-04-13 12:50:32 UTC
pl-7.2.3-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b55cb4ee46

Comment 7 Fedora Update System 2016-04-13 21:23:26 UTC
pl-7.2.3-3.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-12fe2d64e1

Comment 8 Fedora Update System 2016-04-14 04:52:17 UTC
pl-7.2.3-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b55cb4ee46

Comment 9 osallou 2016-04-14 07:43:56 UTC
Tested fix on Fedora 23 from testing branch and it works fine

Comment 10 Fedora Update System 2016-04-18 17:26:26 UTC
pl-7.2.3-3.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2016-04-22 01:22:29 UTC
pl-7.2.3-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.