1
1
しくじりエンジニア!私みたいになるな!
Qiita Engineer Festa20242024年7月17日まで開催中!

const.c, リンカ・ローダ実践開発テクニック 坂井弘亮(4) coding(92) error(123) docker(174)

Last updated at Posted at 2024-07-06

しくじりエンジニア「私みたいになるな!」

リンカ・ローダ実践開発テクニック の著者は、KOZOSというオープンソースの小さなOSを公開している。
仕事をしながら、趣味でもプログラミングする感じ。
技術士(情報工学)の資格を取ったり、IPAで10歳前後の若者たちとセキュリティキャンプを実施したりしている。

エンジニアのライフプランは、仕事、趣味、生活の3本で、別々の柱があるとよい。
オープンソースが趣味の一つでもいいじゃないか。

エンジニアの対象は、物理化学、生命化学を含む自然科学、人文科学と社会科学に分類できるかもしれない。
どの分類であれ、計算機の計算対称であることに変わりはない。

どんな領域の知識も、エンジニアとは関係ないとは言えない。
tまたま、日本語が不得意なだけで、エンジニアとは関係ないと判断する顧客がいると、お金はもらえない。

嘘をついてでも、お金を払ってもらう人の言うことを聞かないといけないのがエンジニアかもしれない。
あるいは、特定の対象はエンジニアではないという嘘もつかないといけないかもしれない。
社会事象は、逆も真である。ある事象が真であるのは、ある立場において成り立つ。逆の立場であれば、偽になる。

逆も真:社会人が最初に確かめるとよいこと。OSEK(69)、Ethernet(59)
https://qiita.com/kaizen_nagoya/items/39afe4a728a31b903ddc

お金を払っている人が、自分の立場を押し付けるのは、お金をもらうつもりであれば仕方がない。
お金を払わずに、自分の立場を押し付けたら、どれだけの法律に違反しているか考えたことがあるだろうか。

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

お金を支払っていないこと、お金をもらっていないことで、無駄な時間を費やさない方がいい。

<この項は書きかけです。順次追記します。>
This article is not completed. I will add some words in order.

リンカ ローダ

リンカで考えると、同じ関数でも逆の処理をするライブラリをリンクすれば逆の結果が出る。
逆も真とは、社会での話でないことがすぐにわかるかもしれない。
何をリンクするかで真逆になることがあることを知っているかいないか。

知らない人の言うことを間に受けるのは自由だ。
お金をもらっていないのなら自由でいい。
お金をもらっている人が版dなするのであれば、不十分だろう。

ローダで考えると、どのプログラムをロードするかで逆も真になる。
上記、逆の結果を出すライブラリをリンクしたものをロードすれば逆になる。

リンク時も、ロード時も、誰が、何をしたいかで逆になる。
エンジニアと関係ないという判断は、エンジニアと関係があるという判断と表裏一体であることは自明かもしれない。

docker error

下記のdocker errorは、M2macOSでの現象。
エラーだけ書いている。解決したら解決策は追記する。

20240706 23:45追記
error の最後に追記ディスクフルが店員らしい。
しくじりエンジニア「私みたいになるな!」
お後がよろしいようで。

リンカ・ローダ実践開発テクニック

リンカ・ローダ実践開発テクニック―実行ファイルを作成するために必須の技術-COMPUTER-TECHNOLOGY-坂井-弘亮
https://www.amazon.co.jp//dp/4789838072/
https://bookmeter.com/books/630946

参考文献にあるLinkers & Loadersは斜め読みしただけで、自分ではこういう道具は作らないだろうと勝手に思っていた。本書では簡易リンカの作成と、道具の作り方まで有るのがすごい。「setjmp()とlongjmp()」というコラムが1頁に入りきらず4頁になっているのに、節にしていないところも興味深い。
https://shop.cqpub.co.jp/hanbai/books/38/38071.html

checksym.c リンカ・ローダ実践開発テクニック(0) 坂井弘亮 coding(88)
https://qiita.com/kaizen_nagoya/items/51709d5989204ef2a371

ardump.c リンカ・ローダ実践開発テクニック 坂井弘亮(1) coding(89)
https://qiita.com/kaizen_nagoya/items/2a7bf3050ee6ac662272

binary.c リンカ・ローダ実践開発テクニック 坂井弘亮(2) coding(90)
https://qiita.com/kaizen_nagoya/items/23b985cefc5338677812

combine.c リンカ・ローダ実践開発テクニック 坂井弘亮(3) coding(91)
https://qiita.com/kaizen_nagoya/items/59161e3274270cfd2009

const.c, リンカ・ローダ実践開発テクニック 坂井弘亮(4) coding(92) error(123) docker(174)
https://qiita.com/kaizen_nagoya/items/6f74dbf637a91685d0d1

constructor.c リンカ・ローダ実践開発テクニック 坂井弘亮(5) coding(93)
https://qiita.com/kaizen_nagoya/items/37e14a0943907b6f836f

第4章 実験――リンカで遊んでみよう
 4.1 配列とポインタの違い
 4.2 const変数に書き込む
 4.3 グローバル変数をstaticにする
 4.4 シンボルの名前を変更する
 4.5 変数の隠ぺいを階層化する
 4.6 静的変数を再初期化する
 4.7 自動初期化を行う
 4.8 終了時に関数を呼び出す

N3220 Information technology — Programming languages — C N3220 working draft
https://www.open-std.org/JTC1/SC22/WG14/www/docs/n3220.pdf
N3219 Information technology — Programming languages — C ISO/IEC 9899:2023 DIS Draft
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3219.pdf

const

LinerLoaderTech
https://www.cqpub.co.jp/interface/download/2005/02/linker/LinkerLoaderTech.zip

const.c
#include <stdio.h>

extern int a;

int main()
{
  a = 2;
  printf("%d\n", a);
  exit (0);
}
const_sub.c
const int a = 1;
const_b.c
#include <stdio.h>

extern int b;

int main()
{
  printf("%d\n", b);
  exit (0);
}

ビルドはDocker上でやろうとした。

docker

docker
docker run -it gcc /bin/bash

update, upgrade

gcc
# apt update; apt -y upgrade
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Err:1 http://deb.debian.org/debian bookworm InRelease
  At least one invalid signature was encountered.
Err:2 http://deb.debian.org/debian bookworm-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://deb.debian.org/debian bookworm InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

error

At least one invalid signature was encountered.

Repository is not signed in docker build
https://stackoverflow.com/questions/59139453/repository-is-not-signed-in-docker-build

How can I get past a “Repository is not signed…” message when attempting to upgrade Kali Linux from a mounted disk image?
https://superuser.com/questions/1331936/how-can-i-get-past-a-repository-is-not-signed-message-when-attempting-to-upgr

ubuntu
# apt update --allow-unauthenticated
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Err:1 http://deb.debian.org/debian bookworm InRelease
  At least one invalid signature was encountered.
Err:2 http://deb.debian.org/debian bookworm-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://deb.debian.org/debian bookworm InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

ubuntu

gccだとdebianからだめかと思い、ubuntuにしてみた。

docker
docker run -it ubuntu /bin/bash
ubuntu
# apt update; apt -y upgrade
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]   
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]             
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
  At least one invalid signature was encountered.
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
  At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  At least one invalid signature was encountered.
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu jammy-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@c11c07d6955e:/# apt update --allow-unauthenticated
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
  At least one invalid signature was encountered.
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
  At least one invalid signature was encountered.
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  At least one invalid signature was encountered.
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu jammy-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-backports InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

docker build の apt-get update で The repository ... is not signed エラー
https://qiita.com/yukia3e/items/6e2536dd90d34a8b01cc

bash
# df -k
Filesystem     1K-blocks     Used Available Use% Mounted on
overlay         61199172 60068004         0 100% /
tmpfs              65536        0     65536   0% /dev
shm                65536        0     65536   0% /dev/shm
/dev/vda1       61199172 60068004         0 100% /etc/hosts
tmpfs            4071016        0   4071016   0% /sys/firmware
# eixt

dockerから抜けて確認。devが100%

bash
$ df -k
Filesystem     1024-blocks      Used Available Capacity iused      ifree %iused  Mounted on
/dev/disk3s1s1   482797652  13151080 194743312     7%  403755 1947433120    0%   /
devfs                  341       341         0   100%    1182          0  100%   /dev
/dev/disk3s6     482797652   3145764 194743312     2%       3 1947433120    0%   /System/Volumes/VM
/dev/disk3s2     482797652  11934256 194743312     6%    1550 1947433120    0%   /System/Volumes/Preboot
/dev/disk3s4     482797652    727448 194743312     1%     299 1947433120    0%   /System/Volumes/Update
/dev/disk1s2        512000      6164    493664     2%       1    4936640    0%   /System/Volumes/xarts
/dev/disk1s1        512000      6336    493664     2%      31    4936640    0%   /System/Volumes/iSCPreboot
/dev/disk1s3        512000       976    493664     1%      61    4936640    0%   /System/Volumes/Hardware
/dev/disk3s5     482797652 257110180 194743312    57% 2356224 1947433120    0%   /System/Volumes/Data
map auto_home            0         0         0   100%       0          0     -   /System/Volumes/Data/home
/dev/disk2s1       5242836   1696624   3523436    33%      62   35234360    0%   /System/Volumes/Update/SFR/mnt1
/dev/disk3s1     482797652  13151080 194743312     7%  404167 1947433120    0%   /System/Volumes/Update/mnt1

URL

502: Bad Gateway
リクエストの処理に時間がかかっています。しばらくしてから再度お試しください。
このページが繰り返し表示される場合は
support@qiita.comまでご連絡ください。
なお、Twitterにて最新の情報を配信しております。

ログインせずにアクセスすると表示する。理由は不明。

関連資料

プログラマが知っていると良い「公序良俗」
https://qiita.com/kaizen_nagoya/items/9fe7c0dfac2fbd77a945

逆も真:社会人が最初に確かめるとよいこと。OSEK(69)、Ethernet(59)
https://qiita.com/kaizen_nagoya/items/39afe4a728a31b903ddc

「何を」よりも「誰を」。10年後のために今見習いたい人たち
https://qiita.com/kaizen_nagoya/items/8045978b16eb49d572b2

' @kazuo_reve 私が効果を確認した「小川メソッド」
https://qiita.com/kazuo_reve/items/a3ea1d9171deeccc04da

' @kazuo_reve 新人の方によく展開している有益な情報
https://qiita.com/kazuo_reve/items/d1a3f0ee48e24bba38f1

自己記事一覧

Qiitaの記事に3段階または5段階で到達するための方法
https://qiita.com/kaizen_nagoya/items/6e9298296852325adc5e

物理記事 上位100
https://qiita.com/kaizen_nagoya/items/66e90fe31fbe3facc6ff

量子(0) 計算機, 量子力学
https://qiita.com/kaizen_nagoya/items/1cd954cb0eed92879fd4

数学関連記事100
https://qiita.com/kaizen_nagoya/items/d8dadb49a6397e854c6d

統計(0)一覧
https://qiita.com/kaizen_nagoya/items/80d3b221807e53e88aba

品質一覧
https://qiita.com/kaizen_nagoya/items/2b99b8e9db6d94b2e971

言語・文学記事 100
https://qiita.com/kaizen_nagoya/items/42d58d5ef7fb53c407d6

医工連携関連記事一覧
https://qiita.com/kaizen_nagoya/items/6ab51c12ba51bc260a82

自動車 記事 100
https://qiita.com/kaizen_nagoya/items/f7f0b9ab36569ad409c5

通信記事100
https://qiita.com/kaizen_nagoya/items/1d67de5e1cd207b05ef7

日本語(0)一欄
https://qiita.com/kaizen_nagoya/items/7498dcfa3a9ba7fd1e68

英語(0) 一覧
https://qiita.com/kaizen_nagoya/items/680e3f5cbf9430486c7d

転職(0)一覧
https://qiita.com/kaizen_nagoya/items/f77520d378d33451d6fe

仮説(0)一覧(目標100現在40)
https://qiita.com/kaizen_nagoya/items/f000506fe1837b3590df

音楽 一覧(0)
https://qiita.com/kaizen_nagoya/items/b6e5f42bbfe3bbe40f5d

@kazuo_reve 新人の方によく展開している有益な情報」確認一覧
https://qiita.com/kaizen_nagoya/items/b9380888d1e5a042646b

Qiita(0)Qiita関連記事一覧(自分)
https://qiita.com/kaizen_nagoya/items/58db5fbf036b28e9dfa6

鉄道(0)鉄道のシステム考察はてっちゃんがてつだってくれる
https://qiita.com/kaizen_nagoya/items/26bda595f341a27901a0

安全(0)安全工学シンポジウムに向けて: 21
https://qiita.com/kaizen_nagoya/items/c5d78f3def8195cb2409

一覧の一覧( The directory of directories of mine.) Qiita(100)
https://qiita.com/kaizen_nagoya/items/7eb0e006543886138f39

Ethernet 記事一覧 Ethernet(0)
https://qiita.com/kaizen_nagoya/items/88d35e99f74aefc98794

Wireshark 一覧 wireshark(0)、Ethernet(48)
https://qiita.com/kaizen_nagoya/items/fbed841f61875c4731d0

線網(Wi-Fi)空中線(antenna)(0) 記事一覧(118/300目標)
https://qiita.com/kaizen_nagoya/items/5e5464ac2b24bd4cd001

OSEK OS設計の基礎 OSEK(100)
https://qiita.com/kaizen_nagoya/items/7528a22a14242d2d58a3

Error一覧 error(0)
https://qiita.com/kaizen_nagoya/items/48b6cbc8d68eae2c42b8

++ Support(0) 
https://qiita.com/kaizen_nagoya/items/8720d26f762369a80514

Coding(0) Rules, C, Secure, MISRA and so on
https://qiita.com/kaizen_nagoya/items/400725644a8a0e90fbb0

プログラマによる、プログラマのための、統計(0)と確率のプログラミングとその後
https://qiita.com/kaizen_nagoya/items/6e9897eb641268766909

なぜdockerで機械学習するか 書籍・ソース一覧作成中 (目標100)
https://qiita.com/kaizen_nagoya/items/ddd12477544bf5ba85e2

言語処理100本ノックをdockerで。python覚えるのに最適。:10+12
https://qiita.com/kaizen_nagoya/items/7e7eb7c543e0c18438c4

プログラムちょい替え(0)一覧:4件
https://qiita.com/kaizen_nagoya/items/296d87ef4bfd516bc394

Python(0)記事をまとめたい。
https://qiita.com/kaizen_nagoya/items/088c57d70ab6904ebb53

官公庁・学校・公的団体(NPOを含む)システムの課題、官(0)
https://qiita.com/kaizen_nagoya/items/04ee6eaf7ec13d3af4c3

「はじめての」シリーズ  ベクタージャパン 
https://qiita.com/kaizen_nagoya/items/2e41634f6e21a3cf74eb

AUTOSAR(0)Qiita記事一覧, OSEK(75)
https://qiita.com/kaizen_nagoya/items/89c07961b59a8754c869

LaTeX(0) 一覧 
https://qiita.com/kaizen_nagoya/items/e3f7dafacab58c499792

自動制御、制御工学一覧(0)
https://qiita.com/kaizen_nagoya/items/7767a4e19a6ae1479e6b

Rust(0) 一覧 
https://qiita.com/kaizen_nagoya/items/5e8bb080ba6ca0281927

100以上いいねをいただいた記事16選
https://qiita.com/kaizen_nagoya/items/f8d958d9084ffbd15d2a

小川清最終講義、最終講義(再)計画, Ethernet(100) 英語(100) 安全(100)
https://qiita.com/kaizen_nagoya/items/e2df642e3951e35e6a53

<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
This article is an individual impression based on my individual experience. It has nothing to do with the organization or business to which I currently belong.

文書履歴(document history)

ver. 0.01 初稿  20240706

最後までおよみいただきありがとうございました。

いいね 💚、フォローをお願いします。

Thank you very much for reading to the last sentence.

Please press the like icon 💚 and follow me for your happy life.

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1