Install G6K inside Sage on macOS
I want to install g6k on my computer, but I encountered some problems. Fortunately, I finally solved them one by one.
When I searched for a solution on the Internet, I did not find a tutorial for installing g6k on macOS, so I sorted out the problems and solutions I encountered, hoping to be helpful to you who need to install g6k.
What is G6K
G6K is a C++ and Python library that implements several Sieve algorithms to be used in more advanced lattice reduction tasks. It follows the stateful machine framework from:
Martin R. Albrecht and Léo Ducas and Gottfried Herold and Elena Kirshanova and Eamonn W. Postlethwaite and Marc Stevens, The General Sieve Kernel and New Records in Lattice Reduction.
You can also see its introduction on GitHub.
My environment information
This record may only be useful for my environment and the problems I encountered.

System: macOS Catalina 10.15.7

Sagemath version: 9.1

Python version (inside Sage): 3.7.3

pip source: https://pypi.tuna.tsinghua.edu.cn (you may need to set it if you’re in china)

Git port：10800 (my v2ray port, to across the gfw)
Check pip inside Sage
Since pip may not be used in sage sh
due to OpenSSL, you need to compile OpenSSL in sage sh
, which takes half an hour.


If it can be installed, it means that your pip is ok : )
Start installation
Download and Edit source code
Download


or


Edit source code
You can use vs code, vim or other editors you like.

g6k/kernel/fht_lsh.cpp:364:17
: Changestd::fabs
tofabs
; 
g6k/kernel/bdgl_sieve.cpp:313:55
: Changecdb[std::min(S1, insert_after+params.threads*write_index)]
tocdb[fmin(S1, insert_after+params.threads*write_index)]
;
Or you can directly download the g6k I forked, I have completed these two changes in it


Installation


But I want to use g6k more conveniently, like this:


I can view the path default included in python like this:


Then let’s enter the sitepackages
path: /Applications/SageMath9.1.app/Contents/Resources/sage/local/lib/python3.7/sitepackages


Now you can use g6k very conveniently.

