title: Compile a statically linked executable of the "stress-ng" package
body: <p>I'm trying to compile the "stress-ng" package to produce a statically linked executable to use it inside GEM5 full system simulator.</p>
  
  <p>A tarball of this package can be downloaded <a href="http://kernel.ubuntu.com/~cking/tarballs/stress-ng/" rel="nofollow noreferrer">here</a>. The version I'm trying to compile is 0.07.08.</p>
  
  <p>To compile a dynamically linked executable of this package, just "make". This works for me.</p>
  
  <p>However, since I need to run the "stress-ng" exe from within a GEM5 full system simulation, I need to make sure that the exe is self-contained. This is usually done using the "-static" CFLAG option, however, for "stress-ng", I get an error when I try this option.</p>
  
  <p>Here is what to do in order to reproduce this error. Edit "Makefile" and add "-static" option at the end of line # 25. Line 25 should look like the following:</p>
  
  <pre><code>CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 -std=gnu99 -static
  </code></pre>
  
  <p>Save then make, you will see the error below:</p>
  
  <pre><code>/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_lock_wait_private':
  /build/eglibc-3GlaMS/eglibc-2.19/nptl/../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:78: multiple definition of `__lll_lock_wait_private'
  /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x0): first defined here
  /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libpthread.a(lowlevellock.o): In function `__lll_unlock_wake_private':
  /build/eglibc-3GlaMS/eglibc-2.19/nptl/../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:328: multiple definition of `__lll_unlock_wake_private'
  /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/libc.a(libc-lowlevellock.o):(.text+0x30): first defined here
  collect2: ld returned 1 exit status
  make: *** [stress-ng] Error 1
  </code></pre>
  
  <p>Finally, OS is Ubuntu 14.04 and cc version is 4.6.4.</p>
  
  <p>Am I missing some other CFLAG option(s) here?</p>