valgrind `--track-fds=yes` without fds 0,1,2 - valgrind

I'm running valgrind with following setup:
valgrind --tool=memcheck --tool=callgrind --num-callers=20 --track-fds=yes --error-exitcode=1 CMD. Especially,--track-fds=yes work as desired, but every run fails due to fds 0,1,2 which are supposed to be open. However, I don't want to drop --track-fds, as it certainly gives meaningful information. So, is there a valgrind option / method to track fds excluding 0,1,2?
==5872== FILE DESCRIPTORS: 3 open at exit.
==5872== Open file descriptor 2:
==5872== <inherited from parent>
==5872==
==5872== Open file descriptor 1:
==5872== <inherited from parent>
==5872==
==5872== Open file descriptor 0: /dev/pts/0
==5872== <inherited from parent>
==5872==
==5872==
==5872== Events : Ir
==5872== Collected : 3081079256
==5872==
==5872== I refs: 3,081,079,256

Those are stdin, stdout and stderr. Typically you can ignore these but if you really want to be fastidious:
fclose( stdin );
fclose( stdout );
fclose( stderr );

Here's the outupt of the newer versions of valgrind (mine is 3.17) with --track-fds=yes:
==874818== FILE DESCRIPTORS: 3 open (3 std) at exit.
However, if you run valgrind with --quiet, it would ignore these 3 std FDs and only notify you about the "real" FDs leak:
$ valgrind --quiet --track-fds=yes ./hello_world
hello world!
$ valgrind --quiet --track-fds=yes ./hello_world_leak
hello world!
==880505== FILE DESCRIPTORS: 4 open (3 std) at exit.
==880505== Open file descriptor 3: /tmp/vg-test/main.cpp
==880505== at 0x4B968DB: open (open64.c:48)
==880505== by 0x109249: main (in /tmp/vg-test/hello_world_leak)
==880505==

Related

How to fix this gnu issue this is my output

[Running] cd "c:\Users\dead\Documents\vs code\C++" && g++ new -o c:\Users\dead\Documents\vs code\C++\new && "c:\Users\dead\Documents\vs code\C++"c:\Users\dead\Documents\vs code\C++\new
g++: error: code\C++\new: No such file or directory
[Done] exited with code=1 in 0.455 seconds
I assume you are using Code Runner.
In your output, you are trying to build a file called new, this is not acceptable by g++, you should change its name with .cpp or .cxx end.

buildozer - C compiler cannot create executables

When I run
buildozer -v android debug
It ends with this error
[INFO]: -> running configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/...(and 94 more)
working: See `config.log' for more details Exception in thread background thread for pid 14805:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 1633, in wrap
fn(*rgs, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 2557, in background_thread
handle_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 2261, in fn
return self.command.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 861, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_77:
RAN: /home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared
STDOUT:
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make -j4 sets $(MAKE)... yes
checking whether make -j4 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /usr/bin/ccache /home/astrilaa/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details
STDERR:
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 1260, in <module>
main()
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 709, in __init__
getattr(self, command)(args)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 154, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/toolchain.py", line 213, in build_dist_from_args
build_recipes(build_order, python_modules, ctx,
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/build.py", line 577, in build_recipes
recipe.build_arch(arch)
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/libffi/__init__.py", line 42, in build_arch
shprint(sh.Command('./configure'),
File "/home/astrilaa/kivycalc/.buildozer/android/platform/python-for-android/pythonforandroid/logger.py", line 167, in shprint
for line in output:
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 907, in next
self.wait()
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 837, in wait
self.handle_command_exit_code(exit_code)
File "/usr/local/lib/python3.8/dist-packages/sh-1.14.0-py3.8.egg/sh.py", line 861, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_77:
RAN: /home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/configure --host=arm-linux-androideabi --prefix=/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi --disable-builddir --enable-shared
STDOUT:
checking build system type... i686-pc-linux-gnu
checking host system type... arm-unknown-linux-androideabi
checking target system type... arm-unknown-linux-androideabi
checking for gsed... sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip --strip-unneeded
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make -j4 sets $(MAKE)... yes
checking whether make -j4 supports nested variables... yes
checking for arm-linux-androideabi-gcc... /usr/bin/ccache /home/astrilaa/.buildozer/android/platform/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC
checking whether the C compiler works... no
configure: error: in `/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi':
configure: error: C compiler cannot create executables
See `config.log' for more details
STDERR:
# Command failed: /usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=myapp --bootstrap=sdl2 --requirements=python3,kivy --arch armeabi-v7a --copy-libs --color=always --storage-dir="/home/astrilaa/kivycalc/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21 --ignore-setup-py
# ENVIRONMENT:
# LC_ALL = 'en_US.UTF-8'
# LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'
# LESSCLOSE = '/usr/bin/lesspipe %s %s'
# LANG = 'en_US.UTF-8'
# DISPLAY = ':0'
# OLDPWD = '/home/astrilaa/kivycalc/.buildozer'
# INVOCATION_ID = 'cab34536ffa845888abc885580633b58'
# COLORTERM = 'truecolor'
# XDG_VTNR = '7'
# SSH_AUTH_SOCK = '/tmp/ssh-gVp07qexptPM/agent.3275'
# MANDATORY_PATH = '/usr/share/gconf/i3.mandatory.path'
# CLASSPATH = ':/home/astrilaa/.s/java/classes/swt.jar'
# XDG_SESSION_ID = '4'
# USER = 'astrilaa'
# DESKTOP_SESSION = 'i3'
# DEFAULTS_PATH = '/usr/share/gconf/i3.default.path'
# PWD = '/home/astrilaa/kivycalc'
# HOME = '/home/astrilaa'
# LC_CTYPE = 'en_US.UTF-8'
# JOURNAL_STREAM = '9:21013'
# aimages = '/home/astrilaa/Anki/ast/collection.media'
# SSH_AGENT_PID = '3337'
# XDG_DATA_DIRS = '/usr/share/i3:/usr/local/share/:/usr/share/'
# SHELL = '/bin/bash'
# VTE_VERSION = '5202'
# TERM = 'xterm-256color'
# XDG_CURRENT_DESKTOP = 'i3'
# GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
# PYTHONSTARTUP = '/home/astrilaa/.pythonrc'
# SHLVL = '1'
# XDG_SEAT = 'seat0'
# LOGNAME = 'astrilaa'
# DBUS_SESSION_BUS_ADDRESS = 'unix:abstract=/tmp/dbus-BWRyA4OC8j,guid=838c372083700fa9dddc18065f7f826d'
# XDG_RUNTIME_DIR = '/run/user/1000'
# XAUTHORITY = '/home/astrilaa/.Xauthority'
# XDG_CONFIG_DIRS = '/etc/xdg/xdg-i3:/etc/xdg'
# PATH = ('/home/astrilaa/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/astrilaa/bin:/home/astrilaa/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/astrilaa/.s/daetd:/home/astrilaa/.s/daetd/scripts:/home/astrilaa/.s/daetd/bkstree:/home/astrilaa/.s/daetd/rone:usr/local/bin/adt-bundle-linux-x86-20130219/sdk/platform-tools:/home/astrilaa/.wine/drive_c/Program '
'Files/VW/VT/Paul/M16-SAPI5/lib/:/home/astrilaa/android-sdks/tools:/home/astrilaa/android-sdks/platform-tools:/home/astrilaa/android-sdks/tools/bin')
# PS1 = '[\\u#\\h \\W]$(git_branch)$ '
# LESSOPEN = '| /usr/bin/lesspipe %s'
# _ = '/usr/local/bin/buildozer'
# PACKAGES_PATH = '/home/astrilaa/.buildozer/android/packages'
# ANDROIDSDK = '/home/astrilaa/.buildozer/android/platform/android-sdk'
# ANDROIDNDK = '/home/astrilaa/.buildozer/android/platform/android-ndk-r19c'
# ANDROIDAPI = '27'
# ANDROIDMINAPI = '21'
#
# Buildozer failed to execute the last command
# The error might be hidden in the log above this error
# Please read the full log, and search for it before
# raising an issue with buildozer itself.
# In case of a bug report, please add a full log with log_level = 2
I ended in this state after I overcame this problem.
My buildozer wasn't able to download NDK (it wanted r19c), so I downloaded this one. I tried it on Python3.6, Python3.7 and Python3.8
on Ubuntu 18.04 32 bit (i686) architecture.
I believe the problem is you are running command on 32bit operating system. As mentioned in the BUG #1007
Thanks, I saw the logs.. But The Problem was that I was using a 32 bit
linux system. So the drivers could not work. Then when I tried the
same thing in a 64 bit linux system. Installed on virtual machine it
worked fine. Thanks for your help.
This is a simple and obvious fix(others told me)
you need to
chmod +x -R ~/Android/android-ndk-r25b
where your android ndk is

Linux Executable fails to run with error “/usr/bin/strace: exec: No such file or directory” on running strace

I need to analyse linux binary executable file using strace for capturing the system calls.
On running the command:
/usr/bin/strace ./005f32fffe1da3bc100e7dcd8b2f8f2c
I got this error:
execve("./005f32fffe1da3bc100e7dcd8b2f8f2c", ["./005f32fffe1da3bc100e7dcd8b2f8f"...], 0x7fffd9d0a120 /* 53 vars */) = -1 ENOENT (No such file or directory) fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 write(2, "/usr/bin/strace: exec: No such f"..., 49/usr/bin/strace: exec: No such file or directory ) = 49 getpid() = 3699 exit_group(1) = ? +++ exited with 1 +++
My file type is 32 bit ELF binary.
file 005f32fffe1da3bc100e7dcd8b2f8f2c
005f32fffe1da3bc100e7dcd8b2f8f2c: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, stripped
My machine is 64 bit running Ubuntu and I have libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 installed.
This binary is strange: it is linked to use /lib/ld- as a dynamic loader.
The 32-bit i386 dynamic loader is usually called /lib/ld-linux.so.2. We can assume that your binary has been corrupted in some way.
In your other comment, you said that the binary will not run without strace (because /lib/ld- does not exist). Running the binary under strace can magically make the binary work.
You should be able to run it under strace by using explicit loader invocation:
strace -ff /lib/ld-linux.so.2 ./005f32fffe1da3bc100e7dcd8b2f8f2c
Update:
I am getting some system calls like this :
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/sse2", 0xffe9b300) = -1 ENOENT (No such file or directory)
+++ exited with 127 +++
I am not sure what kind of system calls are these ?
This is the dynamic linker attempting to load your program, and using access and stat64 system calls.
how to run the following file with strace? How do know which library to use in strace command with -ff option based on file command output ?
file mosquitto_pub
mosquitto_pub: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 2.6.32, BuildID[sha1]=7ced951dc3a859a6829feb46fd5cf757a6073361, not stripped
This is a 64-bit binary with similarly corrupted /lib64/l dynamic loader.
The standard 64-bit loader for GLIBC on x86-64 is /lib64/ld-linux-x86-64.so.2, so the command you want is:
strace -ff /lib64/ld-linux-x86-64.so.2 ./mosquitto_pub

"IOError: Can't find a path to system files" for x86 full system on Mac

I'm trying to set up gem5 x86 full system on Mac OS Mojave (10.14)
First I did a git clone to get the gem5 sources, which are located at ~/gem5.
Then I ran scons build/x86/gem5.fast to build the whole thing. I had to change some of the -Werror flags to get it to compile, but it seems to work.
To test it, I ran build/x86/gem5.fast configs/example/se.py -c tests/test-progs/hello/bin/x86/linux/hello and got the following output:
gem5 Simulator System. http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.
gem5 compiled Jan 18 2020 15:28:50
gem5 started Jan 18 2020 17:48:35
gem5 executing on My-MacBook-Pro-208.local, pid 89984
command line: build/x86/gem5.fast configs/example/se.py -c tests/test-progs/hello/bin/x86/linux/hello
Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
0: system.remote_gdb: listening for remote gdb on port 7000
**** REAL SIMULATION ****
info: Entering event queue # 0. Starting simulation...
Hello world!
Exiting # tick 5941500 because exiting with last active thread context
I wanted to configure full system simulation, so I went to the "Full-System Stuff" section at http://gem5.org/Download and downloaded the Full System Files. I extracted the tar into ~/gem5/x86-system.
So now there's ~/gem5/x86-system/binaries which contains x86_64-vmlinux-2.6.22.9 and ~/gem5/x86-system/disks which contains linux-x86.img
In ~/.bash_profile I added export M5_PATH="/Users/me/gem5/x86-system".
However, when I run scons build/x86/tests/fast/quick, almost all of the tests fail. A lot of them have a failure like this:
...
File "/Users/me/gem5/configs/common/SysPaths.py", line 62, in __call__
raise IOError("Can't find a path to system files.")
IOError: Can't find a path to system files.
I also tried to run build/x86/gem5.fast configs/example/fs.py but I get the following error:
...
File "/Users/me/gem5/configs/common/SysPaths.py", line 71, in __call__
raise IOError("Can't find file '%s' on path." % filename)
IOError: Can't find file 'x86root.img' on path.
I'm not sure what part of configuration I'm missing. The docs and google searches aren't giving any working solutions...

Bazel build fails with "Executing genrule #six_archive//:copy_six failed" error while building syntaxnet

I'm trying to follow the instructions at syntaxnet's github page to build syntaxnet parser models.
My system is a Debian Wheezy. Shouldn't be very different from Ubuntu 14.04 LTS or 15.05. I have compiled bazel 0.2.2 (as opposed to 0.2.2b) from source and it appears to work correctly.
Whenever I launch the bazel test syntaxnet/... util/utf8/... command, no tests are executed (all skipped) with some quite cryptic error messages. Here's an example:
root#host:~/tensorflow_syntaxnet/models/syntaxnet# ../../bazel/output/bazel test syntaxnet/... util/utf8/...
Extracting Bazel installation...
.............
INFO: Found 65 targets and 12 test targets...
ERROR: /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/external/six_archive/BUILD:1:1: Executing genrule #six_archive//:copy_six failed: namespace-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped).
unshare failed with EINVAL even after 101 tries, giving up.
INFO: Elapsed time: 95.469s, Critical Path: 22.46s
//syntaxnet:arc_standard_transitions_test NO STATUS
//syntaxnet:beam_reader_ops_test NO STATUS
//syntaxnet:graph_builder_test NO STATUS
//syntaxnet:lexicon_builder_test NO STATUS
//syntaxnet:parser_features_test NO STATUS
//syntaxnet:parser_trainer_test NO STATUS
//syntaxnet:reader_ops_test NO STATUS
//syntaxnet:sentence_features_test NO STATUS
//syntaxnet:shared_store_test NO STATUS
//syntaxnet:tagger_transitions_test NO STATUS
//syntaxnet:text_formats_test NO STATUS
//util/utf8:unicodetext_unittest NO STATUS
Executed 0 out of 12 tests: 12 were skipped.
I'm using Oracle Java 8 JDK as recommended, and my compiler is:
~/tensorflow_syntaxnet/models/syntaxnet# gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Tried looking into the namespace-sandbox binary that's mentioned in the error message, but before I dive deep into this, I thought I'd ask here.
~/tensorflow_syntaxnet/models/syntaxnet# ls -l /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
lrwxrwxrwx 1 root root 108 May 13 14:52 /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox -> /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
~/tensorflow_syntaxnet/models/syntaxnet# readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Command seems to work fine though:
~/tensorflow_syntaxnet/models/syntaxnet# file $(readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox)
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[md5/uuid]=0xecfd97b6a6b9a193b045be13654bd55b, not stripped
~/tensorflow_syntaxnet/models/syntaxnet# /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
No command specified.
Usage: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox [-S sandbox-root] -- command arg1
provided: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Mandatory arguments:
-S <sandbox-root> directory which will become the root of the sandbox
-- command to run inside sandbox, followed by arguments
Optional arguments:
-W <working-dir> working directory
-T <timeout> timeout after which the child process will be terminated with SIGTERM
-t <timeout> in case timeout occurs, how long to wait before killing the child with SIGKILL
-d <dir> create an empty directory in the sandbox
-M/-m <source/target> system directory to mount inside the sandbox
Multiple directories can be specified and each of them will be mounted readonly.
The -M option specifies which directory to mount, the -m option specifies where to
mount it in the sandbox.
-n if set, a new network namespace will be created
-r if set, make the uid/gid be root, otherwise use nobody
-D if set, debug info will be printed
-l <file> redirect stdout to a file
-L <file> redirect stderr to a file
#FILE read newline-separated arguments from FILE
Any idea?
UPDATE: I have done exactly the same steps on a Ubuntu 14.04 LTS (my small workstation, as opposed to the production server running Debian) and everything works well there, with all tests passing. I wonder what's the difference.
Apparently some permission errors happens when setting up the sandbox. A quick workaround is to deactivate the sandbox by using --genrule_strategy=standalone --spawn_strategy=standalone (note that the second one is already specified in the TensorFlow rc file).
You can set those flag in your ~/.bazelrc:
echo "build --genrule_strategy=standalone --spawn_strategy=standalone" >>~/.bazelrc