Bug 133331 - solenv build errors -fpermissive
Summary: solenv build errors -fpermissive
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha1+
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Michael Warner
URL:
Whiteboard: target:7.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-24 01:40 UTC by Michael Warner
Modified: 2020-05-31 02:48 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Compiler log showing the error (3.41 KB, text/plain)
2020-05-24 01:46 UTC, Michael Warner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Warner 2020-05-24 01:40:16 UTC
Description:
I get build errors when trying to build solenv with gcc 7. There is a build log and a proposed fix attached. 

Steps to Reproduce:
1. checkout and build, it seems to work
2. make clean distclean
3. make


Actual Results:
It didn't work the second time I ran make, I don't have a good explanation for why not. I futzed around with re-running autogen, but it didn't help.

Expected Results:
I don't get compiler errors.


Reproducible: Sometimes


User Profile Reset: No



Additional Info:
This was a 7.0.0.0.alpha1 build I cloned today.
Comment 1 Michael Warner 2020-05-24 01:46:01 UTC
Created attachment 161210 [details]
Compiler log showing the error
Comment 2 Michael Warner 2020-05-24 01:55:18 UTC
Explicitly specifying the type cast just seems like a good practice anyway.
Comment 3 Michael Warner 2020-05-24 02:29:01 UTC
I submitted a patch here:
https://gerrit.libreoffice.org/c/core/+/94746
Comment 4 Michael Warner 2020-05-24 14:23:24 UTC
The reason for the error seems to be something to do with how I had the CC and CXX environment variables set on my computer. Regardless, I think the change I submitted is still useful because I think people should prefer using explicit type casts rather than implicit.
Comment 5 Commit Notification 2020-05-27 12:49:17 UTC
Michael Warner committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2af600f16fa59490f4444701a6a02e77c6739b5a

tdf#133331: Added explicit type casts to resolve -fpermissive errors

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Stephan Bergmann 2020-05-27 13:01:24 UTC
(In reply to Michael Warner from comment #1)
> Created attachment 161210 [details]
> Compiler log showing the error

The actual problem appears to be that `... /usr/bin/ccache gcc-8 ... -c $S/solenv/bin/concat-deps.c ...` tries to compile that source file as C++, not as C (and there is no -x option given that would force it to do so).  Looks like a ccache bug to me.

(That said, the changes in <https://git.libreoffice.org/core/+/2af600f16fa59490f4444701a6a02e77c6739b5a%5E!/> "tdf#133331: Added explicit type casts to resolve -fpermissive errors" are not wrong, just needless clutter for a C source file.)
Comment 7 Michael Warner 2020-05-27 13:33:29 UTC
(In reply to Stephan Bergmann from comment #6)
> (In reply to Michael Warner from comment #1)
> > Created attachment 161210 [details]
> > Compiler log showing the error
> 
> The actual problem appears to be that `... /usr/bin/ccache gcc-8 ... -c
> $S/solenv/bin/concat-deps.c ...` tries to compile that source file as C++,
> not as C (and there is no -x option given that would force it to do so). 
> Looks like a ccache bug to me.

Maybe so, but this made it work for me.

> 
> (That said, the changes in
> <https://git.libreoffice.org/core/+/
> 2af600f16fa59490f4444701a6a02e77c6739b5a%5E!/> "tdf#133331: Added explicit
> type casts to resolve -fpermissive errors" are not wrong, just needless
> clutter for a C source file.)

Different people have different opinions about these kinds of things. Where I work, for example, they would want explicit casts. Is there a coding conventions document for LibreOffice? From just poking around on the website I don't see one; but I would be happy to follow any such guidance.
Comment 8 Stephan Bergmann 2020-05-27 13:41:56 UTC
(In reply to Michael Warner from comment #7)
> Different people have different opinions about these kinds of things. Where
> I work, for example, they would want explicit casts. Is there a coding
> conventions document for LibreOffice? From just poking around on the website
> I don't see one; but I would be happy to follow any such guidance.

No, we don't have such a set of specific guidelines.