public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "lakjdsfiudslkfj at mailinator dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/62192] New: Segmentation fault when linking with Qt libraries Date: Tue, 19 Aug 2014 18:34:00 -0000 [thread overview] Message-ID: <bug-62192-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2014-08-19 18:34 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-08-19 18:34 lakjdsfiudslkfj at mailinator dot com [this message] 2024-04-06 4:58 ` [Bug c++/62192] " pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-62192-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).