Last active
April 28, 2024 02:53
-
-
Save sirkha/8c6b8f23008baa1ee83cae193e728c77 to your computer and use it in GitHub Desktop.
gem5 shell env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs>{}; | |
stdenv.mkDerivation rec { | |
name = "gem5-git"; | |
env = buildEnv { name = name; paths = buildInputs; }; | |
zlib-dev = lib.getDev zlib; | |
zlib-lib = lib.getLib zlib; | |
buildInputs = [ | |
mercurial | |
git | |
gcc | |
scons | |
gnum4 | |
swig | |
pythonFull | |
gperftools | |
pcre | |
zlib-dev | |
zlib-lib | |
]; | |
} |
file /home/jkha/Sandbox/gem5/gem5/SConstruct,line 970:
Configure(confdir = build/.scons_config)
scons: Configure: Checking for C header file Python.h...
build/.scons_config/conftest_0.c <-
|
|#include <Python.h>
|
|
gcc -o build/.scons_config/conftest_0.o -c -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -Iinclude -Iext -I/nix/store/7dxqxqc68xfhip2rzi6vqn552f0f7phk-python-2.7.13/include/python2.7 -I/nix/store/7dxqxqc68xfhip2rzi6vqn552f0f7phk-python-2.7.13/include/python2.7 build/.scons_config/conftest_0.c
scons: Configure: yes
scons: Configure: Checking for C library python2.7...
build/.scons_config/conftest_1.c <-
|
|
|
|int
|main() {
|
|return 0;
|}
|
gcc -o build/.scons_config/conftest_1.o -c -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -Iinclude -Iext -I/nix/store/7dxqxqc68xfhip2rzi6vqn552f0f7phk-python-2.7.13/include/python2.7 -I/nix/store/7dxqxqc68xfhip2rzi6vqn552f0f7phk-python-2.7.13/include/python2.7 build/.scons_config/conftest_1.c
gcc -o build/.scons_config/conftest_1 -Xlinker -export-dynamic build/.scons_config/conftest_1.o -lpython2.7
/nix/store/3iggy4d1wdwivs4kx9ic90npiwxvnrr8-binutils-2.27/bin/ld: cannot find -lpython2.7
collect2: error: ld returned 1 exit status
scons: Configure: no
I find the following does the trick
index 5209aa6d4..c290aef4b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -175,7 +175,8 @@ if GetOption('no_lto') and GetOption('force_lto'):
#
########################################################################
-main = Environment()
+# For NixOS, based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/cgkit/scons-env.patch
+main = Environment(ENV = os.environ)
from gem5_scons import Transform
from gem5_scons.util import get_termcap
Took me quite a while to figure it out, but turns out the SConstruct file was ignoring all the Nix environment variables that Nix shell sets up; this fixes that. Even if it's not useful to you, it might be useful to someone :)
it might be useful to someone :)
Thank you.
I have been struggling with static glibc while compiling m5:
/nix/store/rhhll3vwpj38ri72ahrrrvcbkhz4fhh6-binutils-2.40/bin/ld: cannot find -lm: No such file or directory
/nix/store/rhhll3vwpj38ri72ahrrrvcbkhz4fhh6-binutils-2.40/bin/ld: cannot find -lc: No such file or directory
Changing the SConstruct file of m5 did it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scons --verbose build/X86/gem5.opt