-
Notifications
You must be signed in to change notification settings - Fork 57
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
Can obliv-c complie c++ #89
Comments
Nope. Obliv-C relies on CIL, which can basically support many features in C, but no guarantee in C++. https://people.eecs.berkeley.edu/~necula/cil/ |
Thank you for your reply. |
Thanks for your interest in this. The first step is figuring out how to mix C and C++ in general, without Obliv-C being in the mix. Here is a good place to get started: https://isocpp.org/wiki/faq/mixing-c-and-cpp, but you can probably find others online. After that, you should be able to link Obliv-C functions and C++ together. You'll still have to keep the |
I am trying to make it .But I do not know how oblivcc (in"oblivc/bin")works. It is a executable file. |
Can you list the exact commands you are trying? And the path where your files are? It's hard to figure out what's wrong from the description. |
I have created three files "gazelle.c" “gazelle.h” and “gazelle.oc”in oblivc/test/oblivc/garble.They can run accurately. |
Yes, Btw, you shouldn't need to create a |
I have tried it again and again,but failed. |
Ok, I made a few changes to make this work: $ diff -ru garble garble-modified/
diff -ru garble/gazelle.c garble-modified/gazelle.c
--- garble/gazelle.c 2019-04-27 13:23:22.000000000 -0700
+++ garble-modified/gazelle.c 2019-04-27 11:36:51.730552256 -0700
@@ -4,7 +4,7 @@
#include<pthread.h>
//#include<gazelle.oc>
#include"gazelle.h"
-void sereveprog(void *args)
+void* sereveprog(void *args)
{
ProtocolDesc pd;
Args *ref=args;
@@ -15,8 +15,9 @@
setCurrentParty(&pd,1);
execYaoProtocol(&pd,gazelle,&(*ref).io);
cleanupProtocol(&pd);
+ return NULL;
}
-void clientprog(void *args)
+void* clientprog(void *args)
{
ProtocolDesc pd;
Args *ref=args;
@@ -27,9 +28,10 @@
setCurrentParty(&pd,2);
execYaoProtocol(&pd,gazelle,&(*ref).io);
cleanupProtocol(&pd);
+ return NULL;
}
-extern "C"
-{
int garble()
{
// helib();
@@ -121,4 +123,4 @@
printf("\n");
return 0;
}
-}
Only in garble-modified/: gazelle.c.o
diff -ru garble/gazelle.h garble-modified/gazelle.h
--- garble/gazelle.h 2019-04-25 15:15:44.000000000 -0700
+++ garble-modified/gazelle.h 2019-04-27 11:37:09.127684745 -0700
@@ -29,5 +29,5 @@
char* port;
}Args;
void gazelle(void* args);
-void sereveprog(void *args);
-void clientprog(void *args);
+void* sereveprog(void *args);
+void* clientprog(void *args);
Only in garble-modified/: gazelle.oc.o
diff -ru garble/main.c garble-modified/main.c
--- garble/main.c 2019-04-27 13:28:50.000000000 -0700
+++ garble-modified/main.c 2019-04-27 11:39:09.472600331 -0700
@@ -1,19 +1,9 @@
-#include "main.h"
#include <stdio.h>
-//include "hr-dmethod1.h"
-
-#ifdef __cplusplus
-extern "C"{
-#endif
int garble();
-#ifdef _cplusplus
-}
-#endif
-//int helib();
+
int main()
{
- // helib();
garble();
return 0;
} And then compilation (I didn't try running it, just compiled): $ alias oblivcc=$HOME/Projects/obliv-c/bin/oblivcc
$ oblivcc -c gazelle.oc -o gazelle.oc.o
$ gcc -c main.c -o main.c.o
$ gcc -c gazelle.c -o gazelle.c.o -I $HOME/Projects/obliv-c/src/ext/oblivc
$ oblivcc gazelle.c.o gazelle.oc.o main.c.o -pthread This creates an Now, a few points about C and C++ linking (these are independent of Obliv-C):
The other thing I noticed is that your client and server are in the same process, different threads. I don't know why you are doing that, but garbled circuits is meant for 2PC, which usually means two parties in two different machines. Let me know if you run into other issues. |
I am sorry to trouble you.
I have a question but do not know who can help me.
I want to compile c++ project in obliv-c . Can obliv-c complie c++?
the error is
/usr/include/string.h[43:0-19] : syntax error
Parsing errorFatal error: exception Frontc.ParseError("Parse error")
Thank you very much!
The text was updated successfully, but these errors were encountered: