Clang error make buildworld

Olivier Smedts olivier at gid0.org
Thu May 5 15:46:01 UTC 2011


2011/5/5 Roman Divacky <rdivacky at freebsd.org>:
>> Because with clang, -march=native often breaks buildworld, while
>> -march=core2 is ok.
>
> Can you be more specific about this claim? On what CPU are seeing
> this breakage?

Ok, with latest HEAD...

%echo | gcc -march=native -E -v -x c -### -
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.2 20070831 prerelease [FreeBSD]
 "/usr/libexec/cc1" "-E" "-quiet" "-v" "-D_LONGLONG" "-"
"-march=core2" "-mtune=generic"

With "-march=native", gcc adds "-mtune=generic" while the man pages
says "-march=xxx" sets "-mtune=xxx".

%echo | gcc -march=core2 -E -v -x c -### -
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.2 20070831 prerelease [FreeBSD]
 "/usr/libexec/cc1" "-E" "-quiet" "-v" "-D_LONGLONG" "-" "-march=core2"

With "-march=core2", gcc doesn't add "-mtune=generic", so it should
use "-mtune=core2" as suggested by its man page.

That's why I use "-march=core2" for gcc. Now for clang...

With "-march=core2", my buildworld compiles just fine on my Core2
Quad, whereas with "-march=native" (without -jX) if fails on :
===> libexec/atrun (all)
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 -c
/usr/src/libexec/atrun/atrun.c
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 -c
/usr/src/libexec/atrun/gloadavg.c
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'
/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'
atrun.o: In function `perr':
/usr/src/libexec/atrun/atrun.c:(.text+0x65): undefined reference to `strlen'
/usr/src/libexec/atrun/atrun.c:(.text+0xac): undefined reference to `vwarn'
/usr/src/libexec/atrun/atrun.c:(.text+0xb6): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0xd5): undefined reference to `snprintf'
/usr/src/libexec/atrun/atrun.c:(.text+0xe6): undefined reference to `vsyslog'
/usr/src/libexec/atrun/atrun.c:(.text+0xf0): undefined reference to `exit'
atrun.o: In function `perrx':
/usr/src/libexec/atrun/atrun.c:(.text+0x19f): undefined reference to `vwarnx'
/usr/src/libexec/atrun/atrun.c:(.text+0x1a9): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x1be): undefined reference to `vsyslog'
/usr/src/libexec/atrun/atrun.c:(.text+0x1c8): undefined reference to `exit'
atrun.o: In function `main':
/usr/src/libexec/atrun/atrun.c:(.text+0x224): undefined reference to `geteuid'
/usr/src/libexec/atrun/atrun.c:(.text+0x239): undefined reference to `getegid'
/usr/src/libexec/atrun/atrun.c:(.text+0x24a): undefined reference to `setegid'
/usr/src/libexec/atrun/atrun.c:(.text+0x255): undefined reference to `seteuid'
/usr/src/libexec/atrun/atrun.c:(.text+0x269): undefined reference to `openlog'
/usr/src/libexec/atrun/atrun.c:(.text+0x26f): undefined reference to `opterr'
/usr/src/libexec/atrun/atrun.c:(.text+0x292): undefined reference to `getopt'
/usr/src/libexec/atrun/atrun.c:(.text+0x2ac): undefined reference to `optarg'
/usr/src/libexec/atrun/atrun.c:(.text+0x2bb): undefined reference to `sscanf'
/usr/src/libexec/atrun/atrun.c:(.text+0x2e7): undefined reference to `__stderrp'
/usr/src/libexec/atrun/atrun.c:(.text+0x2fb): undefined reference to `fwrite'
/usr/src/libexec/atrun/atrun.c:(.text+0x305): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x316): undefined reference to `syslog'
/usr/src/libexec/atrun/atrun.c:(.text+0x320): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0x32a): undefined reference to `chdir'
/usr/src/libexec/atrun/atrun.c:(.text+0x349): undefined reference to `opendir'
/usr/src/libexec/atrun/atrun.c:(.text+0x361): undefined reference to `time'
/usr/src/libexec/atrun/atrun.c:(.text+0x3cc): undefined reference to `sscanf'
/usr/src/libexec/atrun/atrun.c:(.text+0x416): undefined reference to
`__mb_sb_limit'
/usr/src/libexec/atrun/atrun.c:(.text+0x42a): undefined reference to
`_CurrentRuneLocale'
/usr/src/libexec/atrun/atrun.c:(.text+0x43e): undefined reference to `strcmp'
/usr/src/libexec/atrun/atrun.c:(.text+0x454): undefined reference to `strlcpy'
/usr/src/libexec/atrun/atrun.c:(.text+0x463): undefined reference to
`__mb_sb_limit'
/usr/src/libexec/atrun/atrun.c:(.text+0x4a1): undefined reference to
`_CurrentRuneLocale'
/usr/src/libexec/atrun/atrun.c:(.text+0x4ea): undefined reference to `unlink'
/usr/src/libexec/atrun/atrun.c:(.text+0x4f4): undefined reference to `readdir'
/usr/src/libexec/atrun/atrun.c:(.text+0x50b): undefined reference to `stat'
/usr/src/libexec/atrun/atrun.c:(.text+0x54c): undefined reference to `closelog'
/usr/src/libexec/atrun/atrun.c:(.text+0x553): undefined reference to `exit'
atrun.o: In function `run_file':
[...]
/usr/src/libexec/atrun/atrun.c:(.text+0xba4): undefined reference to
`__stack_chk_fail'
/usr/src/libexec/atrun/atrun.c:(.text+0xc90): undefined reference to `exit'
/usr/src/libexec/atrun/atrun.c:(.text+0xcb2): undefined reference to `exit'
gloadavg.o: In function `gloadavg':
/usr/src/libexec/atrun/gloadavg.c:(.text+0xb): undefined reference to
`getloadavg'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `stpcpy'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `putchar'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `strcpy'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `warnx'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `__stdoutp'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getrlimit'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `ioctl'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `dlerror'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getgid'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `printf'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `mac_is_present'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `mac_from_text'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `sigemptyset'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `strerror'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `__pw_scan'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `memmove'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `__stdinp'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to
`cpuset_setaffinity'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `getenv'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `fchmod'
[...]
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `setlogin'
/usr/obj/usr/src/tmp/usr/lib/libutil.so: undefined reference to `raise'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `free'
/usr/obj/usr/src/tmp/usr/lib/libpam.so: undefined reference to `sigprocmask'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop in /usr/src/libexec/atrun.
*** Error code 1

Stop in /usr/src/libexec.
*** Error code 1

Stop in /usr/src.
*** Error code 1


>
> Anyway, can you compile and run on that machine this:
>
>        http://lev.vlakno.cz/~rdivacky/Host.cpp
>
> It's the LLVM CPU autodetection code, it will print the name of
> your CPU. I wonder whats the difference to "core2".
>
> Thank you. roman
>


-- 
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."


More information about the freebsd-current mailing list