xcist / main

simulation and reconstruction package
BSD 3-Clause "New" or "Revised" License
45 stars 20 forks source link

Problems compiling catsim in Windows 10 #36

Closed juanenofbit closed 1 year ago

juanenofbit commented 1 year ago

Hi, I am encountering problems trying to compile catsim in Windows 10 (x64)

When running the BuildWin64.bat script in the clib_build folder, the following error appears in the command window after object files are created:

g++ -static-libgcc -static-libstdc++ -o libcatsim64.dll -shared MatVec.o BaseObject.o ClipPlane.o Transformation.o Intersection.o Interpolate.o main.o Photon.o CrossSectionHandler.o Volume.o Detector.o CrossSection.o Phantom.o DD3Proj.o DD3Proj_roi_notrans_mm.o voxelized_projector.o getMemorySize.o gemsfilt.o pd3dbpsemi.o DD2Back.o DD2Proj.o DD2WBack.o DD3WBack.o pd2dbpcurved.o pd2dbpflat.o extractsino.o viewshift.o spline.o xybowtie.o DD2ParProj.o analytic_projector.o rndpoi.o nCAT_main.o -LC:\mingw64\lib -lpthreadGC2_x64 -IC:\mingw64\include
c:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpthreadGC2_x64: No such file or directory
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [..\MakeWindows64:21: Library] Error 1

I am using winlibs (http://winlibs.com/), version gcc-11.2.0-mingw-w64msvcrt-10.0.0-r1 installed in the C:\mingw64 folder.

It would be helpful to know which compiler or additional configuration to use to compile the executable, or upload it to github. Thanks!

zhangjy-ge commented 1 year ago

Hi,

This is because that by default compilers cannot find the path to pthread. Could you try to unzip main-master\catsim\lib\pthreads-2-9-1-release.zip, then modify following lines in MakeWindows64 ? Note you need to use your pathname (like Pre-build.2) instead of pthread_build. image

juanenofbit commented 1 year ago

Thank you! After updating the paths, the script worked without errors, and a new libcatsim64.dll file was created, replacing the old one in the catsim\lib directory.

However, I was expecting to create an executable file catsim.exe like the one in the EXE directory, included in the release. [https://github.com/xcist/main/releases/tag/v0.1.0]

Would it be possible to compile this file to run catsim on the Windows command line?

zhangjy-ge commented 1 year ago

Actually if you have python installed on Windows, you should be able to run xcist/catsim using python directly. just import catsim after you enter python interface.

If you have to use catsim.exe, then probably it is better for @MingyeWu to answer your question.

MingyeWu commented 1 year ago

The EXE was generated using pyInstaller, which needs the Python environment. We stopped providing the EXE version for now because we want to embrace the convenience of code updating of the Python environment.