Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 383941 - media-libs/opencv-2.3.1a causes internal compiler error with hardened-gcc-4.6.1
Summary: media-libs/opencv-2.3.1a causes internal compiler error with hardened-gcc-4.6.1
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 400985 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-21 12:18 UTC by Markus Walter
Modified: 2012-08-12 05:03 UTC (History)
5 users (show)

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


Attachments
build log with makeopts="-j1" (build.log,10.39 KB, text/plain)
2011-09-21 12:18 UTC, Markus Walter
Details
emerge --info (info.txt,5.40 KB, text/plain)
2011-09-21 12:18 UTC, Markus Walter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Walter 2011-09-21 12:18:12 UTC
Created attachment 287271 [details]
build log with makeopts="-j1"

media-libs/opencv-2.3.0 fails to merge with hardened-gcc-4.6.1 throwing the following error:
[  3%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/datastructs.o
x86_64-pc-linux-gnu-g++: internal compiler error: Segmentation fault (program cc1plus)

I found the following line in my grsec.log just before the segfault of gcc:
Sep 21 14:09:32 localhost kernel: [189657.889988] grsec: denied RWX mmap of <anonymous mapping> by /usr/bin/python2.7[python2.7:13465] uid/euid:250/250 gid/egid:250/250, parent /usr/bin/cmake[cmake:13208] uid/euid:250/250 gid/egid:250/250
This seems to be correlated.

Switching to vanilla-gcc-4.6.1 causes opencv to merge fine. The problem occurred also with opencv-2.2.0.
Comment 1 Markus Walter 2011-09-21 12:18:34 UTC
Created attachment 287273 [details]
emerge --info
Comment 2 Markus Walter 2011-09-21 12:39:10 UTC
It seems to be related to ssp. With hardened-nopie-gcc-4.6.1 I see the same error, but with hardened-nossp-gcc-4.6.1 I see a different error connected to linking  as follows. Finally when using hardened-nopie-nossp-gcc-4.6.1 the build is successful.

Building CXX object modules/traincascade/CMakeFiles/opencv_traincascade.dir/imagestorage.o
/var/tmp/portage/media-libs/opencv-2.3.0/work/OpenCV-2.3.0/modules/traincascade/imagestorage.cpp: In member function ‘bool CvCascadeImageReader::PosReader::get(cv::Mat&)’:
/var/tmp/portage/media-libs/opencv-2.3.0/work/OpenCV-2.3.0/modules/traincascade/imagestorage.cpp:153:42: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
/var/tmp/portage/media-libs/opencv-2.3.0/work/OpenCV-2.3.0/modules/traincascade/imagestorage.cpp:154:50: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
Linking CXX executable ../../bin/opencv_traincascade
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.1/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/opencv_traincascade.dir/traincascade.o: relocation R_X86_64_32 against `pthread_cancel' can not be used when making a shared object; recompile with -fPIC
CMakeFiles/opencv_traincascade.dir/traincascade.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [bin/opencv_traincascade] Error 1
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2011-11-13 14:44:50 UTC
Please try opencv-2.3.1a ...
Comment 4 Markus Walter 2011-11-14 12:58:51 UTC
Still the same error with opencv-2.3.1a and gcc-4.6.2.
Comment 5 Robert 2012-01-10 03:35:43 UTC
I can confirm the OP's problem with opencv-2.3.1a and opencv-2.3.1a-r1 when using GCC 4.6.* (hardened, pie and ssp). The problem can be solved by changing to GCC 4.5.* (4.5.3 in my case), then both 2.3.1a-r1 and 2.3.1a compile successfully, then change your gcc back to 4.6.* if you want. I only have 4.6.* for one game that requires a library not included in 4.5.* but evidently left my profile changed to this after I was done playing the game. 

Anyhow, I am not sure if this can actually be called a fix but 4.6.* is "testing" and masked so I really don't know how you would classify this. 

The point though, use GCC 4.5.* to compile opencv right now.
Comment 6 Andreas K. Hüttel archtester gentoo-dev 2012-05-28 20:17:59 UTC
OK I suggest you try
* opencv-2.4.0
* gcc-4.7

Sorry but I definitely cant help you much more here...
Comment 7 Markus Walter 2012-05-30 18:24:14 UTC
The combination hardened-gcc-4.7.0 and opencv-2.4.0 works fine for me.
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2012-06-04 09:31:42 UTC
*** Bug 400985 has been marked as a duplicate of this bug. ***