[Vxl-maintainers] RE: [Cmake] command to build dynamic lib ch anged causing my VXL b uild to brea k

William A. Hoffman billlist at nycap.rr.com
Mon Jan 14 11:57:58 EST 2002


So, it is just vcl_ostream_iterator+int-.o and vcl_vector+bool-.o that cause the trouble?

HMMMM.....

I was looking at these two files and found this:

#if !defined(VCL_SGI_CC) && !defined(WIN32) && !defined(GNU_LIBSTDCXX_V3) 
template class vcl_ostream_iterator<int>;
#endif


// SunPro 5.0 provides vector<bool> as a specialization of vector<T>.
// Ditto for GNU lib v3.
namespace {
  void tic(int nargs) {
    vcl_vector<bool> done_once(nargs, false);
  }


If you notice, these files should be empty for LIBSTDCXX_V3 which is what I think that
GCC 3.0 uses.  However, I bet that this: GNU_LIBSTDCXX_V3 is not defined.
So, I think the bug may be in vcl and not cmake.  Both of these files should be empty for
the compiler/library you are using, but apparently they are not....


-Bill


At 11:00 AM 1/14/2002 -0500, you wrote:

>I have not found out anything new that helps.  
>
>I realized this morning that I was compiling on Solaris 2.8, but had built gcc on Solaris 2.7.  But,
>no luck, I was able to repeat the problem this morning on 2.7.
>
>As I noted earlier, turning off -O2 fixes the problem.  Also, which objects are put into the shared
>lib affects the problem.  In my demo I built the shared lib with two object files.  If I eliminated
>either one the problem went away.  So, it seems to be just those objects, or some combination of
>them.  I hope that is helpful to you.  Does this make you think compiler problem?
>
>Fred Wheeler
>
>--
>Fred Wheeler, GE CRD, KWC-303
>Phone: 518-387-7225 (GE Internal Dialcom: 8*833-7225)
>Fax:   518-387-4042 (GE Internal Dialcom: 8*833-4042)
>
>
>-----Original Message-----
>From: William A. Hoffman [mailto:billlist at nycap.rr.com]
>Sent: Monday, January 14, 2002 10:48 AM
>To: Wheeler, Fred (CRD)
>Subject: Re: [Vxl-maintainers] RE: [Cmake] command to build dynamic lib
>changed causing my VXL b uild to brea k
>
>
>Have you found any thing else about this problem?
>
>Is it just those vcl objects, or is it any objects?
>
>We would like to make a cmake release soon, so I would like to clear this up ASAP.
>
>-Bill
>
>
>At 10:01 AM 1/13/2002 -0500, you wrote:
>>Brad, Peter,
>>
>>Thanks for your replies.  Brad's idea that I might have a mixed batch of .o files is a good one, but
>>I guarded against that.  I can demo the problem I am seeing with the commands below.  I'm finding
>>some more strange behavior described in the comments that start with "!!!". Note that optimization
>>(whether -O2 is used or not) affects this, and that the problem only happens when I use both objects
>>in the demo below.
>>
>>Brad noted that the compiler should know whether the object file it is creating will go in a shared
>>or non-shared library.  Makes sense to me, but it looks to me like cmake started using "-shared
>>-nostdlib" for creating the shared lib, but did not change the command line for creating object
>>files.  Right?
>>
>># demo
>>cd /tmp
>>VXLSRC=/no_backup/wheeler/prj/sr/vxl_src
>>
>># !!! the problem does not occur if either of these object files is removed from the library
>>
>># build vcl_ostream_iterator+int-.o
>>c++ -g -O2 -Wall -Dvcl_EXPORTS -fPIC -I$VXLSRC/vcl -I/no_backup/wheeler/prj/sr/vxl_bld/vcl
>>-I/no_backup/wheeler/prj/sr/vxl_bld/vxl -I$VXLSRC/vcl -DVXL_WARN_DEPRECATED
>>-DVXL_WARN_DEPRECATED_ONCE -c $VXLSRC/vcl/Templates/vcl_ostream_iterator+int-.cxx -o
>>vcl_ostream_iterator+int-.o
>>
>># build vcl_vector+bool-.o
>># !!! if I remove the -O2 option - no bus error
>>c++ -g -O2 -Wall -Dvcl_EXPORTS -fPIC -I$VXLSRC/vcl -I/no_backup/wheeler/prj/sr/vxl_bld/vcl
>>-I/no_backup/wheeler/prj/sr/vxl_bld/vxl -I$VXLSRC/vcl -DVXL_WARN_DEPRECATED
>>-DVXL_WARN_DEPRECATED_ONCE -c $VXLSRC/vcl/Templates/vcl_vector+bool-.cxx -o vcl_vector+bool-.o
>>
>># a minimal main
>>cat<<EOF >| foo.cxx
>>int main() { return 0; }
>>EOF
>>
>>c++ -g -O2 -c foo.cxx -o foo.o
>>
>># with this option there is no bus error
>>OPT="-Wl,-G"
>># with this option the exec will produce a bus error
>>OPT="-shared -nostdlib"
>>
>># build vcl library with only two objects
>>c++ -v $OPT -g -O2 -o /tmp/libvcl.so \
>>  vcl_ostream_iterator+int-.o \
>>  vcl_vector+bool-.o
>>
>># link
>>c++ foo.o -L/tmp -lvcl -Wl,-R,/tmp: -o foo
>>
>># run, bus error will occur here is "-shared -nostdlib" was used
>>./foo
>>
>># if there was a bus error, gdb yeilds garbage (otherwise it works)
>>138% gdb foo
>>GNU gdb 5.1
>>(gdb) break main
>>Breakpoint 1 at 0x10700: file foo.cxx, line 1.
>>(gdb) run
>>Starting program: /tmp/foo 
>>
>>Program received signal SIGSEGV, Segmentation fault.
>>0xff3c9e84 in ?? ()
>>(gdb) where
>>#0  0xff3c9e84 in ?? ()
>>#1  0xff3c3bdc in ?? ()
>>#2  0xff3b2ea0 in ?? ()
>>#3  0xff3ba8cc in ?? ()
>>#4  0xff3c4da0 in ?? ()
>>#5  0xff3b2958 in ?? ()
>>(gdb) 
>>
>>
>>Fred Wheeler
>>
>>--
>>Fred Wheeler, GE CRD, KWC-303
>>Phone: 518-387-7225 (GE Internal Dialcom: 8*833-7225)
>>Fax:   518-387-4042 (GE Internal Dialcom: 8*833-4042)
>>
>>
>>-----Original Message-----
>>From: Brad King [mailto:brad.king at kitware.com]
>>Sent: Saturday, January 12, 2002 8:57 PM
>>To: Wheeler, Fred (CRD)
>>Cc: 'vxl-maintainers at lists.sourceforge.net'; 'cmake at public.kitware.com'
>>Subject: Re: [Cmake] command to build dynamic lib changed causing my VXL
>>build to brea k
>>
>>
>>Fred,
>>
>>> Sometime over the past week or two CMake started producing makefiles
>>> that use the "-shared -nostdlib" options instead of "-Wl,-G" to link
>>> objects into a shared library (*.so).  With this change all of VXL
>>> still builds for me, but just about all executables produced in the
>>> VXL tree stop with a Bus Error immediately after starting.  
>>> Everything build fine, but nothing runs.  Strange.
>>We recently switched the flags from -Wl,-G to -shared -nostdlib to solve
>>other problems.  The -shared flag is the correct choice..."-Wl,-G" tells
>>the C++ compiler to pass the "-G" option to the linker, which tells it to
>>create a shared library.  However, the C++ compiler then does not know
>>that the code it is generating is going into a shared library, so it
>>doesn't put in the correct static data initialization code (to call
>>constructors of static data, etc).  The -shared option tells the compiler
>>to put in the proper init code, and automatically causes it to pass the -G
>>option on to the linker.
>>
>>Have you done a complete re-build of VXL in a clean directory?  Your
>>problems may be caused by some .o files or libraries being built with the
>>old flags, and some with the new.
>>
>>-Brad
>>
>>_______________________________________________
>>Vxl-maintainers mailing list
>>Vxl-maintainers at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/vxl-maintainers 




More information about the CMake mailing list