ShadowsocksR-Live / shadowsocksr-native

翻墙 从容穿越党国敏感日 ShadowsocksR (SSRoT) native implementation for all platforms, GFW terminator
https://github.com/ShadowsocksR-Live/shadowsocksr-native/wiki
GNU General Public License v3.0
2.74k stars 763 forks source link

How to config Xcode project for macOS? What's the ideal config for macOS compilation? #55

Closed zhangzhe192608 closed 5 years ago

zhangzhe192608 commented 5 years ago

What version of shadowsocks-native are you using?

HEAD of this repo.

What operating system are you using?

macOS

What did you do?

I was trying to compile ssrLocal macOS however there seems to be a lot of missing staff, including:

However, I cannot compile ssrLocal.xcodeproj for both iOS and macOS. What should I do?

What did you expect to see?

The compilation passed without any errors.

What did you see instead?

Actually the compilation passed. However, I am not sure whether is is a correct way to do so.

What is your config in detail (with all sensitive info masked)?

No need to provide this.

ssrlive commented 5 years ago

Using ssrNative in macOS instead.

ssrlive commented 5 years ago

Sometimes in the future, ssrLocal will be removed.

zhangzhe192608 commented 5 years ago

@ssrlive Thanks for your prompt reply!

When I was using ssrNative, there were several missing headers (for example, 'uv-mbed/uv-mbed.h' file not found)and I added then accordingly to the header search path:

After that, there are still several erros:

Error Group
:-1: Undefined symbol: _http_headers_destroy
:-1: Undefined symbol: _http_headers_get_field_val
:-1: Undefined symbol: _http_headers_get_status
:-1: Undefined symbol: _http_headers_parse
:-1: Undefined symbol: _websocket_build_frame
:-1: Undefined symbol: _websocket_generate_sec_websocket_accept
:-1: Undefined symbol: _websocket_generate_sec_websocket_key
:-1: Undefined symbol: _websocket_retrieve_payload

What should I do?

ssrlive commented 5 years ago

Add the .c files to the project.

zhangzhe192608 commented 5 years ago

@ssrlive

Sorry, what do you mean by .c files? I tried to add the missing files from ./src/* but the error is still:

:-1: Undefined symbol: _http_headers_destroy
:-1: Undefined symbol: _http_headers_get_field_val
:-1: Undefined symbol: _http_headers_get_status
:-1: Undefined symbol: _http_headers_parse
:-1: Undefined symbol: _websocket_build_frame
:-1: Undefined symbol: _websocket_generate_sec_websocket_accept
:-1: Undefined symbol: _websocket_generate_sec_websocket_key
:-1: Undefined symbol: _websocket_retrieve_payload

The full error message:

Undefined symbols for architecture x86_64:
  "_http_headers_destroy", referenced from:
      _tunnel_tls_on_data_received in client.o
  "_http_headers_get_field_val", referenced from:
      _tunnel_tls_on_data_received in client.o
  "_http_headers_get_status", referenced from:
      _tunnel_tls_on_data_received in client.o
  "_http_headers_parse", referenced from:
      _tunnel_tls_on_data_received in client.o
  "_websocket_build_frame", referenced from:
      _tunnel_tls_client_incoming_streaming in client.o
  "_websocket_generate_sec_websocket_accept", referenced from:
      _tunnel_tls_on_data_received in client.o
  "_websocket_generate_sec_websocket_key", referenced from:
      _tunnel_tls_on_connection_established in client.o
  "_websocket_retrieve_payload", referenced from:
      _tunnel_tls_on_data_received in client.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
zhangzhe192608 commented 5 years ago

Hello @ssrlive, here is an update! The good news it that I can compile the project by adding the source files into the target's 'Compile Sources':

image

Am I dong this right? I added:

ssrlive commented 5 years ago

yes

zhangzhe192608 commented 5 years ago

Thank you so much for your kind help, @ssrlive!

Best wishes to you!

I'm closing this issue and may open it again if I have any further questions.