Hi Ludovic, l...@gnu.org (Ludovic Courtès) writes:
> Hi Alex, > > Alex Vong <alexvong1...@gmail.com> skribis: > [...] > >> I get this output instead: >> >> $ LC_ALL=C ./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’. > > #include <argp.h> > > const char *argp_program_version = "foo"; > const char *argp_program_bug_address = "f...@example.org"; > > static const struct argp_option options[] = > { > { "system", 's', "SYSTEM", 0, > "assume SYSTEM as the current system type" }, > { 0, 0, 0, 0, 0 } > }; > > static const struct argp argp = > { > 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): ============================================================================== alexvong1995@debian:~/c++$ ./a.out --version ./a.out: unrecognized option '--version' Try `a.out --help' or `a.out --usage' for more information. =========================================================================== alexvong1995@debian:~/c++$ ./a.out --help Usage: a.out [OPTION...] doc -s, --system=SYSTEM 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 optional for any corresponding short options. =========================================================================== My gcc version is also 6.2.0: =========================================================================== alexvong1995@debian:~/c++$ LC_ALL=C 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. =========================================================================== Running strace show the following output (ltrace output is not intersting): =========================================================================== alexvong1995@debian:~/c++$ strace ./a.out --version execve("./a.out", ["./a.out", "--version"], [/* 71 vars */]) = 0 brk(0) = 0xf63000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6b26000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/x86_64", 0x7fff93fa35f0) = -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/tls", 0x7fff93fa35f0) = -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/x86_64", 0x7fff93fa35f0) = -1 ENOENT (No such file or directory) open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/x86_64/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/x86_64", 0x7fff93fa35f0) = -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/tls", 0x7fff93fa35f0) = -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) = -1 ENOENT (No such file or directory) stat("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/x86_64", 0x7fff93fa35f0) = -1 ENOENT (No such file or directory) open("/gnu/store/v9r00bv3ivimpr0nzhaas3rsqaa5xvbw-gcc-6.2.0-lib/lib/libstdc++.so.6", O_RDONLY|O_CLOEXEC) = 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) = 832 fstat(3, {st_mode=S_IFREG|0555, st_size=2032024, ...}) = 0 mmap(NULL, 3666688, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc8f6586000 mprotect(0x7fc8f66f7000, 2093056, PROT_NONE) = 0 mmap(0x7fc8f68f6000, 49152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x170000) = 0x7fc8f68f6000 mmap(0x7fc8f6902000, 13056, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6902000 close(3) = 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 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) = 832 fstat(3, {st_mode=S_IFREG|0555, st_size=1141048, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6b25000 mmap(NULL, 3166528, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc8f6280000 mprotect(0x7fc8f6385000, 2093056, PROT_NONE) = 0 mmap(0x7fc8f6584000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x104000) = 0x7fc8f6584000 close(3) = 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = -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) = 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) = 832 fstat(3, {st_mode=S_IFREG|0444, st_size=100680, ...}) = 0 mmap(NULL, 2185584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc8f606a000 mprotect(0x7fc8f6080000, 2093056, PROT_NONE) = 0 mmap(0x7fc8f627f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fc8f627f000 close(3) = 0 open("/gnu/store/m9vxvhdj691bq1f85lpflvnhcvrdilih-glibc-2.23/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 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) = 832 fstat(3, {st_mode=S_IFREG|0555, st_size=1942128, ...}) = 0 mmap(NULL, 3808896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc8f5cc8000 mprotect(0x7fc8f5e61000, 2093056, PROT_NONE) = 0 mmap(0x7fc8f6060000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x198000) = 0x7fc8f6060000 mmap(0x7fc8f6066000, 16000, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6066000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6b24000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6b22000 arch_prctl(ARCH_SET_FS, 0x7fc8f6b22740) = 0 mprotect(0x7fc8f6060000, 16384, PROT_READ) = 0 mprotect(0x7fc8f6584000, 4096, PROT_READ) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8f6b21000 mprotect(0x7fc8f68f6000, 40960, PROT_READ) = 0 mprotect(0x7fc8f6b28000, 4096, PROT_READ) = 0 brk(0) = 0xf63000 brk(0xf95000) = 0xf95000 write(2, "./a.out: unrecognized option '--"..., 41./a.out: unrecognized option '--version' ) = 41 write(2, "Try `a.out --help' or `a.out --u"..., 60Try `a.out --help' or `a.out --usage' for more information. ) = 60 exit_group(64) = ? +++ exited with 64 +++ =========================================================================== Do you have any idea? Thanks, Alex