[SERVER-17089] file_allocator.cpp compilation fails due to missing posix_fallocate() in uClibc Created: 28/Jan/15  Updated: 27/Apr/15  Resolved: 29/Jan/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.0.0-rc6
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Raffaele Rossi Assignee: Benety Goh
Resolution: Won't Fix Votes: 0
Labels: 32-bit
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MIPS, 32-bit, uClibc


Issue Links:
Related
is related to SERVER-16898 Support cross-compilation for MIPS Closed
Backwards Compatibility: Fully Compatible
Operating System: Linux
Steps To Reproduce:

Build for a platform missing posix_fallocate()

Participants:

 Description   

posix_fallocate() is used in file_allocator.cpp but some C library doesn't provide it (e.g uClibc).

This seems to be the case even when we change the preprocessor check form _linux_ to the documented _XOPEN_SOURCE >= 600 || __POSIX_C_SOURCE >= 200112L.



 Comments   
Comment by Benety Goh [ 04/Feb/15 ]

raffopazzo,

Thank you for the update!

Comment by Raffaele Rossi [ 03/Feb/15 ]

Back again.
So it seems that uClibc actually supports posix_fallocate() but for strange reason it hasn't been included as part of the last official release 0.9.33.2, However, it can be enabled if one builds uClibc out of the master branch. So I believe this ticket can be rejected, if not already.

Apologies for any confusion.
Thanks.
Raf.

Comment by Raffaele Rossi [ 29/Jan/15 ]

I'll try look deeper into the uClibc side. I thought acm agreed that checking for posix_fallocate() was a good thing to do in first place.

Comment by Benety Goh [ 29/Jan/15 ]

raffopazzo,

I would suggest revisiting your uClibc configuration to make posix_fallocate visible to your build. If that doesn't work, it might be best to file a bug report with uClibc.

We can always reopen this ticket and review the configure check in greater detail once we get more information on the underlying uClibc issue.

Comment by Raffaele Rossi [ 28/Jan/15 ]

No. It was fine but I just thought that was cleaner to rely on the linker failing rather than dealing with a cloned environment just to switch -Werror on. I remember I did have a look at the other checks and this would've been the only one switching -Werror to do so. It seemed that other tests used a link-time check. Which did make sense to me.

Let me know what's the best way for you guys. I'll be happy to change.

Comment by Benety Goh [ 28/Jan/15 ]

Also, I have noticed in your branch that you switched the configure-time check from a compilation check to a link time check:

https://github.com/raffopazzo/mongo/commit/bba9cbf6029356c055bfc52b77d17934fa606a19

Was the compile time check insufficient in your environment to detect the availability of posix_fallocate()?

Comment by Raffaele Rossi [ 28/Jan/15 ]

I did try it when I first came across this issue.
Unfortunately it didn't work because uClibc defines both macros but still doesn't provide posix_fallocate(). The same may then happen for other C libraries

So I falled back to the configure-time check.

Comment by Benety Goh [ 28/Jan/15 ]

raffopazzo, could you please try replacing file_allocator.cpp:254

#if defined(__linux__)

with:

#if _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L

Comment by Raffaele Rossi [ 28/Jan/15 ]

Related to SERVER-16898

FIX available on fork: https://github.com/raffopazzo/mongo/tree/posix_fallocate

Shall I submit a pull request?

Cheers.
Raf.

Generated at Thu Feb 08 03:43:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.