Compiling BETA2 with clang fails

Olivier Smedts olivier at gid0.org
Wed Nov 2 12:03:37 UTC 2011


2011/9/5 Volodymyr Kostyrko <c.kworr at gmail.com>:
>
> 0k, here you go. Just as you say - no -fPIC, no ccache, no anything.
>
> ===> libexec/atrun (all)
> clang -O2 -pipe -march=native -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 -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 -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 `_start1':
> /usr/src/lib/csu/i386-elf/crt1_c.c:(.text+0x7d): undefined reference to
> `atexit'
> /usr/src/lib/csu/i386-elf/crt1_c.c:(.text+0x84): undefined reference to
> `_init_tls'
> /usr/src/lib/csu/i386-elf/crt1_c.c:(.text+0x90): undefined reference to
> `atexit'
> /usr/src/lib/csu/i386-elf/crt1_c.c:(.text+0xad): undefined reference to
> `exit'
> atrun.o: In function `perr':
> /usr/src/libexec/atrun/atrun.c:(.text+0x12): undefined reference to `strlen'
> /usr/src/libexec/atrun/atrun.c:(.text+0x45): undefined reference to `vwarn'
> /usr/src/libexec/atrun/atrun.c:(.text+0x6d): undefined reference to
> `snprintf'
> /usr/src/libexec/atrun/atrun.c:(.text+0x8a): undefined reference to
> `vsyslog'
> /usr/src/libexec/atrun/atrun.c:(.text+0x9c): undefined reference to `exit'
> atrun.o: In function `perrx':
> /usr/src/libexec/atrun/atrun.c:(.text+0xd3): undefined reference to `vwarnx'
> /usr/src/libexec/atrun/atrun.c:(.text+0xdf): undefined reference to `exit'
> /usr/src/libexec/atrun/atrun.c:(.text+0xf3): undefined reference to
> `vsyslog'
> /usr/src/libexec/atrun/atrun.c:(.text+0xff): undefined reference to `exit'
> atrun.o: In function `main':
> /usr/src/libexec/atrun/atrun.c:(.text+0x160): undefined reference to
> `geteuid'
> /usr/src/libexec/atrun/atrun.c:(.text+0x174): undefined reference to
> `getegid'
> /usr/src/libexec/atrun/atrun.c:(.text+0x186): undefined reference to
> `setegid'
> /usr/src/libexec/atrun/atrun.c:(.text+0x193): undefined reference to
> `seteuid'
[...]
> 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
>
> Stop in /usr/src.
> *** Error code 1
>
> Stop in /usr/src.

Replying to an old thread, but FYI this problem which has been bugging
me since months has gone away since the lastest clang
branches/release_30 import, and it has been MFC'ed to stable/9. I can
now buildworld with -march=corei7 instead of -march=core2 :) (the same
should apply for -march=native)

Cheers

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