Bug 186432

Summary: graphics/devil: the IL library segfaults during program startup
Product: Ports & Packages Reporter: dt71
Component: Individual Port(s)Assignee: Dmitry Marakasov <amdmi3>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description dt71 2014-02-03 22:40:00 UTC
In the 10.0-RELEASE, the IL library (from the "devil" package), when
linked to any program, such as ``int main(void) { }'', causes the program
to segfault before main() is entered. The backtrace is:

0x00000000 in ?? ()
(gdb) bt
#0  0x00000000 in ?? ()
#1  0x28769ec4 in __dynamic_cast (src_ptr=0x287a1180, src_type=0x2879bf2c, 
    dst_type=0x2879bdc0, src2dst=0)
    at ../../.././../gcc-4.6.4/libstdc++-v3/libsupc++/dyncast.cc:61
#2  0x28738a41 in std::has_facet<std::ctype<char> > (__loc=@0x287a0f10)
    at locale_classes.tcc:234
#3  0x2872c08a in std::basic_ios<char, std::char_traits<char> >::_M_cache_locale
    (this=0x287a0ea4, __loc=@0x287a0f10) at basic_ios.tcc:160
#4  0x2872c139 in std::basic_ios<char, std::char_traits<char> >::init (
    this=0x287a0ea4, __sb=0x287a0aa0) at basic_ios.tcc:133
#5  0x28713528 in Init (this=0x280dcf21) at ostream:85
#6  0x287a0ea4 in std::cout () from /usr/local/lib/gcc46/libstdc++.so.6
#7  0x287a0aa0 in __gnu_internal::buf_cin_sync ()
   from /usr/local/lib/gcc46/libstdc++.so.6
#8  0x280dcf21 in IsInit () from /usr/local/lib/libIL.so.2
#9  0x00000000 in ?? ()

How-To-Repeat: % cat nop.c
int main(void) { }
% gcc46 -g nop.c -L /usr/local/lib -lIL -o nop
% ./nop
Segmentation fault (core dumped)


(Clang can also be used.)
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-02-24 07:08:25 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-ports-bugs

ports PR.
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2014-02-24 07:08:48 UTC
Responsible Changed
From-To: freebsd-ports-bugs->amdmi3

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 3 Dmitry Marakasov 2014-03-06 12:00:47 UTC
* edwin@FreeBSD.org (edwin@FreeBSD.org) wrote:

> In the 10.0-RELEASE, the IL library (from the "devil" package), when
> linked to any program, such as ``int main(void) { }'', causes the
> program to segfault before main() is entered. The backtrace is:
>
> 0x00000000 in ?? ()
> (gdb) bt
> #0 0x00000000 in ?? ()
> #1 0x28769ec4 in __dynamic_cast (src_ptr=0x287a1180,
> src_type=0x2879bf2c,
> dst_type=0x2879bdc0, src2dst=0)
> at ../../.././../gcc-4.6.4/libstdc++-v3/libsupc++/dyncast.cc:61
> #2 0x28738a41 in std::has_facet<std::ctype<char> > (__loc=@0x287a0f10)
> at locale_classes.tcc:234
> #3 0x2872c08a in std::basic_ios<char, std::char_traits<char>
> >::_M_cache_locale
> (this=0x287a0ea4, __loc=@0x287a0f10) at basic_ios.tcc:160
> #4 0x2872c139 in std::basic_ios<char, std::char_traits<char> >::init (
> this=0x287a0ea4, __sb=0x287a0aa0) at basic_ios.tcc:133
> #5 0x28713528 in Init (this=0x280dcf21) at ostream:85
> #6 0x287a0ea4 in std::cout () from /usr/local/lib/gcc46/libstdc++.so.6
> #7 0x287a0aa0 in __gnu_internal::buf_cin_sync ()
> from /usr/local/lib/gcc46/libstdc++.so.6
> #8 0x280dcf21 in IsInit () from /usr/local/lib/libIL.so.2
> #9 0x00000000 in ?? ()

With EXR option enabled, libIL can only be used from C++, presumably as
EXR support is written in C++ and the final library must be linked with
libstdc++ to work correctly. This may be fixed by switching to clang,
but broken build system of devil won't easily allow to do this. For now
I'm disabling EXR option by default, which seem to fix the problem. To
use clang, build system needs to be rewritten, which I also plan to do
when I have some time for that.

-- 
Dmitry Marakasov   .   55B5 0596 FF1E 8D84 5F56  9510 D35A 80DD F9D2 F77D
amdmi3@amdmi3.ru  ..:  jabber: amdmi3@jabber.ru    http://www.amdmi3.ru
Comment 4 dfilter service freebsd_committer freebsd_triage 2014-03-06 13:17:57 UTC
Author: amdmi3
Date: Thu Mar  6 13:17:49 2014
New Revision: 347196
URL: http://svnweb.freebsd.org/changeset/ports/347196
QAT: https://qat.redports.org/buildarchive/r347196/

Log:
  - Disable EXR by default, as with it library cannot be used from plain C programs
  
  PR:		186432
  Submitted by:	dt71 <dt71@gmx.com>

Modified:
  head/graphics/devil/Makefile

Modified: head/graphics/devil/Makefile
==============================================================================
--- head/graphics/devil/Makefile	Thu Mar  6 13:14:20 2014	(r347195)
+++ head/graphics/devil/Makefile	Thu Mar  6 13:17:49 2014	(r347196)
@@ -4,7 +4,7 @@
 PORTNAME=	devil
 PORTVERSION=	1.7.8
 PORTEPOCH=	1
-PORTREVISION=	14
+PORTREVISION=	15
 CATEGORIES=	graphics
 MASTER_SITES=	SF/openil/DevIL/${PORTVERSION}
 DISTNAME=	DevIL-${PORTVERSION}
@@ -29,8 +29,9 @@ LDFLAGS+=	-L${LOCALBASE}/lib
 
 PORTDOCS=	*
 
+# With EXR the library is not usable from plain C (instant segfault)
 OPTIONS_DEFINE=	JPEG JASPER LCMS MNG PNG TIFF EXR X11 SDL NVTT SIMD DOCS
-OPTIONS_DEFAULT=JPEG JASPER LCMS MNG PNG TIFF EXR X11 SDL NVTT
+OPTIONS_DEFAULT=JPEG JASPER LCMS MNG PNG TIFF X11 SDL NVTT
 OPTIONS_DEFAULT_amd64=SIMD
 
 JPEG_DESC=	Enable JPEG support
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2014-03-06 13:18:00 UTC
State Changed
From-To: open->closed

Committed. Thanks!