| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:content-type:content-transfer-encoding; | |
| q=dns; s=default; b=hp6pjEAZY+gx7sHUKuCzEIhiDP+EtYkSLHVH3JSWkzN | |
| f2dyUkxE3kcAWkSfubN1MS9xzl6pT0Lpn/5H+skmPVHOrCaYCP9g9828YAPMM1fK | |
| w5G2jt+U8/TMBU/PnHQk+nyCSuA/Ka7Htp0rwQLNQMIhzKPOJe5tmOh7pxvzDgu0 | |
| = | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:mime-version:in-reply-to:references:from:date | |
| :message-id:subject:to:content-type:content-transfer-encoding; | |
| s=default; bh=491VbKqyOkMr/g4u9RzcGVdxaBE=; b=bFTRZgb5KHIGaYd44 | |
| PskKvnA6VXP40GJ1aFttArcrDi2iyDOB2BDDbxoBwUbIKBGHqPjAb0f7DIgokAm2 | |
| gGDtFPFQgMZmIKeDFz8rQ9x6aj+J1odUPhqL7yfPr2YldBU7fH6nWq427AF+fE2W | |
| bkVIXQh9Qh0HETLlQ1vtBTLyKY= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=1.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 |
| X-HELO: | mail-oa0-f50.google.com |
| X-Received: | by 10.182.148.69 with SMTP id tq5mr2535067obb.97.1384281329400; Tue, 12 Nov 2013 10:35:29 -0800 (PST) |
| MIME-Version: | 1.0 |
| In-Reply-To: | <5281F8D4.4090809@gmail.com> |
| References: | <CAJygYd3KQEhdFBAYO4ONumf=FMvjH1fuiqa4b2F0XGLPBNv2Hw AT mail DOT gmail DOT com> <52815780 DOT 2010006 AT gmail DOT com> <528159F8 DOT 2070307 AT gmail DOT com> <CAJygYd2H7tyjE73=EK2hdo2ZPvWtziU8sUkbgbo5crBtP3JRHQ AT mail DOT gmail DOT com> <CAJygYd2UqXD3e-iguMUB1FUNDmCVmC5D7b1=zHqMVs1kJ8-+qw AT mail DOT gmail DOT com> <5281F8D4 DOT 4090809 AT gmail DOT com> |
| From: | Yucong Sun <sunyucong AT gmail DOT com> |
| Date: | Tue, 12 Nov 2013 10:35:09 -0800 |
| Message-ID: | <CAJygYd2TZkAnOFf67TEuQd0_V9Sgz8ZaZwVrVH6tusxRni-r3A@mail.gmail.com> |
| Subject: | Re: C++11 program link failure under GCC 4.8.2-1 |
| To: | cygwin <cygwin AT cygwin DOT com> |
| X-IsSubscribed: | yes |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id rACIa6rs006988 |
Good new! I've found the link failure issue, it is caused by "-rdynamic"
sunyc AT sunyc-wks ~
$ cat 2.cc
#include <deque>
struct tick_event {
int i;
};
int main() {
std::deque<tick_event *> list;
tick_event *a = new tick_event;
list.push_back(a);
return 0;
}
sunyc AT sunyc-wks ~
$ g++ -c --std=c++11 -O3 -flto 2.cc -o 2.o
sunyc AT sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -rdynamic -fno-omit-frame-pointer -D_GNU_
SOURCE -march=native -O3 2.o -o a
Cannot export _ZNSt5dequeIP10tick_eventSaIS1_EE16_M_push_back_auxIJRKS1_EEEvDpOT
_: symbol wrong type (4 vs 3)
collect2: error: ld returned 1 exit status
sunyc AT sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -fno-omit-frame-pointer -D_GNU_SOURCE -ma
rch=native -O3 2.o -o a
sunyc AT sunyc-wks ~
$
Hope it would help you nail the problem.
And Here's the test case for snprintf & c++11
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/co
nfigure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --
prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdi
r=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --lib
dir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=x86
_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libico
nv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enab
le-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__
cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lt
o,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --ena
ble-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support -
-enable-libssp --enable-libgcj-sublibs --disable-java-awt --disable-symvers --wi
th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-incl
ude=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --
with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)
sunyc AT sunyc-wks ~
$ cat 1.cc
#include <stdio.h>
int main() {
char out[255];
snprintf(out, sizeof(out), "%d", 1);
return 1;
}
sunyc AT sunyc-wks ~
$ g++ --std=c++11 1.cc
1.cc: In function ‘int main()’:
1.cc:5:36: error: ‘snprintf’ was not declared in this scope
snprintf(out, sizeof(out), "%d", 1);
^
sunyc AT sunyc-wks ~
$ g++ --std=gnu++0x 1.cc
sunyc AT sunyc-wks ~
$ ls -lah a.exe
-rwxr-xr-x 1 sunyc None 62K Nov 12 10:21 a.exe
Cheers.
On Tue, Nov 12, 2013 at 1:45 AM, JonY <10walls AT gmail DOT com> wrote:
> On 11/12/2013 10:33, Yucong Sun wrote:
>> I've tried on both 32bit and 64bit clean cygwin install, the result is
>> same. Something is wrong with cygwin's gcc.
>>
>> my configure script by default uses g++ --std=c++11, this still have
>> problem of " no snprintf " , after I replace all snprintf() with
>> sprintf() , I've met the same linkage problem again.
>>
>
> Something else is very wrong.
>
>> g++ --std=gnu++0x "fixes" the snprintf problem, but it still have same
>> linkage problem.
>>
>
> Please make a minimalist case, I've tried some basic C++11 features but
> I don't get such errors.
>
>
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |