Sandeep K Chaudhary
2014-Jun-10 00:08 UTC
[LLVMdev] use of undeclared identifier '__NR_*' error while building clang
Hi guys, I am following this[1] tutorial to install clang. However, I have made a small change in the configure command, and I am running it with '--enable-optimized' option to avoid the debug build. I am getting the errors (given at the end) related to *undeclared identifiers '__NR_*'*. Can someone please provide some input about how to tackle this issue? On my other machine, I followed the same guide[1] (without the --enable-optimized option), and everything built successfully. [1] http://clang.llvm.org/get_started.html ===================warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx' (ld does not support it) make[5]: Entering directory `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' COMPILE: clang_linux/san-i386/i386: /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:123:27: error: use of undeclared identifier '__NR_open' return internal_syscall(SYSCALL(open), (uptr)filename, flags); ^ /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: note: expanded from macro 'SYSCALL' # define SYSCALL(name) __NR_ ## name ^ <scratch space>:62:1: note: expanded from here __NR_open ^ /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:132:27: error: use of undeclared identifier '__NR_open' return internal_syscall(SYSCALL(open), (uptr)filename, flags, mode); ^ -------------- /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:516:27: error: use of undeclared identifier '__NR_fork' return internal_syscall(SYSCALL(fork)); ^ /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: note: expanded from macro 'SYSCALL' # define SYSCALL(name) __NR_ ## name ^ <scratch space>:62:1: note: expanded from here __NR_fork ^ 12 errors generated. make[5]: *** [/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib__sanitizer_common/sanitizer_linux.o] Error 1 make[5]: Leaving directory `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' make[4]: *** [BuildRuntimeLibraries] Error 2 make[4]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt' make[3]: *** [compiler-rt/.makeall] Error 2 make[3]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang/runtime' make[2]: *** [all] Error 1 make[2]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang' make[1]: *** [clang/.makeall] Error 2 make[1]: Leaving directory `/home/sandeep/llvm_clang/build/tools' make: *** [all] Error 1 Thanks and regards, Sandeep. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/90960e88/attachment.html>
Reid Kleckner
2014-Jun-10 00:37 UTC
[LLVMdev] [cfe-dev] use of undeclared identifier '__NR_*' error while building clang
-cfe-dev Based on your question on IRC, it sounds like there's something wrong with your Linux headers. Make sure you have something that provides the syscall numbers in /usr/include. My workstation has them in x86_64-linux-gnu/asm/unistd_(32|64).h: $ ack '__NR_fork' /usr/include/ /usr/include/asm-generic/unistd.h 849:#define __NR_fork 1079 851:__SYSCALL(__NR_fork, sys_fork) 853:__SYSCALL(__NR_fork, sys_ni_syscall) 857:#define __NR_syscalls (__NR_fork+1) /usr/include/x86_64-linux-gnu/asm/unistd_32.h 10:#define __NR_fork 2 /usr/include/x86_64-linux-gnu/asm/unistd_64.h 136:#define __NR_fork 57 137:__SYSCALL(__NR_fork, stub_fork) /usr/include/x86_64-linux-gnu/bits/syscall.h 70:#define SYS_fork __NR_fork 417:#define SYS_fork __NR_fork On Mon, Jun 9, 2014 at 5:08 PM, Sandeep K Chaudhary < babbusandy2006 at gmail.com> wrote:> Hi guys, > > I am following this[1] tutorial to install clang. However, I have made a > small change in the configure command, and I am running it with > '--enable-optimized' option to avoid the debug build. > > I am getting the errors (given at the end) related to *undeclared > identifiers '__NR_*'*. Can someone please provide some input about how to > tackle this issue? > > On my other machine, I followed the same guide[1] (without the > --enable-optimized option), and everything built successfully. > > [1] http://clang.llvm.org/get_started.html > > ===================> warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx' > (ld does not support it) > make[5]: Entering directory > `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' > COMPILE: clang_linux/san-i386/i386: > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:123:27: > error: use of undeclared identifier '__NR_open' > return internal_syscall(SYSCALL(open), (uptr)filename, flags); > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: > note: expanded from macro 'SYSCALL' > # define SYSCALL(name) __NR_ ## name > ^ > <scratch space>:62:1: note: expanded from here > __NR_open > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:132:27: > error: use of undeclared identifier '__NR_open' > return internal_syscall(SYSCALL(open), (uptr)filename, flags, mode); > ^ > -------------- > > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:516:27: > error: use of undeclared identifier '__NR_fork' > return internal_syscall(SYSCALL(fork)); > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: > note: expanded from macro 'SYSCALL' > # define SYSCALL(name) __NR_ ## name > ^ > <scratch space>:62:1: note: expanded from here > __NR_fork > ^ > 12 errors generated. > make[5]: *** > [/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib__sanitizer_common/sanitizer_linux.o] > Error 1 > make[5]: Leaving directory > `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' > make[4]: *** [BuildRuntimeLibraries] Error 2 > make[4]: Leaving directory > `/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt' > make[3]: *** [compiler-rt/.makeall] Error 2 > make[3]: Leaving directory > `/home/sandeep/llvm_clang/build/tools/clang/runtime' > make[2]: *** [all] Error 1 > make[2]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang' > make[1]: *** [clang/.makeall] Error 2 > make[1]: Leaving directory `/home/sandeep/llvm_clang/build/tools' > make: *** [all] Error 1 > > Thanks and regards, > Sandeep. > > > _______________________________________________ > cfe-dev mailing list > cfe-dev at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/caefa651/attachment.html>
Alexey Samsonov
2014-Jun-10 00:38 UTC
[LLVMdev] [cfe-dev] use of undeclared identifier '__NR_*' error while building clang
Hi, Can you provide details about your system (uname -a)? It is weird that you don't have __NR_open defined in your system headers. As a workaround, you may drop compiler-rt repository from your checkout, it's possible to build Clang without it. On Mon, Jun 9, 2014 at 5:08 PM, Sandeep K Chaudhary < babbusandy2006 at gmail.com> wrote:> Hi guys, > > I am following this[1] tutorial to install clang. However, I have made a > small change in the configure command, and I am running it with > '--enable-optimized' option to avoid the debug build. > > I am getting the errors (given at the end) related to *undeclared > identifiers '__NR_*'*. Can someone please provide some input about how to > tackle this issue? > > On my other machine, I followed the same guide[1] (without the > --enable-optimized option), and everything built successfully. > > [1] http://clang.llvm.org/get_started.html > > ===================> warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx' > (ld does not support it) > make[5]: Entering directory > `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' > COMPILE: clang_linux/san-i386/i386: > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:123:27: > error: use of undeclared identifier '__NR_open' > return internal_syscall(SYSCALL(open), (uptr)filename, flags); > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: > note: expanded from macro 'SYSCALL' > # define SYSCALL(name) __NR_ ## name > ^ > <scratch space>:62:1: note: expanded from here > __NR_open > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:132:27: > error: use of undeclared identifier '__NR_open' > return internal_syscall(SYSCALL(open), (uptr)filename, flags, mode); > ^ > -------------- > > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:516:27: > error: use of undeclared identifier '__NR_fork' > return internal_syscall(SYSCALL(fork)); > ^ > /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: > note: expanded from macro 'SYSCALL' > # define SYSCALL(name) __NR_ ## name > ^ > <scratch space>:62:1: note: expanded from here > __NR_fork > ^ > 12 errors generated. > make[5]: *** > [/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib__sanitizer_common/sanitizer_linux.o] > Error 1 > make[5]: Leaving directory > `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' > make[4]: *** [BuildRuntimeLibraries] Error 2 > make[4]: Leaving directory > `/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt' > make[3]: *** [compiler-rt/.makeall] Error 2 > make[3]: Leaving directory > `/home/sandeep/llvm_clang/build/tools/clang/runtime' > make[2]: *** [all] Error 1 > make[2]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang' > make[1]: *** [clang/.makeall] Error 2 > make[1]: Leaving directory `/home/sandeep/llvm_clang/build/tools' > make: *** [all] Error 1 > > Thanks and regards, > Sandeep. > > > _______________________________________________ > cfe-dev mailing list > cfe-dev at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev > >-- Alexey Samsonov vonosmas at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/5c164a0a/attachment.html>
Sandeep K Chaudhary
2014-Jun-10 01:12 UTC
[LLVMdev] [cfe-dev] use of undeclared identifier '__NR_*' error while building clang
Hi Reid, Thanks for the reply ! Earlier the build was complaining about not having /asm in /usr/include so I created a symbolic link to it with asm-generic, after that I am encountering this issue. I just grep'ed for '__NR_fork', and I can see these numbers in the header files. sandeep at ubuntu:/usr/include$ grep -rni __NR_fork . ./asm-generic/unistd.h:850:#define __NR_fork 1079 ./asm-generic/unistd.h:852:__SYSCALL(__NR_fork, sys_fork) ./asm-generic/unistd.h:854:__SYSCALL(__NR_fork, sys_ni_syscall) ./asm-generic/unistd.h:858:#define __NR_syscalls (__NR_fork+1) ./x86_64-linux-gnu/asm/unistd_x32.h:51:#define __NR_fork (__X32_SYSCALL_BIT + 57) ./x86_64-linux-gnu/asm/unistd_64.h:61:#define __NR_fork 57 ./x86_64-linux-gnu/asm/unistd_32.h:6:#define __NR_fork 2 ./x86_64-linux-gnu/bits/syscall.h:70:#define SYS_fork __NR_fork ./x86_64-linux-gnu/bits/syscall.h:418:#define SYS_fork __NR_fork ./x86_64-linux-gnu/bits/syscall.h:730:#define SYS_fork __NR_fork So these numbers are available in /usr/include. Are these not sufficient? Thanks, Sandeep. On Mon, Jun 9, 2014 at 8:37 PM, Reid Kleckner <rnk at google.com> wrote:> -cfe-dev > > Based on your question on IRC, it sounds like there's something wrong with > your Linux headers. Make sure you have something that provides the syscall > numbers in /usr/include. My workstation has them in > x86_64-linux-gnu/asm/unistd_(32|64).h: > > $ ack '__NR_fork' /usr/include/ > /usr/include/asm-generic/unistd.h > 849:#define __NR_fork 1079 > 851:__SYSCALL(__NR_fork, sys_fork) > 853:__SYSCALL(__NR_fork, sys_ni_syscall) > 857:#define __NR_syscalls (__NR_fork+1) > > /usr/include/x86_64-linux-gnu/asm/unistd_32.h > 10:#define __NR_fork 2 > > /usr/include/x86_64-linux-gnu/asm/unistd_64.h > 136:#define __NR_fork 57 > 137:__SYSCALL(__NR_fork, stub_fork) > > /usr/include/x86_64-linux-gnu/bits/syscall.h > 70:#define SYS_fork __NR_fork > 417:#define SYS_fork __NR_fork > > > On Mon, Jun 9, 2014 at 5:08 PM, Sandeep K Chaudhary < > babbusandy2006 at gmail.com> wrote: > >> Hi guys, >> >> I am following this[1] tutorial to install clang. However, I have made a >> small change in the configure command, and I am running it with >> '--enable-optimized' option to avoid the debug build. >> >> I am getting the errors (given at the end) related to *undeclared >> identifiers '__NR_*'*. Can someone please provide some input about how >> to tackle this issue? >> >> On my other machine, I followed the same guide[1] (without the >> --enable-optimized option), and everything built successfully. >> >> [1] http://clang.llvm.org/get_started.html >> >> ===================>> warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx' >> (ld does not support it) >> make[5]: Entering directory >> `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' >> COMPILE: clang_linux/san-i386/i386: >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:123:27: >> error: use of undeclared identifier '__NR_open' >> return internal_syscall(SYSCALL(open), (uptr)filename, flags); >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: >> note: expanded from macro 'SYSCALL' >> # define SYSCALL(name) __NR_ ## name >> ^ >> <scratch space>:62:1: note: expanded from here >> __NR_open >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:132:27: >> error: use of undeclared identifier '__NR_open' >> return internal_syscall(SYSCALL(open), (uptr)filename, flags, mode); >> ^ >> -------------- >> >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:516:27: >> error: use of undeclared identifier '__NR_fork' >> return internal_syscall(SYSCALL(fork)); >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: >> note: expanded from macro 'SYSCALL' >> # define SYSCALL(name) __NR_ ## name >> ^ >> <scratch space>:62:1: note: expanded from here >> __NR_fork >> ^ >> 12 errors generated. >> make[5]: *** >> [/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib__sanitizer_common/sanitizer_linux.o] >> Error 1 >> make[5]: Leaving directory >> `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' >> make[4]: *** [BuildRuntimeLibraries] Error 2 >> make[4]: Leaving directory >> `/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt' >> make[3]: *** [compiler-rt/.makeall] Error 2 >> make[3]: Leaving directory >> `/home/sandeep/llvm_clang/build/tools/clang/runtime' >> make[2]: *** [all] Error 1 >> make[2]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang' >> make[1]: *** [clang/.makeall] Error 2 >> make[1]: Leaving directory `/home/sandeep/llvm_clang/build/tools' >> make: *** [all] Error 1 >> >> Thanks and regards, >> Sandeep. >> >> >> _______________________________________________ >> cfe-dev mailing list >> cfe-dev at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev >> >> >-- Thanks and regards, Sandeep K Chaudhary. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/ea556ce5/attachment.html>
Sandeep K Chaudhary
2014-Jun-10 01:16 UTC
[LLVMdev] [cfe-dev] use of undeclared identifier '__NR_*' error while building clang
Hi Alexey ! Thanks for the reply ! Below is the output of 'uname -a' sandeep at ubuntu:/usr/include$ uname -a Linux ubuntu 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux I recently upgraded my Linux version (to Ubuntu 14.04). Could the issue be because of that? So to drop compiler-rt, I can just delete the whole directory and do an incremental build? The reason I'm asking this is - it takes more than a couple of hours for the build on my system. It would be great if I can avoid it. Please let me know. Thanks and regards, Sandeep. On Mon, Jun 9, 2014 at 8:38 PM, Alexey Samsonov <vonosmas at gmail.com> wrote:> Hi, > > Can you provide details about your system (uname -a)? It is weird that you > don't have __NR_open defined in your system headers. > As a workaround, you may drop compiler-rt repository from your checkout, > it's possible to build Clang without it. > > On Mon, Jun 9, 2014 at 5:08 PM, Sandeep K Chaudhary < > babbusandy2006 at gmail.com> wrote: > >> Hi guys, >> >> I am following this[1] tutorial to install clang. However, I have made a >> small change in the configure command, and I am running it with >> '--enable-optimized' option to avoid the debug build. >> >> I am getting the errors (given at the end) related to *undeclared >> identifiers '__NR_*'*. Can someone please provide some input about how >> to tackle this issue? >> >> On my other machine, I followed the same guide[1] (without the >> --enable-optimized option), and everything built successfully. >> >> [1] http://clang.llvm.org/get_started.html >> >> ===================>> warning: clang_darwin.mk: dropping arch 'x86_64h' from lib 'ubsan_osx' >> (ld does not support it) >> make[5]: Entering directory >> `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' >> COMPILE: clang_linux/san-i386/i386: >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:123:27: >> error: use of undeclared identifier '__NR_open' >> return internal_syscall(SYSCALL(open), (uptr)filename, flags); >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: >> note: expanded from macro 'SYSCALL' >> # define SYSCALL(name) __NR_ ## name >> ^ >> <scratch space>:62:1: note: expanded from here >> __NR_open >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:132:27: >> error: use of undeclared identifier '__NR_open' >> return internal_syscall(SYSCALL(open), (uptr)filename, flags, mode); >> ^ >> -------------- >> >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:516:27: >> error: use of undeclared identifier '__NR_fork' >> return internal_syscall(SYSCALL(fork)); >> ^ >> /home/sandeep/llvm_clang/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_syscall_generic.inc:17:24: >> note: expanded from macro 'SYSCALL' >> # define SYSCALL(name) __NR_ ## name >> ^ >> <scratch space>:62:1: note: expanded from here >> __NR_fork >> ^ >> 12 errors generated. >> make[5]: *** >> [/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt/clang_linux/san-i386/i386/SubDir.lib__sanitizer_common/sanitizer_linux.o] >> Error 1 >> make[5]: Leaving directory >> `/home/sandeep/llvm_clang/llvm/projects/compiler-rt' >> make[4]: *** [BuildRuntimeLibraries] Error 2 >> make[4]: Leaving directory >> `/home/sandeep/llvm_clang/build/tools/clang/runtime/compiler-rt' >> make[3]: *** [compiler-rt/.makeall] Error 2 >> make[3]: Leaving directory >> `/home/sandeep/llvm_clang/build/tools/clang/runtime' >> make[2]: *** [all] Error 1 >> make[2]: Leaving directory `/home/sandeep/llvm_clang/build/tools/clang' >> make[1]: *** [clang/.makeall] Error 2 >> make[1]: Leaving directory `/home/sandeep/llvm_clang/build/tools' >> make: *** [all] Error 1 >> >> Thanks and regards, >> Sandeep. >> >> >> _______________________________________________ >> cfe-dev mailing list >> cfe-dev at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev >> >> > > > -- > Alexey Samsonov > vonosmas at gmail.com >-- Thanks and regards, Sandeep K Chaudhary. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140609/cf10fed6/attachment.html>