Re: Clang error make buildworld

From: Olivier Smedts <olivier_at_gid0.org>
Date: Thu, 5 May 2011 19:30:19 +0200
2011/5/5 Roman Divacky <rdivacky_at_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=native ?

My system has previously been compiled with clang and "-march=core2".
It's a corei7.

With "-march=native" in make.conf, after the failed buildworld I cd in
/usr/obj/usr/src/libexec/atrun/ and :

# clang -O2 -pipe -march=native -fomit-frame-pointer
-DATJOB_DIR=\"/var/at/jobs/\" -DLFILE=\"/var/at/jobs/.lockfile\"
-DLOADAVG_MX=1.5 -DATSPOOL_DIR=\"/var/at/spool\" -DVERSION=\"2.9\"
-DDAEMON_UID=1 -DDAEMON_GID=1 -DDEFAULT_BATCH_QUEUE=\'E\'
-DDEFAULT_AT_QUEUE=\'c\' -DPERM_PATH=\"/var/at/\"
-I/usr/src/libexec/atrun/../../usr.bin/at -I/usr/src/libexec/atrun
-DLOGIN_CAP -DPAM -std=gnu99 -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=gnu99'

OK

# /usr/obj/usr/src/tmp/usr/bin/clang -O2 -pipe -march=native
-fomit-frame-pointer -DATJOB_DIR=\"/var/at/jobs/\"
-DLFILE=\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=1.5
-DATSPOOL_DIR=\"/var/at/spool\" -DVERSION=\"2.9\" -DDAEMON_UID=1
-DDAEMON_GID=1 -DDEFAULT_BATCH_QUEUE=\'E\' -DDEFAULT_AT_QUEUE=\'c\'
-DPERM_PATH=\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at
-I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99
-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=native
-fomit-frame-pointer -DATJOB_DIR=\"/var/at/jobs/\"
-DLFILE=\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=1.5
-DATSPOOL_DIR=\"/var/at/spool\" -DVERSION=\"2.9\" -DDAEMON_UID=1
-DDAEMON_GID=1 -DDEFAULT_BATCH_QUEUE=\'E\' -DDEFAULT_AT_QUEUE=\'c\'
-DPERM_PATH=\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at
-I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99
-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=gnu99'
 "/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=native) and trying to
compile atrun, this time using -march=core2 :

# /usr/obj/usr/src/tmp/usr/bin/clang -O2 -pipe -march=core2
-fomit-frame-pointer -DATJOB_DIR=\"/var/at/jobs/\"
-DLFILE=\"/var/at/jobs/.lockfile\" -DLOADAVG_MX=1.5
-DATSPOOL_DIR=\"/var/at/spool\" -DVERSION=\"2.9\" -DDAEMON_UID=1
-DDAEMON_GID=1 -DDEFAULT_BATCH_QUEUE=\'E\' -DDEFAULT_AT_QUEUE=\'c\'
-DPERM_PATH=\"/var/at/\" -I/usr/src/libexec/atrun/../../usr.bin/at
-I/usr/src/libexec/atrun -DLOGIN_CAP -DPAM -std=gnu99
-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/backward"
ignoring duplicate directory "/usr/obj/usr/src/tmp/usr/include/c++/4.2/backward"
#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_tls'
/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_personality_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 invocation)

-- 
Olivier Smedts                                                 _
                                        ASCII ribbon campaign ( )
e-mail: olivier_at_gid0.org        - against HTML email & vCards  X
www: http://www.gid0.org    - against proprietary attachments / \

  "Il y a seulement 10 sortes de gens dans le monde :
  ceux qui comprennent le binaire,
  et ceux qui ne le comprennent pas."
Received on Thu May 05 2011 - 15:30:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC