RE: Strange behavior of my program linked with -static option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Exactly the same problem exists with GCC 3.4.3!
I have no idea what to do...



> Hello!
>
> I have a pretty big program written in C++. It is complicated enough and
> it uses C++ exceptions, pthreads and a set of 3-d party libraries. As far
> as I compile it with dynamic linking with gcc libraries, I have
> no problems.
> It works fine. Problem arises when I add '-static' option to the linker.
> The program is able to run, but it works in a very strange way. Signal
> handlers do not handle signals. When I run it in background mode (the
> program
> then forks and the parent dies, but the child continues its execution)
> I accidentally get 9 instances instead of 1.
>
> I have to say that I'm not very familiar with gcc and its huge set of
> compiler
> options, so it's possible that I missed something... But I suspect that it
> may
> be a problem with gcc itself (when I use dynamic linking everything works
> fine!).
>
> I have looked around and found several links with similar problems (so I'm
> not alone)
> http://gcc.gnu.org/ml/gcc-help/2002-01/msg00199.html
> http://www.monkey.org/openbsd/archive/bugs/0103/msg00129.html
>
> But examples at these links work fine for me because (I suspect)
> I use other
> version of gcc (3.2.2 comparing with 2.9x.x and 3.0.x). And note
> that nobody
> proposed a solution to the problem discussed...
>
> My environment:
> gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
> Red Hat Linux 9, kernel 2.4.20-8
>
> Flags:
> CFLAGS   = -DC_NO_PIC_NO_DLL -O3 -Wall -Wno-deprecated
> $(INCLUDE_DIRECTIVES_GCC) -DEL_DEBUG=$(EL_DEBUG)
> -fomit-frame-pointer -fno-s
> trict-aliasing -Wno-unused -Wno-uninitialized -DHAVE_ALLOCA_H
> -DC_STACK_GROW
> S_DOWNWARD=1 -DC_USE_C_DEFAULTS -DC_EMBEDDED
> CPPFLAGS = -O3 -Wall -Wno-deprecated  $(INCLUDE_DIRECTIVES_GCC)
> LFLAGS
>
>
> = -O3 -L$(PP)/libs/pg -L$(PP)/libs/expat -L$(PP)/libs/chicken
> -L$(PP)/libs/b
> oost -static -lpccts -lpthread -lnsl -lcurses -lexpat -lchicken
> -lstuffed-ch
> icken -lsrfi-chicken -lboost_regex-gcc-1_31
>
>
> I hope somebody can guide me to the solution of the problem. Is there any
> magic
> with gcc options that might help?
>
> P.S. Now I'm trying to switch to the latest gcc release. I'll let you know
> about results.
>
> Thanks in advance,
> Andrey
>
>



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux