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

Compilation on OSX #7

Open
Mathematician09183 opened this issue Jun 19, 2020 · 1 comment
Open

Compilation on OSX #7

Mathematician09183 opened this issue Jun 19, 2020 · 1 comment

Comments

@Mathematician09183
Copy link

Is it possible to compile on OSX? I am stuck on 2 errors in BSGS.h - unknown type p_thread and _mutex.

@devtronic
Copy link

This worked for me:

diff --git a/BSGS.cpp b/BSGS.cpp
index 9b035a3..e9117c3 100644
--- a/BSGS.cpp
+++ b/BSGS.cpp
@@ -59,7 +59,7 @@ BSGS::BSGS(Secp256K1 *secp) {
 #ifdef WIN64
   ghMutex = CreateMutex(NULL,FALSE,NULL);
 #else
-  ghMutex = PTHREAD_MUTEX_INITIALIZER;
+  pthread_mutex_init ( &ghMutex, NULL);
 #endif
 
 }
diff --git a/BSGS.h b/BSGS.h
index c483c57..a96b7dc 100644
--- a/BSGS.h
+++ b/BSGS.h
@@ -23,6 +23,8 @@
 #include "SECPK1/SECP256k1.h"
 #include "HashTable.h"
 #include "SECPK1/IntGroup.h"
+#include <pthread.h>
+#include <errno.h>
 
 #ifdef WIN64
 #include <Windows.h>
diff --git a/Makefile b/Makefile
index 083af13..17fafa7 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ CXXFLAGS   = -m64 -mssse3 -Wno-unused-result -Wno-write-strings -g -I. -I$(CUDA)
 else
 CXXFLAGS   =  -m64 -mssse3 -Wno-unused-result -Wno-write-strings -O2 -I. -I$(CUDA)/include
 endif
-LFLAGS     = -lpthread
+LFLAGS     = -lpthread -pthreads
 
 #--------------------------------------------------------------------
 
diff --git a/SECPK1/Int.h b/SECPK1/Int.h
index 0db269c..5073417 100644
--- a/SECPK1/Int.h
+++ b/SECPK1/Int.h
@@ -217,7 +217,7 @@ static uint64_t inline __shiftleft128(uint64_t a, uint64_t b,unsigned char n) {
   return  c;
 }
 
-#define _subborrow_u64(a,b,c,d) __builtin_ia32_sbb_u64(a,b,c,(long long unsigned int*)d);
+#define _subborrow_u64(a,b,c,d) __builtin_ia32_subborrow_u64(a,b,c,(long long unsigned int*)d);
 #define _addcarry_u64(a,b,c,d) __builtin_ia32_addcarryx_u64(a,b,c,(long long unsigned int*)d);
 #define _byteswap_uint64 __builtin_bswap64
 #else
diff --git a/Timer.h b/Timer.h
index c9ce63a..d34b35b 100644
--- a/Timer.h
+++ b/Timer.h
@@ -20,6 +20,8 @@
 
 #include <time.h>
 #include <string>
+#include <errno.h>
+
 #ifdef WIN64
 #include <windows.h>
 #endif

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

2 participants