Closes #1489
getenv is not threadsafe and (maybe as a result) it's randomly crashing with CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their own.