<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      智慧 + 毅力 = 無所不能

      正確性、健壯性、可靠性、效率、易用性、可讀性、可復用性、兼容性、可移植性...

      導航

      交叉編譯rust-openssl crate

      Posted on 2020-09-13 21:19  Bill Yuan  閱讀(1721)  評論(0)    收藏  舉報

      轉自:https://www.javaroad.cn/questions/121768

      我在Debian機器上,我想為我的Raspberry Pi 2交叉編譯一個項目 . 我已經設法用一個簡單的hello世界使用rustup,但無法弄清楚如何交叉編譯rust-openssl crate .

      我用arm-linux-gnueabihf-gcc編譯了openssl并將其安裝在我的 home/opensslArm 目錄中 .

      我跑的時候

      OPENSSL_LIB_DIR=/home/johann/opensslArm/lib OPENSSL_INCLUDE_DIR=/home/johann/opensslArm/include cargo build --target=armv7-unknown-linux-gnueabihf

      我收到此錯誤:

      failed to run custom build command for `openssl-sys-extras v0.7.11`
      Process didn't exit successfully: `/home/johann/projects/test/target/debug/build/openssl-sys-extras-e1c84960cd35bc93/build-script-build` (exit code: 101)
      --- stdout
      TARGET = Some("armv7-unknown-linux-gnueabihf")
      OPT_LEVEL = Some("0")
      PROFILE = Some("debug")
      TARGET = Some("armv7-unknown-linux-gnueabihf")
      debug=true opt-level=0
      HOST = Some("x86_64-unknown-linux-gnu")
      TARGET = Some("armv7-unknown-linux-gnueabihf")
      TARGET = Some("armv7-unknown-linux-gnueabihf")
      HOST = Some("x86_64-unknown-linux-gnu")
      CC_armv7-unknown-linux-gnueabihf = None
      CC_armv7_unknown_linux_gnueabihf = None
      TARGET_CC = None
      CC = None
      HOST = Some("x86_64-unknown-linux-gnu")
      TARGET = Some("armv7-unknown-linux-gnueabihf")
      HOST = Some("x86_64-unknown-linux-gnu")
      CFLAGS_armv7-unknown-linux-gnueabihf = None
      CFLAGS_armv7_unknown_linux_gnueabihf = None
      TARGET_CFLAGS = None
      CFLAGS = None
      running: "arm-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fPIC" "-march=armv7-a" "-o" "/home/johann/projects/test/target/armv7-unknown-linux-gnueabihf/debug/build/openssl-sys-extras-e1c84960cd35bc93/out/src/openssl_shim.o" "-c" "src/openssl_shim.c"
      ExitStatus(ExitStatus(256))
      
      
      command did not execute successfully, got: exit code: 1
      
      
      
      --- stderr
      In file included from src/openssl_shim.c:1:0:
      /usr/include/openssl/hmac.h:61:34: fatal error: openssl/opensslconf.h: No such file or directory
      compilation terminated.
      thread '<main>' panicked at 'explicit panic', /home/johann/.cargo/registry/src/github.com-88ac128001ac3a9a/gcc-0.3.28/src/lib.rs:840
      note: Run with `RUST_BACKTRACE=1` for a backtrace.

       

      如果我導出有問題的變量,我會得到相同的錯誤 .

      我不知道我應該做什么,我不是交叉編譯的專家 . 有沒有人設法做到這一點?

      編輯:我使用的是rust-openssl 0.7.11 . 升級到0.7.13修復了這個問題(我現在可以看到貨物編譯rust-openssl依賴而沒有錯誤)但我現在又有另一個:

      error: linking with `arm-linux-gnueabihf-gcc` failed: exit code: 1
      ...
      
      note: /usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld: /home/johann/opensslArm/lib/libssl.a(s23_meth.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
      /home/johann/opensslArm/lib/libssl.a: error adding symbols: Bad value

      如何添加 -fPIC 標志?我應該使用特定標志重新編譯opensslArm嗎?

      回答:

      配置openssl編譯時必須傳遞 shared 選項(這將使 -fPIC 參數傳遞給編譯器) .

      這是一系列命令,我用它來測試交叉編譯打印openssl版本的Rust程序:

      cd /tmp
      
      wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz
      tar xzf openssl-1.0.1t.tar.gz
      export MACHINE=armv7
      export ARCH=arm
      export CC=arm-linux-gnueabihf-gcc
      cd openssl-1.0.1t && ./config shared && make && cd -
      
      export OPENSSL_LIB_DIR=/tmp/openssl-1.0.1t/
      export OPENSSL_INCLUDE_DIR=/tmp/openssl-1.0.1t/include
      cargo new xx --bin
      cd xx
      mkdir .cargo
      cat > .cargo/config << EOF
      [target.armv7-unknown-linux-gnueabihf]
      linker = "arm-linux-gnueabihf-gcc"
      EOF
      
      cat > src/main.rs << EOF
      extern crate openssl;
      
      fn main() {
          println!("{}", openssl::version::version())
      }
      EOF
      
      cargo add openssl # requires cargo install cargo-add
      cargo build --target armv7-unknown-linux-gnueabihf

      Testing the compiled program on the host computer

      Setting OPENSSL_STATIC 使 rust-openssl 靜態鏈接 . 如果使用 rust-openssl 的靜態鏈接版本,為armhf( crossbuild-essential-armhf on Debian)和 qemu-static 安裝libc,則可以使用以下命令運行已編譯的程序:

      qemu-arm-static target/armv7-unknown-linux-gnueabihf/debug/xx

       

      主站蜘蛛池模板: 区一区二区三区中文字幕| 五月婷婷久久中文字幕| 日日爽日日操| 国产精品一区中文字幕| 丁香婷婷在线观看| 高清无码爆乳潮喷在线观看| 起碰免费公开97在线视频| 精品卡通动漫亚洲AV第一页| 色偷偷亚洲男人的天堂| 久久精品亚洲精品国产区| 亚洲中文字幕精品第三区| 日本中文一区二区三区亚洲| 少妇又爽又刺激视频| 亚洲中文一区二区av| 日本成熟少妇激情视频免费看| 精品国模一区二区三区| 日韩精品成人区中文字幕| 人妻中文字幕一区二区三| 久久国产成人午夜av影院| 亚洲av成人午夜福利| 乱色老熟妇一区二区三区| 18禁在线一区二区三区| 亚洲高清WWW色好看美女| 精品人妻中文字幕有码在线| 国产精品成人中文字幕| 99国产精品99久久久久久| 国产午夜成人久久无码一区二区| 99热精品久久只有精品| 9久久伊人精品综合| 中国女人高潮hd| 国产亚洲精品第一综合| 亚洲熟女乱色综合一区| 色猫咪av在线网址| 欧美大胆老熟妇乱子伦视频| 中文字幕无码人妻aaa片| 国产精品天干天干综合网| 天堂a无码a无线孕交| 老熟妇乱子交视频一区| 少妇高潮喷水正在播放| 国产成人综合色视频精品| 日韩欧美亚洲综合久久|