Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 677392 - media-libs/assimp-4.0.1: Add -fno-strict-aliasing to CXXFLAGS to avoid Warnings and QA notice about strict aliasing
Summary: media-libs/assimp-4.0.1: Add -fno-strict-aliasing to CXXFLAGS to avoid Warnin...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Sławek Lis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-06 22:10 UTC by segmentation fault
Modified: 2019-08-21 19:03 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description segmentation fault 2019-02-06 22:10:07 UTC
Merging media-libs/assimp-4.0.1 works on my system, but not without raising an eyebrow - i.e. a QA from gentoo: 

 * QA Notice: Package triggers severe warnings which indicate that it
 *            may exhibit random runtime failures.

 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/AssbinExporter.cpp:642:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/AssbinExporter.cpp:643:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/AssbinExporter.cpp:644:60: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:62:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:103:46: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:104:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:108:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:109:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:110:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:193:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:207:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:696:46: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:697:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:711:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/BlenderScene.cpp:712:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/FIReader.cpp:482:39: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/FIReader.cpp:500:40: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/tools/assimp_cmd/WriteDumb.cpp:568:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/tools/assimp_cmd/WriteDumb.cpp:569:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/tools/assimp_cmd/WriteDumb.cpp:570:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:234:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:264:88: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 * /zram/portage/media-libs/assimp-4.0.1/work/assimp-4.0.1/code/../contrib/Open3DGC/o3dgcBinaryStream.h:317:71: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

 * Please do not file a Gentoo bug and instead report the above QA
 * issues directly to the upstream developers of this software.
 * Homepage: https://github.com/assimp/assimp


The configuration that leads to these warnings is:

-- <<< Gentoo configuration >>>
Build type      Gentoo
Install path    /usr
Compiler flags:
C               -O2 -march=native -pipe -ftree-vectorize -fopenmp -fPIC
C++             -O2 -march=native -pipe -ftree-vectorize -fopenmp -g -fvisibility=hidden -fPIC -Wall -std=c++0x
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed
Module          -Wl,-O1 -Wl,--as-needed
Shared          -Wl,-O1 -Wl,--as-needed


Some info
---------

My flags from make.conf:

CFLAGS="-O2 -march=native -pipe -ftree-vectorize"
CXXFLAGS="${CFLAGS}"

Top of 'emerge --info':

Portage 2.3.51 (python 3.6.5-final-0, hardened/linux/amd64, gcc-7.3.0, glibc-2.27-r6, 4.19.18-gentoo x86_64)
=================================================================
System uname: Linux-4.19.18-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:    40976252 total,   6665188 free
KiB Swap:   25165820 total,  25165820 free
Timestamp of repository gentoo: Thu, 13 Dec 2018 12:15:01 +0000
Head commit of repository gentoo: 057645ffcdb86bd24e7c965f6e1aa03db33abb4c
sh bash 4.4_p12
ld GNU ld (Gentoo 2.30 p5) 2.30.0
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.4.8::gentoo, 3.5.5::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.12.3::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.12.6::gentoo, 1.13.4-r2::gentoo, 1.14.1::gentoo, 1.15.1-r2::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.19::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo


Resolution
----------

It seems that the issue is known upstream:

https://github.com/assimp/assimp/issues/2147

but it is marked as 'difficult', so it may take some time until it is resolved. 


Workaround
----------

To avoid the warnings, one should build assimp with the -fno-strict-aliasing C++ flag:

As a user, create two files:

  1. /etc/portage/env/no-strict-aliasing.conf

     with the content:

     CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"


  2. /etc/portage/package.env/assimp

     with the content:

    media-libs/assimp       no-strict-aliasing.conf

With these two files in place (whose effect is to add '-fno-strict-aliasing"' to $CXXFLAGS of the user's make.conf file), assimp will be compiled without the above warnings - and with no QA notice.


Suggestion
----------

My suggestion to the ebuild maintainer is to add '-fno-strict-aliasing"' to $CXXFLAGS in the ebuild, for as long as the issue has not been dealt with upstream - this will avoid embarrassing QA notices thrown at user's face and remove the need for extra env files in user portage.
Comment 1 Sławek Lis (RETIRED) gentoo-dev 2019-08-21 19:03:10 UTC
Thanks for your report.
I've updated an ebuild adding -fno-strict-aliasing argument.
Newer assimp version seems to not have this warnings anymore, but I'm still testing ebuild for it, so now pushing just small fix for 4.0.1
Comment 2 Larry the Git Cow gentoo-dev 2019-08-21 19:03:48 UTC
The bug has been closed via the following commit(s):

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

commit ebd7fc118c9f57434fb1fe19bf6e70db3f86f13e
Author:     Slawomir Lis <slis@gentoo.org>
AuthorDate: 2019-08-21 19:03:14 +0000
Commit:     Slawomir Lis <slis@gentoo.org>
CommitDate: 2019-08-21 19:03:35 +0000

    media-libs/assimp: Strict aliasing error fix
    
    Closes: https://bugs.gentoo.org/677392
    Package-Manager: Portage-2.3.71, Repoman-2.3.17
    Signed-off-by: Slawek Lis <slis@gentoo.org>

 media-libs/assimp/assimp-4.0.1-r1.ebuild | 67 ++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)