paragon_apfs_sdk_ce icon indicating copy to clipboard operation
paragon_apfs_sdk_ce copied to clipboard

Tweak for compilation on cygwin

Open paulotex opened this issue 2 years ago • 0 comments

I made a few tweaks to allow for compilation on cygwin. I don't know the official way to submit this to you guys, and actually a final tweak involved a manual compilation line. Perhaps someone else can create a proper pull request, or tell me how to do this?

>git diff
diff --git a/linutil/ufsdio.cpp b/linutil/ufsdio.cpp
index c7c6ed8..05012a9 100644
--- a/linutil/ufsdio.cpp
+++ b/linutil/ufsdio.cpp
@@ -35,6 +35,10 @@
 //#include <assert.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#ifdef __CYGWIN__
+  #define stat64 stat
+  #define fstat64 fstat
+#endif
 #include <fcntl.h>

 #ifdef _WIN32
@@ -159,9 +163,14 @@
     #include <sys/disk.h>
   #else
     #include <malloc.h>
-    #ifndef __QNX__
-      #include <linux/hdreg.h>
-      #include <linux/fs.h>
+    #ifdef __CYGWIN__
+      #include <cygwin/hdreg.h>
+      #include <cygwin/fs.h>
+    #else
+      #ifndef __QNX__
+        #include <linux/hdreg.h>
+        #include <linux/fs.h>
+      #endif
     #endif
   #endif
   #include <sys/ioctl.h>

I did not use the usual make.sh, because it is not detecting cygwin properly. I created a folder called "build" and from there I launched cmake with ">ccmake ../", and then generated the makefile.

"make" fails at the last step, because somehow cmake can't find the correct extension for libssl and libcrypt. This is the command that stops me to make a clean pull request for you guys, I don't know how to change CMakeLists.txt to make it work. The final link command (manually) is :

>/usr/bin/c++.exe -pipe [...] -lssl.dll -lcrypto.dll -ldl Note the "-lssl.dll -lcrypto.dll".

paulotex avatar May 04 '23 15:05 paulotex