From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Vong Subject: Re: [PATCH 1/2] daemon: Fix '--version'. Date: Thu, 01 Sep 2016 14:23:51 +0800 Message-ID: <87pooo3zpk.fsf@gmail.com> References: <87fupvx83x.fsf@gmail.com> <87vayjy2nq.fsf@gnu.org> <8760qi282l.fsf@gmail.com> <877fawk5fv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bfLPv-0007ix-8v for guix-devel@gnu.org; Thu, 01 Sep 2016 02:24:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bfLPr-00011I-UY for guix-devel@gnu.org; Thu, 01 Sep 2016 02:24:03 -0400 In-Reply-To: <877fawk5fv.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 31 Aug 2016 23:13:24 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org Hi Ludovic, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Hi Alex, > > Alex Vong skribis: > [...] > >> I get this output instead: >> >> $ LC_ALL=3DC ./guix-daemon --version >> ./guix-daemon: unrecognized option '--version' >> Try `guix-daemon --help' or `guix-daemon --usage' for more information. >> >> This is werid, but I think it is because I build guix with lto. > > What about the attached program? It works for me with GCC 6.2.0, both > with and without LTO. > > Ludo=E2=80=99. > > #include > > const char *argp_program_version =3D "foo"; > const char *argp_program_bug_address =3D "foo@example.org"; > > static const struct argp_option options[] =3D > { > { "system", 's', "SYSTEM", 0, > "assume SYSTEM as the current system type" }, > { 0, 0, 0, 0, 0 } > }; > > static const struct argp argp =3D > { > options, NULL, > NULL, "doc", > NULL, NULL, > NULL > }; > > int > main (int argc, char *argv[]) > { > argp_parse (&argp, argc, argv, 0, 0, 0); > return 0; > } I think you have isolated the problem! This test case does not work for me. I get the following output after building with (g++ -O2 -flto version.cxx): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D alexvong1995@debian:~/c++$ ./a.out --version ./a.out: unrecognized option '--version' Try `a.out --help' or `a.out --usage' for more information. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D alexvong1995@debian:~/c++$ ./a.out --help Usage: a.out [OPTION...] doc -s, --system=3DSYSTEM assume SYSTEM as the current system type -?, --help Give this help list --usage Give a short usage message Mandatory or optional arguments to long options are also mandatory or optio= nal for any corresponding short options. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D My gcc version is also 6.2.0: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D alexvong1995@debian:~/c++$ LC_ALL=3DC g++ --version g++ (GCC) 6.2.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Running strace show the following output (ltrace output is not intersting): =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D alexvong1995@debian:~/c++$ strace ./a.out --version execve("./a.out", ["./a.out", "--version"], [/* 71 vars */]) =3D 0 brk(0) =3D 0xf63000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = =3D 0x7fc8f6b26000 access("/etc/ld.so.preload", R_OK) =3D -1 ENOENT (No such file or dire= ctory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/x86_64= /libstdc++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or direct= ory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/x86_64= ", 0x7fff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/libstd= c++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls", 0x7f= ff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/x86_64/lib= stdc++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/x86_64", 0= x7fff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libstdc++.= so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib", {st_mode= =3DS_IFDIR|0555, st_size=3D4096, ...}) =3D 0 open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/x86= _64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or dir= ectory) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/x86= _64", 0x7fff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/lib= stdc++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directory) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls", 0= x7fff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/x86_64/= libstdc++.so.6", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directo= ry) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/x86_64"= , 0x7fff93fa35f0) =3D -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/libstdc= ++.so.6", O_RDONLY|O_CLOEXEC) =3D 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\255\10\0\0\0\0\0= "..., 832) =3D 832 fstat(3, {st_mode=3DS_IFREG|0555, st_size=3D2032024, ...}) =3D 0 mmap(NULL, 3666688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = =3D 0x7fc8f6586000 mprotect(0x7fc8f66f7000, 2093056, PROT_NONE) =3D 0 mmap(0x7fc8f68f6000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP= _DENYWRITE, 3, 0x170000) =3D 0x7fc8f68f6000 mmap(0x7fc8f6902000, 13056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP= _ANONYMOUS, -1, 0) =3D 0x7fc8f6902000 close(3) =3D 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libm.so.6"= , O_RDONLY|O_CLOEXEC) =3D 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`U\0\0\0\0\0\0"..., = 832) =3D 832 fstat(3, {st_mode=3DS_IFREG|0555, st_size=3D1141048, ...}) =3D 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = =3D 0x7fc8f6b25000 mmap(NULL, 3166528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = =3D 0x7fc8f6280000 mprotect(0x7fc8f6385000, 2093056, PROT_NONE) =3D 0 mmap(0x7fc8f6584000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_= DENYWRITE, 3, 0x104000) =3D 0x7fc8f6584000 close(3) =3D 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libgcc_s.s= o.1", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/libgcc_= s.so.1", O_RDONLY|O_CLOEXEC) =3D 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p*\0\0\0\0\0\0"..., = 832) =3D 832 fstat(3, {st_mode=3DS_IFREG|0444, st_size=3D100680, ...}) =3D 0 mmap(NULL, 2185584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = =3D 0x7fc8f606a000 mprotect(0x7fc8f6080000, 2093056, PROT_NONE) =3D 0 mmap(0x7fc8f627f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_= DENYWRITE, 3, 0x15000) =3D 0x7fc8f627f000 close(3) =3D 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libc.so.6"= , O_RDONLY|O_CLOEXEC) =3D 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \t\2\0\0\0\0\0"...,= 832) =3D 832 fstat(3, {st_mode=3DS_IFREG|0555, st_size=3D1942128, ...}) =3D 0 mmap(NULL, 3808896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = =3D 0x7fc8f5cc8000 mprotect(0x7fc8f5e61000, 2093056, PROT_NONE) =3D 0 mmap(0x7fc8f6060000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP= _DENYWRITE, 3, 0x198000) =3D 0x7fc8f6060000 mmap(0x7fc8f6066000, 16000, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP= _ANONYMOUS, -1, 0) =3D 0x7fc8f6066000 close(3) =3D 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = =3D 0x7fc8f6b24000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = =3D 0x7fc8f6b22000 arch_prctl(ARCH_SET_FS, 0x7fc8f6b22740) =3D 0 mprotect(0x7fc8f6060000, 16384, PROT_READ) =3D 0 mprotect(0x7fc8f6584000, 4096, PROT_READ) =3D 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = =3D 0x7fc8f6b21000 mprotect(0x7fc8f68f6000, 40960, PROT_READ) =3D 0 mprotect(0x7fc8f6b28000, 4096, PROT_READ) =3D 0 brk(0) =3D 0xf63000 brk(0xf95000) =3D 0xf95000 write(2, "./a.out: unrecognized option '--"..., 41./a.out: unrecognized opt= ion '--version' ) =3D 41 write(2, "Try `a.out --help' or `a.out --u"..., 60Try `a.out --help' or `a.= out --usage' for more information. ) =3D 60 exit_group(64) =3D ? +++ exited with 64 +++ =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Do you have any idea? Thanks, Alex