Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sextractor on Windows
03-21-2014, 07:06
Post: #1
Sextractor on Windows
Thanks Emmanuel for making such a great and valuable tool!

Some folks in my group needed to run Source Extractor on Windows. The core of Sextractor is mostly cross-platform C, but the build system is very Unix-specific. So what we did was:
  • Another guy in my group who works on Linux, Birch Polega, created a CMake build (CMake is a cross-platform build system that works with very simple files - much easier than autoconf/automake) and got that working on Linux.
  • I then ran CMake to generate Visual Studio solution files, which I built with Microsoft Visual Studio 2012 Express Edition for Windows Desktop (that's the free version of the Microsoft IDE and compiler), and I fixed the handful of little compile errors that popped up.

A .patch file with the code changes is attached. (For some reason I'm not allowed up upload .patch files, so I renamed it to .patch.txt). A basic summary of the code changes is:
  • prefs.c: remove unneeded #include <unistd.h>
  • fitscleanup.c: #ifdef out catching SIGINT and SIGBUS as those don't exist on Windows.
  • fitsbody.c: remove unneeded #include <unistd.h>, add $ifdef'ed #include <windows.h> for memory mapping, add #ifdef'ed logic to use the Windows CreateFileMapping()/UnmapViewOfFile() functions in place of the UNIX mmap()/munmap() functions. This compiles just fine I should warn you that I'm not sure that our usage of sextractor tests this functionality. If you find any problems with this please holler and I'll help you sort it out.
  • growth.c: Birch Polega fixed an unitialized variable locarea - a nice thing about testing code on multiple platforms is some bugs only pop up on one platform or another.
  • proj.c: change copysign to wcs_copysign
  • tnx.c & fitswcs.c: on Windows use strtok_s() since strtok_r() doesn't exist.

I'm attaching a separate zip file with the CMake build files. Notice how simple they are compared to autoconf - a half-dozen files builds the whole thing on either platform. (On Windows machines CLAPACK and FFTW aren't commonly available so you'd need to download, build, and install those first. Holler if you need a hand with that.)

I hope folks find these useful, and we'd be excited to see these changes worked into the main Source Extractor build!


Attached File(s)
.txt  sextractor-windows.patch.txt (Size: 4.26 KB / Downloads: 1511)
.zip  sextractor-cmake.zip (Size: 4.07 KB / Downloads: 1181)
Find all posts by this user
Quote this message in a reply
07-01-2016, 20:08
Post: #2
RE: Sextractor on Windows
Thanks for posting this. I'm anxious to be able to build Sextractor in the native Windows environment using VisualStudio, so this looks like a great option. I'm a Windows programmer but I have cMake installed and can probably fumble through that process. But can you give me some pointers for getting these other library dependencies installed and built?

Thanks for the help.
Bruce

(03-21-2014 07:06)poelmanc Wrote:  Thanks Emmanuel for making such a great and valuable tool!

Some folks in my group needed to run Source Extractor on Windows. The core of Sextractor is mostly cross-platform C, but the build system is very Unix-specific. So what we did was:
  • Another guy in my group who works on Linux, Birch Polega, created a CMake build (CMake is a cross-platform build system that works with very simple files - much easier than autoconf/automake) and got that working on Linux.
  • I then ran CMake to generate Visual Studio solution files, which I built with Microsoft Visual Studio 2012 Express Edition for Windows Desktop (that's the free version of the Microsoft IDE and compiler), and I fixed the handful of little compile errors that popped up.

A .patch file with the code changes is attached. (For some reason I'm not allowed up upload .patch files, so I renamed it to .patch.txt). A basic summary of the code changes is:
  • prefs.c: remove unneeded #include <unistd.h>
  • fitscleanup.c: #ifdef out catching SIGINT and SIGBUS as those don't exist on Windows.
  • fitsbody.c: remove unneeded #include <unistd.h>, add $ifdef'ed #include <windows.h> for memory mapping, add #ifdef'ed logic to use the Windows CreateFileMapping()/UnmapViewOfFile() functions in place of the UNIX mmap()/munmap() functions. This compiles just fine I should warn you that I'm not sure that our usage of sextractor tests this functionality. If you find any problems with this please holler and I'll help you sort it out.
  • growth.c: Birch Polega fixed an unitialized variable locarea - a nice thing about testing code on multiple platforms is some bugs only pop up on one platform or another.
  • proj.c: change copysign to wcs_copysign
  • tnx.c & fitswcs.c: on Windows use strtok_s() since strtok_r() doesn't exist.

I'm attaching a separate zip file with the CMake build files. Notice how simple they are compared to autoconf - a half-dozen files builds the whole thing on either platform. (On Windows machines CLAPACK and FFTW aren't commonly available so you'd need to download, build, and install those first. Holler if you need a hand with that.)

I hope folks find these useful, and we'd be excited to see these changes worked into the main Source Extractor build!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)