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

在mac上,make失败,如何解决? #6

Open
luckypoem opened this issue Mar 24, 2016 · 18 comments
Open

在mac上,make失败,如何解决? #6

luckypoem opened this issue Mar 24, 2016 · 18 comments

Comments

@luckypoem
Copy link

hi.
我之前已用brew install libev安装了libev.

yudeMacBook-Air:mptunnel brite$ ls
LICENSE client.sample.conf rbtree.c
Makefile linklist.h rbtree.d
README.md mptunnel.c rbtree.h
README.zh_CN.md mptunnel.d server.c
buffer.h mptunnel.h server.d
client.c net.c server.h
client.d net.d
client.h net.h
yudeMacBook-Air:mptunnel brite$ make
gcc -g -Wall -I/usr/include/libev -c -o client.o client.c
In file included from client.c:17:
./mptunnel.h:114:6: error: conflicting types for 'encrypt'
void encrypt(char* buf, int size, uint32_t);
^
/usr/include/unistd.h:544:7: note: previous declaration is here
void encrypt(char *, int) __DARWIN_ALIAS(encrypt);
^
1 error generated.
make: *
* [client.o] Error 1
yudeMacBook-Air:mptunnel brite$

tks

@greensea
Copy link
Owner

已修复,pull 最新版本再编译试试

@luckypoem
Copy link
Author

hi.

我重新克隆了,然后make,仍然遇到错误:
yudeMacBook-Air:mptunnel yuming$ make
gcc -MT "net.o net.d" -MM -g -Wall -I/usr/include/libev -O2 net.c > net.d
gcc -g -Wall -I/usr/include/libev -O2 -c -o client.o client.c
gcc -g -Wall -I/usr/include/libev -O2 -c -o net.o net.c
gcc -g -Wall -I/usr/include/libev -O2 -c -o mptunnel.o mptunnel.c
mptunnel.c:116:43: error: use of undeclared identifier
'PTHREAD_MUTEX_RECURSIVE_NP'
pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE_NP);
^
1 error generated.
make: *** [mptunnel.o] Error 1
yudeMacBook-Air:mptunnel yuming$

如何解决?

@luckypoem
Copy link
Author

很奇怪,我之前在vps上可以make成功,为何在mac上却 make失败呢?

@greensea
Copy link
Owner

暂时仅支持 Linux
因为使用了一个不可跨平台的线程属性 PTHREAD_MUTEX_RECURSIVE_NP,所以只能在 Linux 下使用

@greensea
Copy link
Owner

谷歌了一下,你可以试试把所有的 PTHREAD_MUTEX_RECURSIVE_NP 替换成 PTHREAD_MUTEX_RECURSIVE 然后再编译看看

@luckypoem
Copy link
Author

在哪里改PTHREAD_MUTEX_RECURSIVE_NP?我没看见他们

@greensea
Copy link
Owner

greensea commented Apr 5, 2016

全文搜索一下你就看到了,我记得应该只有几个地方

@luckypoem
Copy link
Author

HI.
找不到诶。
yudeMacBook-Air:mptunnel brite$ find . -name PTHREAD_MUTEX_RECURSIVE
yudeMacBook-Air:mptunnel brite$ find . -name PTHREAD_MUTEX_RECURSIVE_NP
yudeMacBook-Air:mptunnel brite$

你说的“全文搜索”是指在哪里搜索?

@greensea
Copy link
Owner

随便找个 IDE 就有代码全文搜索了嘛
或者你试试:
grep -nrHFI PTHREAD_MUTEX_RECURSIVE ./

On Sat, Apr 9, 2016 at 3:43 PM, luckypoem [email protected] wrote:

HI.
找不到诶。
yudeMacBook-Air:mptunnel brite$ find . -name PTHREAD_MUTEX_RECURSIVE
yudeMacBook-Air:mptunnel brite$ find . -name PTHREAD_MUTEX_RECURSIVE_NP
yudeMacBook-Air:mptunnel brite$

你说的“全文搜索”是指在哪里搜索?


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#6 (comment)

@luckypoem
Copy link
Author

哦,
就是把mptunnel.c文件里的PTHREAD_MUTEX_RECURSIVE_NP改为PTHREAD_MUTEX_RECURSIVE
(只有一处),然后make成功。
谢谢你

@luckypoem
Copy link
Author

hi.

你在https://github.com/greensea/mptunnel/blob/master/README.zh_CN.md 里说:“3000 是 mpclient 在本地监听的端口”,怎么在client.conf里体现这个端口?如何修改3000为其他端口?

@greensea
Copy link
Owner

暂时改不了,其实现在代码中使用的端口是 3002 而不是 3000
你可以直接修改源代码,大概在 server.c 的 187 行


g_listen_fd = net_bind("0.0.0.0", 3002, SOCK_DGRAM);

把 3002 改成你想要的端口然后重新编译即可

@luckypoem
Copy link
Author

hi.

我在mac上安装了openvpn的客户端程序tunnelblick,不过openvpn客户端的配置文件里如何写路由呢?我的
openvpn客户端的配置文件内容为:
dev tun
proto udp
#remote your_vps_ip 35287
remote 127.0.0.1 3002
route add -net 10.9.0.2 netmask 255.255.255.0
ifconfig 10.9.0.2 10.9.0.1
secret static.key
comp-lzo
verb 3

我的路由写成route add -net 10.9.0.2 netmask 255.255.255.0,对吗??
我是使用静态密匙模式的openvpn,我的vps上的openvpn的的配置文件的内容为:

root@AR:/etc/openvpn# cat openvpn-static-key-mode.conf
dev tun
proto udp
ifconfig 10.9.0.1 10.9.0.2
secret static.key
local 127.0.0.1
port 35287
comp-lzo
verb 3
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 10.9.0.1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
log-append openvpn-static.log
root@AR:/etc/openvpn#

我服务器上的openvpn在运行中:
root@AR:/etc/openvpn# ps aux|grep openvpn
root 10715 0.0 0.1 5120 1140 ? Ss 09:33 0:00 openvpn --daemon ovpn-server --cd /etc/openvpn --config /etc/openvpn/openvpn-static-key-mode.conf
root 10794 0.0 0.1 3600 828 pts/2 S+ 09:50 0:00 grep openvpn
root@AR:/etc/openvpn#

服务器上的mpserver在运行中:
root@AR:/etc/openvpn# ps aux|grep mpserver
root 10737 0.0 0.1 22540 796 pts/2 Sl 09:36 0:00 ./mpserver 2001 127.0.0.1 35287
root 10801 0.0 0.1 3596 816 pts/2 S+ 09:54 0:00 grep mpserver
root@AR:/etc/openvpn#

本地机器的mpclient也在运行中:
yudeMacBook-Air:mptunnel brite$ ps aux|grep mpclient
yuming 6619 0.0 0.0 2453348 76 ?? S 11:02上午 0:00.03 ./mpclient client.conf
yuming 13284 0.0 0.0 2432772 552 s000 R+ 9:18下午 0:00.00 grep mpclient
yudeMacBook-Air:mptunnel brite$ cat client.conf
my_vps_ip 2001
yudeMacBook-Air:mptunnel brite$

但在本地机器mac上,用tunnelblick就是连不上openvpn server,不知为什么?

@greensea
Copy link
Owner

首先,去掉 mptunnel,看看 openvpn 是否能够成功连接,如果能够成功连接,那就可以排除 openvpn 的配置文件的问题。
确定 openvpn 的配置没有问题之后,再上 mptunnel,启动 openvpn 后,看看 mpserver 和 mpclient 是否有日志输出。在有网络流量的情况下,mpserver 和 mpclient 应该会输出大量的日志。如果看不到任何日志,说明 mptunnel 的配置有问题。

@luckypoem
Copy link
Author

去掉 mptunnel,openvpn肯定是连不上的。(2012年底开始,openvpn的流量就被gfw识别导致openvpn无法使用)

你曾经通过mptunnel从而成功连上过openvpn server吗?如果成功过,可否在你的博客上发篇文章,详细介绍介绍?

现在openvpn基本上成为废物。非常感谢!

@greensea
Copy link
Owner

倒也不一定连不上,我当时遇到的情况是能够连上,但是用了几分钟之后就连不上了。过一段时间之后又可以连上,然后用了几分钟之后又再次连不上了。
当然你可以不必在服务器上进行测试,把服务器的配置文件复制到本地,在本地做一个连接测试,以便确定 OpenVPN 的配置文件没有问题

@luckypoem
Copy link
Author

问题是我这里根本连不上。以前按此文http://www.chinagfw.org/2012/12/openvpngfw.html ,搭建了静态密钥模式的openvpn,但是今年三月中以来就连不上了。所以才想到用你这个mptunnel来给openvpn做个“套子”,但未搞成功。你可否亲自在你的vps上搭建静态密钥模式的openvpn并搭建mptunnel,看看是否能翻墙呢?

@greensea
Copy link
Owner

奇怪,好像我前几天的回复被吃掉了。

你可以先把服务器端的配置文件复制到本地,在本地启动 OpenVPN 服务器,然后测试一下是否能够正常连接。这样可以先确认配置文件没有问题

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