Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 862579 - sci-geosciences/grass-8.2.0-r2 fails to compile (lto): raster.h:413:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Summary: sci-geosciences/grass-8.2.0-r2 fails to compile (lto): raster.h:413:7: error:...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: mario.haustein
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2022-07-31 18:44 UTC by Agostino Sarubbo
Modified: 2024-03-15 06:47 UTC (History)
3 users (show)

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


Attachments
build.log.xz (build.log.xz,137.96 KB, application/x-xz)
2022-07-31 18:44 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-07-31 18:44:13 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: sci-geosciences/grass-8.2.0-r1 fails to compile (lto).
Discovered on: amd64 (internal ref: lto_tinderbox)

NOTE:
This machine uses lto with CFLAGS=-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing

Here is a bit of explanation:

-Werror=lto-type-mismatch:
User to find possible runtime issues in packages. It likely means the package is unsafe to build & use with LTO.
For projects using the same identifier but with different types across different files, they must be fixed to be consistent across the codebase.

-Werror=odr:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO. C++ code must comply with the One Definition Rule (ODR) - see https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule.

-Werror=strict-aliasing:
Used to find possible runtime issues in packages. These bugs are a problem anyway but may be even worse when combined with LTO.

Workarounds:
- If upstream is friendly and still active, file a bug upstream. For emulators, codecs, games, or multimedia packages, it may be worth just applying a workaround instead, as upstreams sometimes aren't receptive to these bugs (VALID FOR ALL).
- Use the new 'filter-lto' from flag-o-matic.eclass as it's likely to be unsafe with LTO (VALID FOR lto-type-mismatch - odr).
- Fix it yourself if interested, of course (VALID FOR ALL).
- Append-flags -fno-strict-aliasing (VALID FOR strict-aliasing).
- Use memcpy() but a union is sometimes suitable too (VALID FOR strict-aliasing).
- -fstrict-aliasing is implied by -O2, so this must be addressed in some form (VALID FOR strict-aliasing).

See also: https://marc.info/?l=gentoo-dev&m=165639574126280&w=2
Comment 1 Agostino Sarubbo gentoo-dev 2022-07-31 18:44:17 UTC
Created attachment 796237 [details]
build.log.xz

build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Comment 2 Agostino Sarubbo gentoo-dev 2022-07-31 18:44:20 UTC
Error(s) that match a know pattern in addition to what has been reported in the summary:


'
Details: <[Errno 2] No such file or directory: 'g.gui.dbmgr'>
Details: <[Errno 2] No such file or directory: 'i.atcorr'>
Details: <[Errno 2] No such file or directory: 'i.fft'>
Details: <[Errno 2] No such file or directory: 'i.ifft'>
Details: <[Errno 2] No such file or directory: 'i.zc'>
Details: <[Errno 2] No such file or directory: 'm.nviz.image'>
Details: <[Errno 2] No such file or directory: 'r.gwflow'>
Details: <[Errno 2] No such file or directory: 'r.in.lidar'>
Details: <[Errno 2] No such file or directory: 'r.in.pdal'>
Details: <[Errno 2] No such file or directory: 'r.in.png'>
Details: <[Errno 2] No such file or directory: 'r.out.png'>
Details: <[Errno 2] No such file or directory: 'r.solute.transport'>
Details: <[Errno 2] No such file or directory: 'r.surf.fractal'>
Details: <[Errno 2] No such file or directory: 'r.terraflow'>
Details: <[Errno 2] No such file or directory: 'r.viewshed'>
Details: <[Errno 2] No such file or directory: 'r3.gwflow'>
Details: <[Errno 2] No such file or directory: 'v.buffer'>
Details: <[Errno 2] No such file or directory: 'v.in.lidar'>
Details: <[Errno 2] No such file or directory: 'v.in.pdal'>
Details: <[Errno 2] No such file or directory: 'v.out.postgis'>
Details: <[Errno 2] No such file or directory: 'v.surf.bspline'>
ERROR: /usr/include/gdal/cpl_port.h:319: Syntax error at '
ERROR: /usr/include/gdal/cpl_port.h:321: Syntax error at '
ERROR: /usr/include/gdal/cpl_port.h:896: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:281: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:308: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:315: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:321: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:330: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:331: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:339: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:397: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:406: Syntax error at '
ERROR: /usr/include/sys/cdefs.h:433: Syntax error at '
ERROR: x86_64-pc-linux-gnu-gcc -E       -I/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/include -I/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/include -D__GLIBC_HAVE_LONG_LONG: /var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/include/grass/gprojects.h:55:14: fatal error: ogr_srs_api.h: No such file or directory
ModuleNotFoundError: No module named 'wx'
fatal: not a git repository (or any parent up to mount point /var/tmp)
grass.exceptions.CalledModuleError: Module run `d.rast --q map=tmp_grad_rel_9206` ended with an error.
make[3]: *** No rule to make target '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/lib/libgrass_gpde.8.2.so', needed by '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/bin/r3.gwflow'.  Stop.
make[3]: *** No rule to make target '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/lib/libgrass_gpde.8.2.so', needed by '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/bin/v.surf.bspline'.  Stop.
make[4]: *** No rule to make target '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/lib/libgrass_gpde.8.2.so', needed by '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/bin/r.gwflow'.  Stop.
make[4]: *** No rule to make target '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/lib/libgrass_gpde.8.2.so', needed by '/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/bin/r.solute.transport'.  Stop.
/var/tmp/portage/sci-geosciences/grass-8.2.0-r1/work/grass-8.2.0/dist.x86_64-pc-linux-gnu/include/grass/defs/raster.h:413:7: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing[https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-aliasing]]
Comment 3 Agostino Sarubbo gentoo-dev 2022-10-24 06:50:03 UTC
lto_tinderbox has reproduced this issue with version 8.2.0-r2 - Updating summary.
Comment 4 Larry the Git Cow gentoo-dev 2024-03-15 06:47:04 UTC
The bug has been closed via the following commit(s):

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

commit eecdd47e4d8acbe92493140b2ba0a80358d28791
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-15 06:33:56 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-15 06:46:15 +0000

    sci-geosciences/grass: mark as LTO-unsafe, strict-aliasing unsafe
    
    Closes: https://bugs.gentoo.org/862579
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 sci-geosciences/grass/grass-8.3.1.ebuild | 10 +++++++++-
 sci-geosciences/grass/grass-9999.ebuild  | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)