emp-toolkit / emp-sh2pc

Semi-honest Two Party Computation Based on Garbled Circuits.
Other
76 stars 38 forks source link

use emp-sh2pc linked error #11

Closed songchuangyuan closed 5 years ago

songchuangyuan commented 5 years ago

multiple definition of emp::afree(void*)' multiple definition ofeb_curve_get_tab_data'

wangxiao1254 commented 5 years ago

Just reran the EMP building, and everything is fine: https://travis-ci.org/emp-toolkit/emp-sh2pc

Can you specify exactly what's going on?

songchuangyuan commented 5 years ago

I include emp-sh2pc.h file directly in many .h files of my project, or include emp-sh2pc.h file in my a.h file, and include a.h file in other . h files, which will report that multiple definition link error.

songchuangyuan commented 5 years ago

like this:the .h file include emp-sh2pc.h file directly named network.h image and other .h file include network.h. image then,when I make my project, report multiple definition of emp::afree(void*)' and multiple definition ofeb_curve_get_tab_data'. but if I include and use emp-sh2pc.h just only in main.cpp,it's OK。

songchuangyuan commented 5 years ago

looked at the source code for the error location, which is the global variables and functions defined in emp-ot code. image image

wangxiao1254 commented 5 years ago

but they are guarded by macros...

On Wed, Apr 3, 2019 at 10:56 PM songchuangyuan notifications@github.com wrote:

looked at the source code for the error location, which is the global variables and functions defined in emp-ot code. [image: image] https://user-images.githubusercontent.com/46445562/55526582-43a75b00-56c8-11e9-958d-30a46e3a7a40.png [image: image] https://user-images.githubusercontent.com/46445562/55526602-5326a400-56c8-11e9-833f-71c5973ed3ca.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/emp-toolkit/emp-sh2pc/issues/11#issuecomment-479730847, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKjCvNm0yvQceaX2uq8u6BwH6gEVe5vks5vdWnvgaJpZM4caKCw .

songchuangyuan commented 5 years ago

but they are guarded by macros Sorry, I don't quite understand what it means. What should I do if I want to use it my way? I mainly want to use semi-honest communication functions like this: image image

In other classes, I used the object of the Network class to call the send_int (int value) function and recv_int() function.like this: image

songchuangyuan commented 5 years ago

我知道答案了,包含了emp-sh2pc.h的.h文件,不能有对应.cpp文件,如果有了.cpp文件,就会生成.o文件,这样你们这个开源库中定义的全局变量就会出现重复定义。

wangxiao1254 commented 5 years ago

但是并没对应的的cpp文件啊

On Wed, Apr 10, 2019 at 08:18 songchuangyuan notifications@github.com wrote:

我知道答案了,包含了emp-sh2pc.h的.h文件,不能有对应.cpp文件,如果有了.cpp文件,就会生成.o文件,这样你们这个开源库中定义的全局变量就会出现重复定义。

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/emp-toolkit/emp-sh2pc/issues/11#issuecomment-481666665, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKjCj5uW8g0vKsOwpZFICZXSGA8Yeqiks5vfdaQgaJpZM4caKCw .

-- Sent from Gmail Mobile

songchuangyuan commented 5 years ago

只是你们这个emp库里的实现是只有.h文件。可是正常的c++写法是在.h文件中定义类,在.cpp文件中实现类的函数,所以在我们自己的代码中,只要用到你们这个库里相关的类就不能这么写了,只能在.h文件中把类的定义和实现都写了。

wangxiao1254 commented 5 years ago

这个也是为了效率,很多函数一秒钟被调用超过一千万次。。。 如果有更好的办法大家交流一下:)

On Thu, Apr 11, 2019 at 4:42 AM songchuangyuan notifications@github.com wrote:

只是你们这个emp库里的实现是只有.h文件。可是正常的c++写法是在.h文件中定义类,在.cpp文件中实现类的函数,所以在我们自己的代码中,只要用到你们这个库里相关的类就不能这么写了,只能在.h文件中把类的定义和实现都写了。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/emp-toolkit/emp-sh2pc/issues/11#issuecomment-482024525, or mute the thread https://github.com/notifications/unsubscribe-auth/ACKjCsCNVa6kovCzh7Y3SRc67yM5x5cVks5vfvV6gaJpZM4caKCw .

wangxiao1254 commented 5 years ago

See https://github.com/emp-toolkit/emp-ot/pull/26.