Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2011 19:30:19 +0200
From:      Olivier Smedts <olivier@gid0.org>
To:        Roman Divacky <rdivacky@freebsd.org>
Cc:        "O. Hartmann" <ohartman@zedat.fu-berlin.de>, current@freebsd.org
Subject:   Re: Clang error make buildworld
Message-ID:  <BANLkTikPqXEuNPKxBYXyf7YaemRsc_jJzw@mail.gmail.com>
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> <BANLkTimiU42U0m5nCo=hSdaUF50rwnOk4w@mail.gmail.com> <20110505135458.GA79622@freebsd.org> <BANLkTimkOU9NDUONH1r=qX68iwj4W5LVpg@mail.gmail.com> <20110505155551.GA99006@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/5/5 Roman Divacky <rdivacky@freebsd.org>:
> 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<char>::allocator()'
Host.cpp:(.text+0xe3): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::basic_string(char
const*, std::allocator<char> const&)'
Host.cpp:(.text+0xf1): undefined reference to
`std::allocator<char>::~allocator()'
Host.cpp:(.text+0x112): undefined reference to
`std::allocator<char>::~allocator()'
Host.cpp:(.text+0x2b5): undefined reference to `memcmp'
Host.cpp:(.text+0x32a): undefined reference to
`std::allocator<char>::allocator()'
[...]
Host.cpp:(.text+0x13db): undefined reference to
`std::allocator<char>::~allocator()'
Host.cpp:(.text+0x13ff): undefined reference to
`std::allocator<char>::~allocator()'
Host.cpp:(.text+0x141a): undefined reference to
`std::allocator<char>::allocator()'
Host.cpp:(.text+0x1432): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::basic_string(char const*, std::allocator<char> const&)'
Host.cpp:(.text+0x1443): undefined reference to
`std::allocator<char>::~allocator()'
Host.cpp:(.text+0x1467): undefined reference to
`std::allocator<char>::~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<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
Host.cpp:(.text+0x15e2): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<char, std::char_traits<char>, std::allocator<char>
>(std::basic_ostream<char, std::char_traits<char> >&,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&)'
Host.cpp:(.text+0x15f9): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
Host.cpp:(.text+0x160b): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
Host.cpp:(.text+0x162c): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~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."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTikPqXEuNPKxBYXyf7YaemRsc_jJzw>