fredboudon / lpy

An open source python version of the Lindenmayer Systems.
Other
14 stars 13 forks source link

debug build lpy #28

Open fredboudon opened 3 years ago

fredboudon commented 3 years ago
j-levy commented 3 years ago

I wrote the doc and tweaked the windows build script. Now it activates both Developer Command Tools and Conda environments by calling the scripts inside the build script. If someone wants to build manually, the doc is written for that.

By the way I tried excatly ALL versions of CMake found in conda-forge and I couldn't generate a project using NMake Generator.

CMake must be fixed at >= 3.16 if you're targetting Python 3.9.

I try to install boost-cpp=1.67, which is the latest version that has been built for both Win-32 and Win-64 available on Anaconda.org, but it raises a ton of conflicts. Maybe the NMake Generator has a FindBoost module that raises errors when it only finds one version (x64) of Boost?

As far as I can tell, the simplest way to fix this issue is to switch to the Visual Studio 16 2019 generator, which is up-to-date and finds 64-bits Boost library correctly.

There's still the LDFLAG missing in some CMake files to compile on macOS without specifying the LDFLAG manually.

j-levy commented 3 years ago

Instead of using the -undefined dynamic_lookup flag I tried to be cleaner and smarter and check what flags were missing.

They were Python methods that weren't defined when linking. Great, I thought, I'd just put target_library_link(targetname ${Python3_LIBRARIES} and we'll be good.

Adding this works on Windows (compiles and runs), but on macOS, it compiles correctly but fails to run. When launching lpy it says error in python malloc with an obscure memory address. (Tested on macOS 11.4, Xcode 11.3, Python 3.9, Lpy 3.8.0). When running any python module it justs says Segfault 11.

After trying to compile it multiple times with various flags, I couldn't make it run correctly with this target_link_library, so I decided to go as planned and rely on the -undefined dynamic_lookup. This works okay. PR on the way!