Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup.py fails on debian 9 #40

Closed
mwenzl opened this issue Nov 21, 2019 · 2 comments
Closed

setup.py fails on debian 9 #40

mwenzl opened this issue Nov 21, 2019 · 2 comments

Comments

@mwenzl
Copy link

mwenzl commented Nov 21, 2019

Hi,

setup.py ('python setup.py install --user --prefix=') fails on debian 9 with the message:

[ 95%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp.o
[ 95%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp.o
[ 96%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp.o
[ 97%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp.o
[ 97%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp.o
[ 98%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/__/lib/Target/X86/TargetInfo/X86TargetInfo.cpp.o
[ 99%] Building CXX object llvm/keystone/CMakeFiles/keystone.dir/ks.cpp.o
[100%] Linking CXX shared library ../lib/libkeystone.so
[100%] Built target keystone
error: Setup script exited with error: SandboxViolation: mkdir('/usr/lib/python2.7/dist-packages/keystone', 511) {}

Please find a patch solving this issue below.

Best,
mwenzl

setup.py.patch.txt

diff --git a/setup.py b/setup.py
index 29be93b..0a27039 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,19 @@
 from setuptools import setup
 from sys import version_info
+from setuptools.command.install import install
+
+class CustomInstallCommand(install):
+    def run(self):
+        try:
+            from setuptools.sandbox import DirectorySandbox
+            def violation(operation, *args, **_):
+                print "SandboxViolation: %s" % (args,)
+            
+            DirectorySandbox._violation = violation
+        except ImportError:
+            pass
+        
+        return install.run(self)
 
 
 setup(
@@ -31,5 +45,6 @@ setup(
     url='https://github.com/avatartwo/avatar2',
     description='A Dynamic Multi-Target Orchestration Framework',
     maintainer='Marius Muench',
-    maintainer_email='marius.muench@eurecom.fr'
+    maintainer_email='marius.muench@eurecom.fr',
+    cmdclass={'install': CustomInstallCommand}
 )
@mariusmue
Copy link
Member

Thanks for reporting! This seems to be yet another problem related to the keystone project (and not avatar2).
In any case, I don't think it is wise to just ignore Sandbox errors away and I would prefer to not merge an according patch.

As keystone is only required for the assembler plugin, I think it is about time to decouple the setup of avatar2 from capstone/keystone. I can look into it once I have spare cycles.

@mariusmue
Copy link
Member

The latest version of keystone on PyPi (v0.9.2) seems to fix the keystone-related installation errors.
Hence, I'm closing this issue for now - if there still persist problem, please add a comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants