---
title: "media-proxy-rsをビルド・実行する"
id: "6945"
type: "post"
slug: "media-proxy-rs%e3%82%92%e3%83%93%e3%83%ab%e3%83%89%e3%83%bb%e5%ae%9f%e8%a1%8c%e3%81%99%e3%82%8b"
published_at: "2024-08-23T11:30:30+00:00"
modified_at: "2024-08-25T13:57:08+00:00"
url: "https://www.okin-jp.net/archives/6945"
markdown_url: "https://www.okin-jp.net/archives/6945.md"
excerpt: "MacのWindowsAppからxrdpにrdp接続するとusキーボードになってしまうので調査 Continue reading"
taxonomy_category:
  - "Linux"
  - "Server"
taxonomy_post_tag:
  - "cargo"
  - "Firefish"
  - "MediaProxy"
  - "Misskey"
  - "Rust"
---

## media-proxy-rsをビルド・実行する

### 概要

Rust製のMisskeyメディアプロキシ [media-proxy-rs(https://github.com/yojo-art/media-proxy-rs)](https://github.com/yojo-art/media-proxy-rs)
をビルドして実行する。

### 前提条件

- Ubuntu 22.04 LTS
- 作業ディレクトリ /opt/media-proxy-rs

### ビルド手順

Shell

# Rust https://rustup.rs/ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # 依存パッケージ apt-get install -y meson ninja-build pkg-config nasm git # 作業ディレクトリへ移動 mkdir -p /opt/media-proxy-rs cd /opt/media-proxy-rs git clone --recurse-submodules https://github.com/yojo-art/media-proxy-rs . # ビルド cargo build --release

| 12345678910 | # Rust https://rustup.rs/curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh# 依存パッケージapt-get install -y meson ninja-build pkg-config nasm git# 作業ディレクトリへ移動mkdir -p /opt/media-proxy-rscd /opt/media-proxy-rsgit clone --recurse-submodules https://github.com/yojo-art/media-proxy-rs .# ビルドcargo build --release |
| --- | --- |

### ビルドエラーへの対応

Shell

error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names '-C link-args=-Wl,-lc' --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1) --- stderr error: unknown codegen option: ` link-args`

| 123456 | error: failed to run `rustc` to learn about target-specific information Caused by: process didn't exit successfully: `/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names '-C link-args=-Wl,-lc' --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=split-debuginfo --print=crate-name --print=cfg` (exit status: 1) --- stderr error: unknown codegen option: ` link-args` |
| --- | --- |

.config/cargo.tomlのrustflags=[“-C link-args=-Wl,-lc”]をrustflags=[“-Clink-args=-Wl,-lc”]かrustflags=[“-C”, “link-args=-Wl,-lc”]に修正する

### 起動

systemd-unit

media-proxy-rs.service

[Unit] Description=Misskey Media Proxy Rust [Service] Type=simple ExecStart=/opt/media-proxy-rs/target/release/media-proxy-rs WorkingDirectory=/opt/media-proxy-rs TimeoutSec=60 StandardOutput=journal StandardError=journal SyslogIdentifier=media-proxy-rs Restart=always [Install] WantedBy=multi-user.target

| 123456789101112131415 | [Unit]Description=Misskey Media Proxy Rust [Service]Type=simpleExecStart=/opt/media-proxy-rs/target/release/media-proxy-rsWorkingDirectory=/opt/media-proxy-rsTimeoutSec=60StandardOutput=journalStandardError=journalSyslogIdentifier=media-proxy-rsRestart=always [Install]WantedBy=multi-user.target |
| --- | --- |

初回起動時、作業ディレクトリにconfig.jsonが作られるので必要に応じて編集する

![おきん(blog)](https://secure.gravatar.com/avatar/90fa8845304183a491e9f3bfa0a6a44e46e25882407e4aa652815d725d55bd8c?s=100&r=g)

[おきん(blog)](https://www.okin-jp.net/archives/author/oops-okin)

[https://mi.okin-jp.net/@okin_p](https://mi.okin-jp.net/@okin_p)
(Misskey)  
 [https://fi.okin-jp.net/@okin_p](https://fi.okin-jp.net/@okin_p)
(Firefish)  
 [https://si.okin-jp.net/@okin_p](https://si.okin-jp.net/@okin_p)
(Mastodon)

[https://fedifile.net/@okin_p/profile/](https://fedifile.net/@okin_p/profile/)
  
 [https://twpf.jp/okin_p](https://twpf.jp/okin_p)
  
 [http://profile.hatena.ne.jp/okin_p/](http://profile.hatena.ne.jp/okin_p/)

名前：おきん  
 やってること：面倒なことをPHPにやらせる、IPv6でなにかする、車で移動する  
 主なガジェット：Google Pixel 4a (5G) ,iPhone XS(ジャンク), iPad mini5, その他

種別：IPv6 Single stack 猫

パソコンやガジェットについて書いていく…予定。

[https://twitter.com/okin_p](https://twitter.com/okin_p)
[https://si.okin-jp.net/@okin_p](https://si.okin-jp.net/@okin_p)

### *関連記事*

### コメントを残す[コメントをキャンセル](/archives/6945#respond)

このサイトはスパムを低減するために Akismet を使っています。[コメントデータの処理方法の詳細はこちらをご覧ください](https://akismet.com/privacy/)
。
