public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62192] New: Segmentation fault when linking with Qt libraries
@ 2014-08-19 18:34 lakjdsfiudslkfj at mailinator dot com
  2024-04-06  4:58 ` [Bug c++/62192] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: lakjdsfiudslkfj at mailinator dot com @ 2014-08-19 18:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62192

            Bug ID: 62192
           Summary: Segmentation fault when linking with Qt libraries
           Product: gcc
           Version: 4.7.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lakjdsfiudslkfj at mailinator dot com

Created attachment 33363
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33363&action=edit
gdb backtrace

Hi,

I'm currently having some difficulties linking to my library when my main
executable is linked with some Qt libraries. I'm running FreeBSD 10 and gcc47
but the latest 410 package for FreeBSD exhibits the same behavior.

My main.cc looks like this:

---
#include "foo.h"

int main() {
  foo();
}
---

My library libfoo consists of a file foo.cc:

---
#include <string>
#include <iostream>

void foo() {
  std::string lol = "test";
  std::cout << lol << std::endl;;
}
---

foo.h for completeness:
--
void foo();
--

and is compiled via
g++ -g -c -fPIC foo.cc -o libfoo.o
g++ -shared -fPIC libfoo.o -o libfoo.so

After this my main.cc is compiled/linked:

g++ -g -O0 -I/tmp/delme2 -DQT_SHARED -I/usr/local/include/qt4
-I/usr/local/include/qt4/QtCore -L/usr/local/lib/qt4 -lQtCore -L/tmp/delme2
-lfoo main.cc

running a.out yields "segmentation fault (core dumped)  ./a.out"

with clang++ -g -O0 -I/tmp/delme2 -DQT_SHARED -I/usr/local/include/qt4
-I/usr/local/include/qt4/QtCore -L/usr/local/lib/qt4 -lQtCore -L/tmp/delme2
-lfoo main.cc

the output is "test" as expected.

It also works when I remove the Qt libraries, i.e.
g++ -g -O0 -I/usr/local/include -I/tmp/delme2 -L/tmp/delme2 -lfoo main.cc

Am I doing something wrong here? Is it a Qt problem rather than gcc? But why
does it work with clang then? I attached a GDB backtrace just in case.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/62192] Segmentation fault when linking with Qt libraries
  2014-08-19 18:34 [Bug c++/62192] New: Segmentation fault when linking with Qt libraries lakjdsfiudslkfj at mailinator dot com
@ 2024-04-06  4:58 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-06  4:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62192

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Without a self-contained testcase it is hard to debug this. Especially when it
needs a libQT. Also this could have been a freebsd libc/ld.so issue too.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-06  4:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-19 18:34 [Bug c++/62192] New: Segmentation fault when linking with Qt libraries lakjdsfiudslkfj at mailinator dot com
2024-04-06  4:58 ` [Bug c++/62192] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).