Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cygwin support #6

Open
wlnirvana opened this issue Dec 31, 2014 · 0 comments
Open

Cygwin support #6

wlnirvana opened this issue Dec 31, 2014 · 0 comments

Comments

@wlnirvana
Copy link

The current release seems not supporting Cygwin platform. I got the error below.

$ uname -a
CYGWIN_NT-6.1 Dell 1.7.33-2(0.280/5/3) 2014-11-13 15:47 x86_64 Cygwin
$ python setup.py build
Don't know how to compile leveldb for CYGWIN_NT-6.1!

The latest leveldb has added support fow Cygwin, see here, though I recently found it's not working sometimes.

I managed to install py-leveldb on Cygwin after I applied the following changes:

$ git diff
diff --git a/leveldb/port/port_posix.h b/leveldb/port/port_posix.h
index f2b89bf..4667921 100644
--- a/leveldb/port/port_posix.h
+++ b/leveldb/port/port_posix.h
@@ -55,7 +55,7 @@

 #if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
     defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
-    defined(OS_ANDROID) || defined(OS_HPUX)
+    defined(OS_ANDROID) || defined(OS_HPUX) || defined(CYGWIN)
 // Use fread/fwrite/fflush on platforms without _unlocked variants
 #define fread_unlocked fread
 #define fwrite_unlocked fwrite
diff --git a/setup.py b/setup.py
index 9413d89..860eb94 100644
--- a/setup.py
+++ b/setup.py
@@ -38,6 +38,14 @@ elif system == 'Linux':
         '-DOS_LINUX',
         '-DLEVELDB_PLATFORM_POSIX',
     ]
+elif system.startswith('CYGWIN'):
+    extra_compile_args = common_flags + [
+        '-lpthread',
+        '-Wall',
+        '-DOS_LINUX',
+        '-DLEVELDB_PLATFORM_POSIX',
+        '-DCYGWIN',
+    ]
 else:
     sys.stderr.write("Don't know how to compile leveldb for %s!\n" % system)
     sys.exit(1)
$

I wonder if we can add this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant