elkai icon indicating copy to clipboard operation
elkai copied to clipboard

Switch from Python.h to milksnake+cffi

Open Mortal opened this issue 5 years ago • 8 comments

This allows setup.py bdist_wheel to create a wheel that is independent of the Python version.

Move InvokeSolver() from _elkai.c into LKH-2.0.9/SRC/elkai.c, and reimplement solve() in elkai/_elkai.py.

Update LKH-2.0.9/SRC/Makefile to build a shared library named libelkai.so (instead of trying to build an executable without main).

Update setup.py to invoke make and generate CFFI bindings for LKH-2.0.9/SRC/INCLUDE/elkai.h (which only declares InvokeSolver()).

Mortal avatar May 18 '19 18:05 Mortal

Also, keep in mind that the Makefile by LKH that you modified isn't used in the build process, it has to be CMake. Edit: actually never mind, I guess milkshake uses it?

fikisipi avatar May 18 '19 18:05 fikisipi

Also, keep in mind that the Makefile by LKH that you modified isn't used in the build process, it has to be CMake. Edit: actually never mind, I guess milkshake uses it?

I modified setup.py so that it invokes make in LKH. I also removed the dependency on skbuild, so CMake is not used.

Mortal avatar May 18 '19 19:05 Mortal

  1. I apologize for spelling milksnake incorrectly. It's not a milkshake, huh 🤣
  2. I'm getting errors when doing a build:
running bdist_wheel
running build
running build_py
error: [WinError 2] The system cannot find the file specified

I guess I'm missing Make. I will try it a Linux build tomorrow.

fikisipi avatar May 20 '19 00:05 fikisipi

@Mortal I am getting the following error

process_begin: CreateProcess(NULL, cc -fPIC -c -o OBJ/Activate.o Activate.c -O3 -Wall -IINCLUDE -DTWO_LEVEL_TREE -g, ...) failed.
make (e=2): The system cannot find the file specified.
make[1]: *** [OBJ/Activate.o] Error 2
make[1]: Leaving directory `C:/Users/Filip/milk/milksnake/LKH-2.0.9/SRC'

fikisipi avatar Jun 10 '19 21:06 fikisipi

A s s e r t i o n f a i l e d : H T a b l e = ( H a s h T a b l e * ) m a l l o c ( s i z e o f ( H a s h T a b l e ) ) , f i l e . . \ . . \ . . \ L K H - 2 . 0 . 9 \ S R C \ A l l o c a t e S t r u c t u r e s . c , l i n e 3 5 What should I do if I make this mistake

MaoHeiHei avatar Jul 12 '21 11:07 MaoHeiHei

@Mortal

MaoHeiHei avatar Jul 12 '21 12:07 MaoHeiHei

@MaoHeiHei More information? Do the wheels not work for you? Are you trying to compile?

fikisipi avatar Jul 24 '21 14:07 fikisipi

A s s e r t i o n   f a i l e d :   H T a b l e   =   ( H a s h T a b l e   * )   m a l l o c ( s i z e o f ( H a s h T a b l e ) ) ,   f i l e   . . \ . . \ . . \ L K H - 2 . 0 . 9 \ S R C \ A l l o c a t e S t r u c t u r e s . c ,   l i n e   3 5    Process finished with exit code -1073740791 (0xC0000409)

I don't know how to solve this error. Is there not enough memory  

------------------ 原始邮件 ------------------ 发件人: "fikisipi/elkai" @.>; 发送时间: 2021年7月24日(星期六) 晚上10:44 @.>; @.@.>; 主题: Re: [fikisipi/elkai] Switch from Python.h to milksnake+cffi (#3)

@MaoHeiHei More information? Do the wheels not work for you? Are you trying to compile?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

MaoHeiHei avatar Jul 28 '21 08:07 MaoHeiHei