Coder Social home page Coder Social logo

Comments (11)

iceonsun avatar iceonsun commented on May 27, 2024

我手头只有14年的MBP,所以麻烦你试一下这个版本
https://github.com/iceonsun/rsock/releases/tag/v1.5.1

from rsock.

david9991 avatar david9991 commented on May 27, 2024

v1.5.1 不好用,但我在我的 14MBP 上重编完在 12later 上能跑。奇怪。
顺手改了一个编译不过的问题。虽然不知道为啥 !data 还要判断 data <= 0?我本能地加个强转。XD

diff --git a/util/rhash.cpp b/util/rhash.cpp
index 12b4c2f..488662b 100644
--- a/util/rhash.cpp
+++ b/util/rhash.cpp
@@ -24,7 +24,7 @@ static bool hash_equal(const HashBufType &hashed_buf, const std::string &key, co
 static int8_t compute_hash(HashBufType &hash, const std::string &key, const char *data, int data_len);
 
 int8_t compute_hash(HashBufType &hash, const std::string &key, const char *data, int data_len) {
-    if (!data || data <= 0) {
+    if (!data || (size_t)data <= 0) {
         return -1;
     }
     assert(hash.size() <= MD5_LEN);

from rsock.

iceonsun avatar iceonsun commented on May 27, 2024

v1.5.1 不好用

不好用指的是速度变慢了还是仍然不能跑

但我在我的 14MBP 上重编完在 12later 上能跑

你重编用的是project中的Darwin,还是用的CMakeLists.txt

data 还要判断 data <= 0?

错了错了,应该是判断 data_len <= 0。

from rsock.

david9991 avatar david9991 commented on May 27, 2024

不好用是指还是 Illegal instruction。
我是用 CMakeList.txt 重编的,mkdir build; cd build; cmake ..; make 这么编的,好使。

from rsock.

iceonsun avatar iceonsun commented on May 27, 2024

你mini的系统和pro一样吗,检查一下有没有这个库 /usr/lib/libc++.dylib

from rsock.

david9991 avatar david9991 commented on May 27, 2024

我现在 mini 连接不上,不过这两个系统我都升级到了 high sierra 10.13.3 了,libc++.dylib 应该是苹果的标配吧,libstdc++ 反而需要另安。
Illegal instruction 这个问题我们之前也遇到过,基本就是加 march=amd64 或 x86-64 来解决,但那都是手写 Makefile 才需要加,CMake 我们没加倒也没出现问题。你能说明一下你发布的二进制的详细的编译方法吗?我用你的方法试试。

from rsock.

iceonsun avatar iceonsun commented on May 27, 2024

编译步骤:

cd path/to/rSock/
mkdir xbuild/build/Darwin_x86_64 && cd xbuild/build/Darwin_x86_64
 cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/Darwin_x86_64.toolchain.cmake ../../..

这个macos toolchain指定了用clang++(所以不用装libstdc++)。

在前一个版本已经取消了-O2优化。

我网上查了一下,很可能是你说的那个问题。昨天那个1.5.1已经在cmake中加了march=x86-64。你说也不行,我就先撤销了。我手上目前也只有一台14年的pro,所以不大方便测试更旧机子。

你要是不介意的话,麻烦你测试一下。直接在CMakeLists.txt 中(##release之前)添加一行 add_definitions(march=amd64) 或者 add_definitions(march=x86-64)

from rsock.

david9991 avatar david9991 commented on May 27, 2024

我试试看能否重现这个问题。

from rsock.

david9991 avatar david9991 commented on May 27, 2024

果然用你的方法 Illegal instruction……
不加 toolchain.cmake 其实是用我本机的 libuv, libnet, libpcap 的动态库动态编译。而使用你的 toolchain.cmake 用的你的 xbuild/lib 下的静态库编译,所以判断问题应该出在你的静态库里。如果你的静态库也是从 brew 里取的,那你是否 export HOMEBREW_ARCH=x86_64 再安装的这三个库呢?因为 Homebrew 在编译安装的时候,也需要指定 -march,才能架构兼容。

我刚刚用我的 home-brew 的这三个库替换掉了你的,在 12later 上好用了。

from rsock.

iceonsun avatar iceonsun commented on May 27, 2024

如果你的静态库也是从 brew 里取的

对的。是直接从brew里面取出来的。
我用了你的方法,重新编译了一下, 麻烦你试试看。
https://github.com/iceonsun/rsock/releases/tag/v1.6.0

from rsock.

david9991 avatar david9991 commented on May 27, 2024

这回好使了。

from rsock.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.