[LLVMdev] linux build broken on Ubuntu 12.04 x86_64

Todd Fiala tfiala at google.com
Mon Feb 3 16:33:24 PST 2014


First error: head file related.  Strangely, this code has been there a
while, which makes me think that the HAVE_ARC4RANDOM is somehow now showing
up as set whereas perhaps it didn't used to be.

tfiala at tfiala2:~/lldb/svn/lgs/build$ make
make[1]: Entering directory `/mnt/ssd/work/svn/lgs/build/lib/Support'
llvm[1]: Compiling Process.cpp for Debug+Asserts build
In file included from
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Process.cpp:103:0:
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc: In static member
function ‘static unsigned int llvm::sys::Process::GetRandomNumber()’:
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:368:21: error:
‘arc4random’ was not declared in this scope
   return arc4random();
                     ^
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:374:1: warning:
control reaches end of non-void function [-Wreturn-type]
 }
 ^
/bin/rm: cannot remove
`/mnt/ssd/work/svn/lgs/build/lib/Support/Debug+Asserts/Process.d.tmp': No
such file or directory
make[1]: ***
[/mnt/ssd/work/svn/lgs/build/lib/Support/Debug+Asserts/Process.o] Error 1
make[1]: Leaving directory `/mnt/ssd/work/svn/lgs/build/lib/Support'
make: *** [all] Error 1

If I add #include <bsd/stdlib.h>, I get past that:

Index: lib/Support/Unix/Process.inc
===================================================================
--- lib/Support/Unix/Process.inc (revision 200620)
+++ lib/Support/Unix/Process.inc (working copy)
@@ -38,6 +38,9 @@
 #ifdef HAVE_TERMIOS_H
 #  include <termios.h>
 #endif
+#if defined(HAVE_ARC4RANDOM)
+#  include <bsd/stdlib.h>
+#endif

 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only generic UNIX code that

Then I start fixing up link errors like the following that now require
-lbsd:

make[2]: Entering directory `/mnt/ssd/work/svn/lgs/build/utils/fpcmp'
llvm[2]: Linking Debug+Asserts executable fpcmp
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[2]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/fpcmp] Error 1
make[2]: Leaving directory `/mnt/ssd/work/svn/lgs/build/utils/fpcmp'
make[1]: *** [fpcmp/.makeall] Error 2
make[1]: Leaving directory `/mnt/ssd/work/svn/lgs/build/utils'
make: *** [all] Error 1

That'll get resolved with something like this (don't know how many
platforms would need this fix - this should definitely bee ifdef guarded).

tfiala at tfiala2:/mnt/ssd/work/svn/lgs/llvm/utils/fpcmp$ svn diff Makefile
Index: Makefile
===================================================================
--- Makefile    (revision 200725)
+++ Makefile    (working copy)
@@ -12,5 +12,7 @@
 USEDLIBS = LLVMSupport.a
 NO_INSTALL = 1

+LDFLAGS += "-lbsd"
+
 include $(LEVEL)/Makefile.common


But this is just one of several (more below):

llvm[4]: Building Debug+Asserts Archive Library libclang.a
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/diagtool] Error
1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/diagtool'
make[3]: *** [diagtool/.makeall] Error 2
make[3]: *** Waiting for unfinished jobs....
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/clang-format]
Error 1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/clang-format'
make[3]: *** [clang-format/.makeall] Error 2
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/arcmt-test]
Error 1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/arcmt-test'
make[3]: *** [arcmt-test/.makeall] Error 2
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/clang-check]
Error 1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/clang-check'
make[3]: *** [clang-check/.makeall] Error 2
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/libclang'
make[4]: Entering directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/c-index-test'
llvm[4]: Compiling c-index-test.c for Debug+Asserts build
llvm[4]: Linking Debug+Asserts executable c-index-test
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libclang.so: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/c-index-test]
Error 1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/c-index-test'
make[3]: *** [all] Error 1
/mnt/ssd/work/svn/lgs/build/Debug+Asserts/lib/libLLVMSupport.a(Process.o):
In function `llvm::sys::Process::GetRandomNumber()':
/mnt/ssd/work/svn/lgs/llvm/lib/Support/Unix/Process.inc:371: undefined
reference to `arc4random'
collect2: error: ld returned 1 exit status
make[4]: *** [/mnt/ssd/work/svn/lgs/build/Debug+Asserts/bin/clang] Error 1
make[4]: Leaving directory
`/mnt/ssd/work/svn/lgs/build/tools/clang/tools/driver'
make[3]: *** [driver/.makeall] Error 2


We've got it confirmed on another machine here.

We build with gcc 4.8.2, Ubuntu 12.04 x86_64, configure-based, with the
only non-Ubuntu components being the gcc and a newer libedit required by
some recent changes to lldb.

Generally this has been rock solid.  I don't know if something caused
the HAVE_ARC4RANDOM
flag to change all of a sudden, but if it did, it happened to two machines
simultaneously.

Any thoughts?


On Mon, Feb 3, 2014 at 4:08 PM, Eric Christopher <echristo at gmail.com> wrote:

> Ah. Weird. I'm not seeing anything. Can you paste the errors you're seeing?
>
> -eric
>
>
> On Mon, Feb 3, 2014 at 3:57 PM, Todd Fiala <tfiala at google.com> wrote:
>
>> It's in llvm and clang code.  I haven't gotten to any of the lldb code
>> yet.
>>
>>
>> On Mon, Feb 3, 2014 at 1:33 PM, Eric Christopher <echristo at gmail.com>wrote:
>>
>>> Weird. Probably best to send mail to lldb@?
>>>
>>> -eric
>>>
>>>
>>> On Mon, Feb 3, 2014 at 11:24 AM, Todd Fiala <tfiala at google.com> wrote:
>>>
>>>> Hey all,
>>>>
>>>> FYI -
>>>>
>>>> We're seeing a whole host of errors around requiring arc4random and
>>>> linkage errors building llvm/clang/lldb from top of tree.  This is on lldb
>>>> builds with Ubuntu 12.04 x86_64, using gcc 4.8.2 and configure-based
>>>> builds.  This appeared to crop up sometime since Friday morning.  What's
>>>> the right fix for that?  Looks to be a dependency on libbsd?
>>>>  --
>>>> Todd Fiala | Software Engineer |  tfiala at google.com |  650-943-3180
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>>
>>>>
>>>
>>
>>
>> --
>> Todd Fiala | Software Engineer |  tfiala at google.com |  650-943-3180
>>
>
>


-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140203/832ea408/attachment.html>


More information about the llvm-dev mailing list