summaryrefslogtreecommitdiffstats
path: root/md/writeup/compile_python.md
diff options
context:
space:
mode:
Diffstat (limited to 'md/writeup/compile_python.md')
-rw-r--r--md/writeup/compile_python.md23
1 files changed, 12 insertions, 11 deletions
diff --git a/md/writeup/compile_python.md b/md/writeup/compile_python.md
index 2acbb1e..13b6446 100644
--- a/md/writeup/compile_python.md
+++ b/md/writeup/compile_python.md
@@ -20,7 +20,7 @@ admin permissions then its probably one way to go.
### Download
-```
+```bash
wget -c https://www.python.org/ftp/python/$(VERSION)/Python-$(VERSION).tgz
tar -xvf Python-$(VERSION).tgz
```
@@ -29,7 +29,7 @@ tar -xvf Python-$(VERSION).tgz
Set flags to make python compiled as static
-```
+```bash
./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-fPIC -static" --disable-shared --prefix=/custom/install/path
```
@@ -46,7 +46,7 @@ Here example file used
### Compile
-```
+```bash
make
```
@@ -57,14 +57,14 @@ configured installed path.
-```
+```bash
make install
```
Later on set env variables to point to correct location of custom installed python
so can import all modules from correct location
-```
+```bash
PYTHONPATH=/custom/output/lib
PYTHONHOME=/custom/output
```
@@ -76,7 +76,7 @@ PYTHONHOME=/custom/output
### Configure
Set flags to make python compiled as static
-```
+```bash
./configure LDFLAGS="-static -static-libgcc" CPPFLAGS="-fPIC -static" --disable-shared --prefix=/custom/install/path
```
@@ -106,7 +106,7 @@ Did work by default without any changes
Disabled this modules to make it compile
-```
+```bash
_socket
_posix
pwd
@@ -116,13 +116,14 @@ dl
Got alot of linking warnings but did worked and installed at the end.
Selftest failed on:
-```
+```bash
0:01:10 load avg: 0.85 [119/404/14] test_email
make: *** [Makefile:884: test] Segmentation fault
```
### Centos6
Needed to disable modules in Modules/Setup to make it compile
+
```
_socket
_posix
@@ -131,7 +132,7 @@ dl
```
Gcc suggested to use this options
-```
+```bash
-pie -fPIC
```
@@ -147,7 +148,7 @@ Here is located compilation snippet that used to test static compilation
Clone it, goto python directory
#### Python2
-```
+```bash
make download
cp py2/Setup Python-2.X.X/Modules/Setup
make configure
@@ -158,7 +159,7 @@ make install
Output is in **output** directory
#### Python3
-```
+```bash
make download3
cp py3/Setup Python-3.X.X/Modules/Setup
make configure3