Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 894564 - dev-libs/boost: Add support for LFS (Large File Support) for 32bit ARM
Summary: dev-libs/boost: Add support for LFS (Large File Support) for 32bit ARM
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: David Seifert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lfs-tracker
  Show dependency tree
 
Reported: 2023-02-15 09:50 UTC by gwendal grignou
Modified: 2023-06-10 19:13 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
log emerge boost for 32bit ARM (dev-libs_boost-1.81.0-r2_20230215-091254.log.gz,276.04 KB, application/gzip)
2023-02-15 09:50 UTC, gwendal grignou
Details
Patch to add LFS options (lfs.patch,498 bytes, patch)
2023-02-15 09:51 UTC, gwendal grignou
Details | Diff
dev-libs/boost emerge with append-lfs-flags set (dev-libs:boost-1.81.0-r2:20230216-181801.log.gz,277.50 KB, application/gzip)
2023-02-16 18:25 UTC, gwendal grignou
Details
ABI comparison (boost_abi.tar.bz2,542.81 KB, application/x-bzip)
2023-02-24 18:15 UTC, gwendal grignou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gwendal grignou 2023-02-15 09:50:02 UTC
Created attachment 851226 [details]
log emerge boost for 32bit ARM

emerging dev-libs/boost for an ARM 32 bit users space (chromeos kukui):

    - default address-model    : 32-bit [1]
    - default architecture     : arm [1]

At configuration, large file support is detected: 
...
 - Has Large File Support   : yes [2]
...

But when checking for large file support in the produced library with https://chromium.googlesource.com/chromiumos/platform/crosutils/+/main/hooks/install/large-file-support.sh,

All the objects are not compiled with LFS option:

The following patch addresses the problem. Both C and C++ flags need to be modified to ensure LFS is compiled even on 32bit architecture.

diff -u /tmp/portage/dev-libs/boost/boost-1.81.0-r1.ebuild dev-libs/boost/boost-1.81.0-r2.ebuild 
--- /tmp/portage/dev-libs/boost/boost-1.81.0-r1.ebuild  2023-02-08 11:05:29.875500624 -0800
+++ dev-libs/boost/boost-1.81.0-r2.ebuild       2023-02-15 01:44:45.732290829 -0800
@@ -194,6 +194,10 @@
 
        # Use C++17 globally as of 1.80
        append-cxxflags -std=c++17
+
+       # Append LFS flags for both C++ and C code.
+       append-cxxflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+       append-cflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
 }
 
 multilib_src_compile() {
Comment 1 gwendal grignou 2023-02-15 09:51:44 UTC
Created attachment 851228 [details, diff]
Patch to add LFS options
Comment 2 Mike Gilbert gentoo-dev 2023-02-15 19:58:41 UTC
Please use the append-lfs-flags function instead.
Comment 3 gwendal grignou 2023-02-16 18:25:23 UTC
Created attachment 851840 [details]
dev-libs/boost emerge with append-lfs-flags set

I tried to use `append-lfs-flags` at first, but it does not work. `append-lfs-flags` set the CPPFLAGS which is not taken into account when compiling boost files.
Comment 4 SpanKY gentoo-dev 2023-02-22 06:55:28 UTC
can you check the ABI of the installed libs to see if they change ?  it might be easier with these as `readelf -sW ... | c++filt` on C++ libs includes typing info in the func signatures.

at a glance, i don't see off_t or struct stat in any headers.  but boost is large and full of C++ metaprogramming, so manual audit is hard.
Comment 5 gwendal grignou 2023-02-24 18:15:01 UTC
Created attachment 854414 [details]
ABI comparison

There is a ABI difference between LFS and non LFS dev-boost:

boost::interprocess::shared_memory_object::truncate use offset_t so it is compiled as `long long` with LFS option.
Same for the constructor of mapped_region in boost_1_81_0/boost/interprocess/mapped_region.hpp.

Having said that, readelf reports the bidding as local and visibility as hidden, so it is only exported through inline function in the .hpp that are compiled with the applications.

```
grep -A1  boost::interprocess::shared_memory_object::truncate  /tmp/new_typing_info.txt
  6090: 0005a5f5   244 FUNC    LOCAL  HIDDEN    15 boost::interprocess::shared_memory_object::truncate(long long)
  6091: 0005a6e9   544 FUNC    LOCAL  HIDDEN    15 boost::interprocess::mapped_region::mapped_region<boost::interprocess::shared_memory_object>(boost::interprocess::shared_memory_object const&, boost::interprocess::mode_t, long long, unsigned int, void const*, int)
```

For comparison, I compiled with (new) and without (old) LFS option and using

cd .../tmp/portage/dev-libs/boost-1.81.0-*/work
for i in $(find . -name \*so | sort) ; do echo $i ;  readelf -sW $i | c++filt ; done > .._typing_info.txt

Removing index and UNDEF (we know the new version will call 64 version for mmap, ftruncate, ...)
cut -c '18-' .._typing_info.txt | grep UNDEF > .._typing_info_tr.txt

 vimdiff /tmp/new_typing_info_tr.txt /tmp/old_typing_info_tr.txt
Comment 6 gwendal grignou 2023-02-25 04:20:23 UTC
abidiff did not find any difference:

for i in $(find .../tmp/portage/dev-libs/boost-1.81.0-r2/work/*arm -name \*so) ; do
  echo $(basename $i) --- ; ./tools/abidiff $i ${i/-r2/-r1}
done

libboost_unit_test_framework.so ---
libboost_contract.so ---
libboost_random.so ---
libboost_math_tr1l.so ---
libboost_chrono.so ---
libboost_filesystem.so ---
libboost_graph.so ---
libboost_math_tr1f.so ---
libboost_math_c99.so ---
libboost_program_options.so ---
libboost_math_c99f.so ---
libboost_type_erasure.so ---
libboost_atomic.so ---
libboost_thread.so ---
libboost_math_c99l.so ---
libboost_wave.so ---
libboost_serialization.so ---
libboost_nowide.so ---
libboost_timer.so ---
libboost_regex.so ---
libboost_date_time.so ---
libboost_url.so ---
libboost_log.so ---
libboost_math_tr1.so ---
libboost_json.so ---
libboost_wserialization.so ---
libboost_iostreams.so ---
libboost_log_setup.so ---
libboost_container.so ---
libboost_prg_exec_monitor.so ---
libboost_system.so ---
Comment 7 Larry the Git Cow gentoo-dev 2023-04-14 23:07:14 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2000752e4e7a8d2859e2b63f39f1184c2711a4da

commit 2000752e4e7a8d2859e2b63f39f1184c2711a4da
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2023-04-14 23:07:03 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2023-04-14 23:07:03 +0000

    dev-libs/boost: add 1.82.0
    
    Bug: https://bugs.gentoo.org/894564
    Signed-off-by: David Seifert <soap@gentoo.org>

 dev-libs/boost/Manifest            |   1 +
 dev-libs/boost/boost-1.82.0.ebuild | 343 +++++++++++++++++++++++++++++++++++++
 2 files changed, 344 insertions(+)
Comment 8 David Seifert gentoo-dev 2023-06-10 19:13:41 UTC
commit ef13a50657cbdafc4f0d1ce332b597ba6c0c5110
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: Sat Jun 10 10:57:11 2023 +0200
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: Sat Jun 10 11:38:36 2023 +0200

    dev-libs/boost: drop 1.81.0-r1
    
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>