Bug 155715 - Missing #include <cstdlib> in store/source/storbase.hxx required to build with gcc 14
Summary: Missing #include <cstdlib> in store/source/storbase.hxx required to build wit...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All Linux (All)
: medium normal
Assignee: Martin Jambor
URL:
Whiteboard: target:24.2.0
Keywords:
: 160464 (view as bug list)
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2023-06-07 13:57 UTC by Martin Jambor
Modified: 2024-04-01 18:23 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Jambor 2023-06-07 13:57:46 UTC
Description:
With (the development version of) GCC 14 (after commit
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=940645cec50 ), building
of Libre Office (master commit 86828ea2e323) fails with:

In file included from /home/mjambor/lo/libreoffice/store/source/storpage.hxx:27,
                 from /home/mjambor/lo/libreoffice/store/source/storpage.cxx:20:
/home/mjambor/lo/libreoffice/store/source/storbase.hxx: In static member function ‘static void* store::OStorePageObject::operator new(size_t)’:
/home/mjambor/lo/libreoffice/store/source/storbase.hxx:525:21: error: ‘malloc’ is not a member of ‘std’
  525 |         return std::malloc(sal_uInt32(n));
      |                     ^~~~~~
/home/mjambor/lo/libreoffice/store/source/storbase.hxx: In static member function ‘static void store::OStorePageObject::operator delete(void*)’:
/home/mjambor/lo/libreoffice/store/source/storbase.hxx:529:14: error: ‘free’ is not a member of ‘std’
  529 |         std::free (p);


Adding the missing include allows the compilation to proceed further:


mjambor@ryzen4:~/lo/libreoffice$ git diff
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index feac0db96227..207cbf40a8d3 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -32,6 +32,7 @@
 
 #include <store/types.h>
 
+#include <cstdlib>
 #include <memory>
 #include <utility>



Steps to Reproduce:
1.Build gcc from the master branch and install it somewhere
2.Set the PATH to where you installed the gcc from step 1
3.Try to build LibreOffice and ponder about the build failure

Actual Results:
Build failure

Expected Results:
Build succeeds


Reproducible: Always


User Profile Reset: No

Additional Info:
Cheetah is the fastest mammal on the planet, they say.
Comment 1 Roman Kuznetsov 2023-06-07 14:29:25 UTC
Stephan, could you please look at it?
Comment 2 Stephan Bergmann 2023-06-07 14:41:28 UTC
@Martin Jambor:  Please either submit a patch (see <https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch>), or wait until I'll run into the same issue early next week with my local build against GCC trunk and provide a similar fix :)
Comment 3 Martin Jambor 2023-06-07 16:38:58 UTC
OK, thanks for the pointer, I tried and produced 
https://gerrit.libreoffice.org/c/core/+/152712

But in case something is not quite right, I'm definitely fine with waiting
for a week or a few.
Comment 4 Commit Notification 2023-06-08 06:26:34 UTC
Martin Jambor committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/db98a3f1b1a703ea8e1284b8815eea2274abb2db

Add cstdlib include necessary to build with gcc14 libstdc++ (tdf#155715)

It will be available in 24.2.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 5 Stephan Bergmann 2023-06-08 06:28:58 UTC
(In reply to Martin Jambor from comment #3)
> OK, thanks for the pointer, I tried and produced 
> https://gerrit.libreoffice.org/c/core/+/152712

That's great, thanks!
Comment 6 Stephan Bergmann 2023-06-08 06:30:34 UTC
(In reply to Stephan Bergmann from comment #5)
> (In reply to Martin Jambor from comment #3)
> > OK, thanks for the pointer, I tried and produced 
> > https://gerrit.libreoffice.org/c/core/+/152712
> 
> That's great, thanks!

Though this is arguably a minor modification, it would still be great if you could also do the <https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch#Add_yourself_to_the_contributor_list> part and send a license statement to the developer mailing list.
Comment 7 Martin Jambor 2023-06-08 12:37:30 UTC
I see, thanks, I have just sent the email:
https://lists.freedesktop.org/archives/libreoffice/2023-June/090450.html
Comment 8 Julien Nabet 2024-04-01 18:23:39 UTC
*** Bug 160464 has been marked as a duplicate of this bug. ***