From owner-freebsd-current@FreeBSD.ORG Thu May 5 17:30:21 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E02F4106564A; Thu, 5 May 2011 17:30:20 +0000 (UTC) (envelope-from olivier@gid0.org) Received: from mail-px0-f176.google.com (mail-px0-f176.google.com [209.85.212.176]) by mx1.freebsd.org (Postfix) with ESMTP id B3C7C8FC19; Thu, 5 May 2011 17:30:20 +0000 (UTC) Received: by pxi11 with SMTP id 11so1846059pxi.7 for ; Thu, 05 May 2011 10:30:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.4.129 with SMTP id k1mr3431581pbk.72.1304616619164; Thu, 05 May 2011 10:30:19 -0700 (PDT) Received: by 10.68.40.4 with HTTP; Thu, 5 May 2011 10:30:19 -0700 (PDT) In-Reply-To: <20110505155551.GA99006@freebsd.org> References: <201105040107.p4417NTR048534@pozo.com> <4DC0F46C.3020806@FreeBSD.org> <201105041344.p44DiOId032272@pozo.com> <4DC160B9.5060004@FreeBSD.org> <4DC2A0E5.5040602@zedat.fu-berlin.de> <20110505135458.GA79622@freebsd.org> <20110505155551.GA99006@freebsd.org> Date: Thu, 5 May 2011 19:30:19 +0200 Message-ID: From: Olivier Smedts To: Roman Divacky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "O. Hartmann" , current@freebsd.org Subject: Re: Clang error make buildworld X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 17:30:21 -0000 2011/5/5 Roman Divacky : > Can you invoke this very same command (ie. linking) with -### and show me= ? > Does it work when you try to link the same .o files without specifying > -march=3Dnative ? My system has previously been compiled with clang and "-march=3Dcore2". It's a corei7. With "-march=3Dnative" in make.conf, after the failed buildworld I cd in /usr/obj/usr/src/libexec/atrun/ and : # clang -O2 -pipe -march=3Dnative -fomit-frame-pointer -DATJOB_DIR=3D\"/var/at/jobs/\" -DLFILE=3D\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\" -DVERSION=3D\"2.9\" -DDAEMON_UID=3D1 -DDAEMON_GID=3D1 -DDEFAULT_BATCH_QUEUE=3D\'E\' -DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -o atrun atrun.o gloadavg.o -lpam -lutil clang: warning: argument unused during compilation: '-std=3Dgnu99' OK # /usr/obj/usr/src/tmp/usr/bin/clang -O2 -pipe -march=3Dnative -fomit-frame-pointer -DATJOB_DIR=3D\"/var/at/jobs/\" -DLFILE=3D\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\" -DVERSION=3D\"2.9\" -DDAEMON_UID=3D1 -DDAEMON_GID=3D1 -DDEFAULT_BATCH_QUEUE=3D\'E\' -DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -o atrun atrun.o gloadavg.o -lpam -lutil FAIL (clang: error: linker command failed with exit code 1 (use -v to see invocation)) # /usr/obj/usr/src/tmp/usr/bin/clang -O2 -pipe -march=3Dnative -fomit-frame-pointer -DATJOB_DIR=3D\"/var/at/jobs/\" -DLFILE=3D\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\" -DVERSION=3D\"2.9\" -DDAEMON_UID=3D1 -DDAEMON_GID=3D1 -DDEFAULT_BATCH_QUEUE=3D\'E\' -DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -o atrun atrun.o gloadavg.o -lpam -lutil -### FreeBSD clang version 3.0 (trunk 130700) 20110502 Target: x86_64-undermydesk-freebsd9.0 Thread model: posix clang: warning: argument unused during compilation: '-std=3Dgnu99' "/usr/obj/usr/src/tmp/usr/bin/ld" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld-elf.so.1" "-o" "atrun" "/usr/obj/usr/src/tmp/usr/lib/crt1.o" "/usr/obj/usr/src/tmp/usr/lib/crti.o" "/usr/obj/usr/src/tmp/usr/lib/crtbegin.o" "-L/usr/obj/usr/src/tmp/usr/lib" "atrun.o" "gloadavg.o" "-lpam" "-lutil" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/obj/usr/src/tmp/usr/lib/crtend.o" "/usr/obj/usr/src/tmp/usr/lib/crtn.o" Using the bootstrap clang (compiled with -march=3Dnative) and trying to compile atrun, this time using -march=3Dcore2 : # /usr/obj/usr/src/tmp/usr/bin/clang -O2 -pipe -march=3Dcore2 -fomit-frame-pointer -DATJOB_DIR=3D\"/var/at/jobs/\" -DLFILE=3D\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=3D1.5 -DATSPOOL_DIR=3D\"/var/at/spool\" -DVERSION=3D\"2.9\" -DDAEMON_UID=3D1 -DDAEMON_GID=3D1 -DDEFAULT_BATCH_QUEUE=3D\'E\' -DDEFAULT_AT_QUEUE=3D\'c\' -DPERM_PATH=3D\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=3Dgnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -o atrun atrun.o gloadavg.o -lpam -lutil FAIL (same error) When trying to compile the "Host.cpp" you provided (which compiled fine with my system's clang and gcc), still with the bootstrap clang : # /usr/obj/usr/src/tmp/usr/bin/clang -v Host.cpp FreeBSD clang version 3.0 (trunk 130700) 20110502 Target: x86_64-undermydesk-freebsd9.0 Thread model: posix "/usr/obj/usr/src/tmp/usr/bin/clang" -cc1 -triple x86_64-undermydesk-freebsd9.0 -emit-obj -mrelax-all -disable-free -main-file-name Host.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-leaf-frame-pointer -v -resource-dir /usr/obj/usr/src/tmp/usr/bin/../lib/clang/3.0 -fdeprecated-macro -ferror-limit 19 -fmessage-length 236 -fcxx-exceptions -fexceptions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-6ijoGC.o -x c++ Host.cpp clang -cc1 version 3.0 based upon llvm 3.0svn hosted on x86_64-undermydesk-freebsd9.0 ignoring nonexistent directory "/usr/obj/usr/src/tmp/usr/include/c++/4.2/backward/backward" ignoring nonexistent directory "/usr/obj/usr/src/tmp/usr/bin/../lib/clang/3.0/include" ignoring duplicate directory "/usr/obj/usr/src/tmp/usr/include/c++/4.2" ignoring duplicate directory "/usr/obj/usr/src/tmp/usr/include/c++/4.2/back= ward" ignoring duplicate directory "/usr/obj/usr/src/tmp/usr/include/c++/4.2/back= ward" #include "..." search starts here: #include <...> search starts here: /usr/obj/usr/src/tmp/usr/include/c++/4.2 /usr/obj/usr/src/tmp/usr/include/c++/4.2/backward /usr/obj/usr/src/tmp/usr/include/clang/3.0 /usr/obj/usr/src/tmp/usr/include End of search list. "/usr/obj/usr/src/tmp/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 -o a.out /usr/obj/usr/src/tmp/usr/lib/crt1.o /usr/obj/usr/src/tmp/usr/lib/crti.o /usr/obj/usr/src/tmp/usr/lib/crtbegin.o -L/usr/obj/usr/src/tmp/usr/lib /tmp/cc-6ijoGC.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/obj/usr/src/tmp/usr/lib/crtend.o /usr/obj/usr/src/tmp/usr/lib/crtn.o /usr/obj/usr/src/tmp/usr/lib/crt1.o: In function `_start': /usr/src/lib/csu/amd64/crt1.c:(.text+0x5d): undefined reference to `atexit' /usr/src/lib/csu/amd64/crt1.c:(.text+0x64): undefined reference to `_init_t= ls' /usr/src/lib/csu/amd64/crt1.c:(.text+0x6e): undefined reference to `atexit' /usr/src/lib/csu/amd64/crt1.c:(.text+0x88): undefined reference to `exit' /tmp/cc-6ijoGC.o: In function `__cxx_global_var_init': Host.cpp:(.text+0xc): undefined reference to `std::ios_base::Init::~Init()' Host.cpp:(.text+0x30): undefined reference to `std::ios_base::Init::Init()' Host.cpp:(.text+0x41): undefined reference to `__cxa_atexit' /tmp/cc-6ijoGC.o: In function `getHostCPUName()': Host.cpp:(.text+0xcb): undefined reference to `std::allocator::allocator()' Host.cpp:(.text+0xe3): undefined reference to `std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)' Host.cpp:(.text+0xf1): undefined reference to `std::allocator::~allocator()' Host.cpp:(.text+0x112): undefined reference to `std::allocator::~allocator()' Host.cpp:(.text+0x2b5): undefined reference to `memcmp' Host.cpp:(.text+0x32a): undefined reference to `std::allocator::allocator()' [...] Host.cpp:(.text+0x13db): undefined reference to `std::allocator::~allocator()' Host.cpp:(.text+0x13ff): undefined reference to `std::allocator::~allocator()' Host.cpp:(.text+0x141a): undefined reference to `std::allocator::allocator()' Host.cpp:(.text+0x1432): undefined reference to `std::basic_string, std::allocator >::basic_string(char const*, std::allocator const&)' Host.cpp:(.text+0x1443): undefined reference to `std::allocator::~allocator()' Host.cpp:(.text+0x1467): undefined reference to `std::allocator::~allocator()' /tmp/cc-6ijoGC.o: In function `main': Host.cpp:(.text+0x15b7): undefined reference to `std::cout' Host.cpp:(.text+0x15c1): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' Host.cpp:(.text+0x15e2): undefined reference to `std::basic_ostream >& std::operator<< , std::allocator >(std::basic_ostream >&, std::basic_string, std::allocator > const&)' Host.cpp:(.text+0x15f9): undefined reference to `std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*)' Host.cpp:(.text+0x160b): undefined reference to `std::basic_string, std::allocator >::~basic_string()' Host.cpp:(.text+0x162c): undefined reference to `std::basic_string, std::allocator >::~basic_string()' Host.cpp:(.text+0x1644): undefined reference to `std::terminate()' /tmp/cc-6ijoGC.o:(.eh_frame+0x47): undefined reference to `__gxx_personalit= y_v0' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `memcpy' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `malloc' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `abort' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `dl_iterate_phdr' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `memset' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `strlen' /usr/obj/usr/src/tmp/usr/lib/libgcc_s.so: undefined reference to `free' clang: error: linker command failed with exit code 1 (use -v to see invocat= ion) --=20 Olivier Smedts=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 _ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 ASCII ribbon campaign ( ) e-mail: olivier@gid0.org=A0 =A0 =A0 =A0 - against HTML email & vCards=A0 X www: http://www.gid0.org=A0 =A0 - against proprietary attachments / \ =A0 "Il y a seulement 10 sortes de gens dans le monde : =A0 ceux qui comprennent le binaire, =A0 et ceux qui ne le comprennent pas."