ホーム » Raspberry Pi

Raspberry Pi」カテゴリーアーカイブ

2024年4月
 123456
78910111213
14151617181920
21222324252627
282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,395 アクセス



Raspberry Pi Desktop 解像度設定

以前インストールした Raspberry Pi Desktop を使いたくなった.
起動してみると画面サイズが小さい.
Raspberry Pi Desktop 「Main Menu Editor」
Raspberry Pi では「Raspberry Pi の設定」に「Display」タブがあってそこで変更できる.
が,Desktop 版にはそれがない.
いろいろ弄っていると「Main Menu Editor」の「設定」に「モニタの設定」があった.
Raspberry Pi Desktop 「Main Menu Editor」 「モニタの設定」にチェック
「モニタの設定」メニューが増える.
Raspberry Pi Desktop 「モニタの設定」メニューが増える
それを選択すると,解像度を変更できる.
Raspberry Pi Desktop 解像度の変更

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

NAS 上で OpenMP ?

今まで Windows 上で動かしていた OpenMP 対応のコードを,NAS 上で…
QNAP NAS 上にソースをコピーしてコンパイルすると

[Iwao@TS253D T_cmb_f]$ g++ T_cmb_f.cpp -Wall -fopenmp
In file included from T_cmb_f.cpp:12:0:
/share/Public/CloudD/GoogleD/Develop/_.SRC/Test/t_g3d_et.hpp:12:10: fatal error: omp.h: No such file or directory
 #include <omp.h>
          ^~~~~~~
compilation terminated.
[Iwao@TS253D T_cmb_f]$ 

もう少し単純なコードで…

#ifdef		_OPENMP
#include	<omp.h>
#endif

#include	<clocale>
#include	<iostream>
#include	"i_define.hxx"

bool	Test	(void)
{
	#ifdef	_OPENMP
		#pragma	omp	parallel for
	#endif
	for (long index=0 ; index<20 ; index++)	{
		#ifdef	_OPENMP
			#pragma	omp	critical	(wait)
		#endif
		std::cout << index << std::endl ;
		}
	return	true ;
	}

int	_tmain	(int argc,TCHAR* argv[])
{
	_tsetlocale(LC_ALL,_T("")) ;
	{
		::Test() ;
		}
	return	0 ;
	}
[Iwao@TS253D T_cmb_f]$ cd ../T_omp/
[Iwao@TS253D T_omp]$ g++ T_omp.cpp -Wall -fopenmp
T_omp.cpp:10:10: fatal error: omp.h: No such file or directory
 #include <omp.h>
          ^~~~~~~
compilation terminated.
[Iwao@TS253D T_omp]$

NAS OpenMP コンパイルで "fatal error: omp.h: No such file or directory"


Raspberry Pi で同様に行うと問題ない.
Raspberry Pi 上で OpenMP コンパイル


これとは直接関係ないが,
普通にコンパイルした T_cmb_f を QNAP NAS で実行すると,CPU などの温度が正しく表示されない状態に陥った.



2021/05/24
Ubuntu Linux Station ではうまく動作する.
Linux Station OpenMP
Linux Center でも動作する.
Linux Center OpenMP

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Python tkinter インストール

sudo apt install python3-tk
Debian 環境に tkinter インストール
Ubuntu 環境に tkinter インストール


Windows から Raspberry Pi 環境に接続できる様に samba を追加しようと…
検索して次の所を参考に設定.
https://qiita.com/fstyle/items/1670d260f58f77a43144
https://www.raspberrypirulo.net/entry/samba
この中で書かれている nano というエディタ.
CUI で使えるみたいで NAS などの幾つかの環境にインストール.
sudo opkg install nano


他に CUI のファイルマネージャ.
sudo opkg install mc
操作性など異なるが,エコロジーⅡを思い出す.
https://unilab.gbb60166.jp/T98Next/T98Next2.htm

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

PHP から iconv コマンド呼び出し

シフトJIS のデータファイルをアップロードして WebGL で表示のテスト.
PHP から作成した .out を呼び出しているが,その中で文字コードの変換がうまく機能していない.
.out の中では iconv ライブラリを呼び出す.うまく機能しない時は iconv または uconv コマンド.
.out をコンソールから実行した時はうまく機能している.


いろいろと動作を調べていると,次の様なコマンドが PHP から呼出された時うまく機能していない様子.
iconv -f CP932 shiftjis.txt > out_file.txt
コンソールでは OK .
ここまで絞り込むのに 1 日かかった


今回の修正前 Synology NAS では次の様にしていた.
uconv -f sjis -t utf8 shiftjis.txt -o out_file.txt


先日テストしていた時 ASUSTOR NAS ではエラーになったので,単純に -t オプションを取ってしまった.

Iwao@AS5202T:/volume1/Web/Test/mics/tc_xconv $ iconv -f CP932 -t utf8 shiftjis.txt
iconv: conversion to utf8 unsupported
iconv: try 'iconv -l' to get the list of supported encodings
Iwao@AS5202T:/volume1/Web/Test/mics/tc_xconv $

iconv -l を幾つかの環境で調べていると “utf8” の指定がうまくない.
いろいろな環境でうまく機能しそうなのは “UTF-8” .
Fedora iconv -l | grep -i utf
Raspberry Pi iconv -l | grep -i utf
DS116 uconv -l | grep -i utf
AS5202T iconv -l | grep -i utf


-t オプションを指定しないとうまくないみたいで,次の様に変更.
iconv -f CP932 -t UTF-8 shiftjis.txt > out_file.txt
これで意図した動作になった.


2020/09/08 変換できない文字が存在した時に止まらない様な指定を追加.
https://mish.myds.me/wordpress/dev/2020/09/07/upload-mbcs-name/
exec_ic.hxx
text_gnc.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

NAS g++ で a.out が作成されない?

warning はあるが,エラーの表示はない状態まで修正して g++ .

Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ g++ t_calc.cpp -Wall
In file included from /volume1/public/C_Sync/GoogleD/Develop/_.SRC/_gcc/V2_FuncA.hxx:1:0,
                 from Calc_16.cpp:46,
                 from t_calc.cpp:29:
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx: In constructor 'vd2_arc::vd2_arc()':
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx:28:9: warning: 'vd2_arc::tc' will be initialized after [-Wreorder]
  double tc ;
         ^~
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx:27:9: warning:   'double vd2_arc::ts' [-Wreorder]
  double ts ;
         ^~
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx:23:2: warning:   when initialized here [-Wreorder]
  vd2_arc () : lr(0) , tc(0) , ts(0) {}
  ^~~~~~~
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx: In function 'Vd2 get_point_pie(const Vd2&, const Vd2&, double, double)':
/volume1/public/C_Sync/GoogleD/Develop/_.SRC/__CPR_/v2_funca.hxx:263:6: warning: variable 'lm' set but not used [-Wunused-but-set-variable]
  Vd2 lm = (le-ls) / 2 ;
      ^~
In file included from t_calc.cpp:29:0:
Calc_16.cpp: In member function 'virtual int VarCnv::SetError(LPCTSTR, ...)':
Calc_16.cpp:1319:7: warning: variable 'cnt' set but not used [-Wunused-but-set-variable]
  int  cnt ;
       ^~~
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ ls
Calc_16.BAK  Calc_16.cpp  Calc_16.hpp  t_calc.BAK  t_calc.cpp  t_calc.dsp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ g++ t_calc.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ ls
Calc_16.BAK  Calc_16.cpp  Calc_16.hpp  t_calc.BAK  t_calc.cpp  t_calc.dsp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ ll
total 248
drwxrwxrwx+  2 Iwao users   4096 Feb  6 11:46 .
drwxrwxrwx+ 16 Iwao users   4096 Feb  6 10:18 ..
-rwxrwxrwx+  1 Iwao users 103036 Feb  6 11:45 Calc_16.BAK
-rwxrwxrwx+  1 Iwao users 103032 Feb  6 11:46 Calc_16.cpp
-rwxrwxrwx+  1 Iwao users  11608 Feb  5 18:53 Calc_16.hpp
-rwxrwxrwx+  1 Iwao users   2756 Feb  6 11:18 t_calc.BAK
-rwxrwxrwx+  1 Iwao users   2420 Feb  6 11:43 t_calc.cpp
-rwxrwxrwx+  1 Iwao users   4420 Feb  5 16:39 t_calc.dsp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ 

なのに a.out が作成されない.
Raspberry Pi で同様に動かすと

pi@raspberrypi:~/projects/t_calc $ g++ t_calc.cpp
In file included from t_calc.cpp:29:
Calc_16.cpp: In function ‘int ExpDel_Bracket1(TCHAR*, size_t, int, int, char)’:
Calc_16.cpp:2152:6: error: ‘_tcspbrk’ was not declared in this scope
  if (_tcspbrk(val,bracket)==NULL){ return FALSE ; } // ���ʂ����݂��Ȃ����͉������Ȃ�
      ^~~~~~~~
Calc_16.cpp:2152:6: note: suggested alternative: ‘wcspbrk’
  if (_tcspbrk(val,bracket)==NULL){ return FALSE ; } // ���ʂ����݂��Ȃ����͉������Ȃ�
      ^~~~~~~~
      wcspbrk
Calc_16.cpp:2161:21: error: ‘_tcsrchr’ was not declared in this scope
  LPTSTR equStartB = _tcsrchr(tmpLeft,startB) ; // �ŏ��� ')' �ɑΉ����� '(' �̈ʒu�����߂�
                     ^~~~~~~~
Calc_16.cpp:2161:21: note: suggested alternative: ‘_tcschr’
  LPTSTR equStartB = _tcsrchr(tmpLeft,startB) ; // �ŏ��� ')' �ɑΉ����� '(' �̈ʒu�����߂�
                     ^~~~~~~~
                     _tcschr
pi@raspberrypi:~/projects/t_calc $ 

どうも ShiftJIS のコメントが邪魔してかエラーが表示されてないだけみたい.
Raspberry Pi でコンパイルするとエラーが表示される
未定義となっているので正しく宣言して対応.


次は warning .

.../v2_funca.hxx:28:9: warning: 'vd2_arc::tc' will be initialized after [-Wreorder]      double tc ;
.../v2_funca.hxx:27:9: warning:   'double vd2_arc::ts' [-Wreorder]                       double ts ;
.../v2_funca.hxx:23:2: warning:   when initialized here [-Wreorder]                      vd2_arc () : lr(0) , tc(0) , ts(0) {}

これは,クラス内の変数の宣言と初期化の順番が異なる場合のものらしい.
もう一つの [-Wunused-but-set-variable] は戻り値を使用していないもの.

warning: variable 'lm' set but not used [-Wunused-but-set-variable]

変数を削除して対応.


前後するが 先日のツール で ShiftJIS のソースを UTF-8 に.

Iwao@DS116:~/gcc_test/Test/t_linux/t_calc$ cd test_sj/
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ ls
Calc_16.cpp  Calc_16.hpp  t_calc.BAK  t_calc.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ g++ t_calc.cpp -Wall
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ ll
total 132
drwxrwxrwx+ 2 Iwao users   4096 Feb  6 16:39 .
drwxrwxrwx+ 3 Iwao users   4096 Feb  6 16:38 ..
-rwxrwxrwx+ 1 Iwao users 103036 Feb  6 14:41 Calc_16.cpp
-rwxrwxrwx+ 1 Iwao users  11608 Feb  5 18:53 Calc_16.hpp
-rwxrwxrwx+ 1 Iwao users   1821 Feb  6 16:04 t_calc.BAK
-rwxrwxrwx+ 1 Iwao users   1841 Feb  6 16:39 t_calc.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ g++ t_calc.cpp -Wall -finput-charset=SJIS
cc1plus: error: conversion from SJIS to UTF-8 not supported by iconv
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ g++ t_calc.cpp -Wall
In file included from t_calc.cpp:27:0:
Calc_16.cpp: In function 'int ExpDel_Bracket1(TCHAR*, size_t, int, int, char)':
Calc_16.cpp:2152:26: error: '_tcspbrk' was not declared in this scope
  if (_tcspbrk(val,bracket)==NULL){ return FALSE ; } // 括弧が存在しない時は何もしない
                          ^
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$ ll
total 136
drwxrwxrwx+ 3 Iwao users   4096 Feb  6 16:46 .
drwxrwxrwx+ 3 Iwao users   4096 Feb  6 16:38 ..
-rwxrwxrwx+ 1 Iwao users 108716 Feb  6 14:41 Calc_16.cpp
-rwxrwxrwx+ 1 Iwao users  12170 Feb  5 18:53 Calc_16.hpp
drwxrwxrwx+ 2 Iwao users   4096 Feb  6 16:45 org
-rwxrwxrwx+ 1 Iwao users   1841 Feb  6 16:39 t_calc.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/t_calc/test_sj$

エラーが表示される.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux でのメモリの空き容量の取得

C++ のコードで Linux 環境でのメモリの使用状況 を知りたくなった.
コマンドでは free などがあるが,それと同等のものを取得する関数.

Iwao@DS116:~/gcc_test/Test/t_linux/T_mem/t_mem$ free -h
              total        used        free      shared  buff/cache   available
Mem:           1.0G        695M         29M         49M        281M        162M
Swap:          2.0G        1.0G        1.0G
Iwao@DS116:~/gcc_test/Test/t_linux/T_mem/t_mem$ cat /proc/meminfo
MemTotal:        1030632 kB
MemFree:           16720 kB
Buffers:            9392 kB
Cached:           203592 kB
SwapCached:       227532 kB
Active:           393336 kB
Inactive:         489268 kB
Active(anon):     322836 kB
Inactive(anon):   397436 kB
Active(file):      70500 kB
Inactive(file):    91832 kB
Unevictable:        1408 kB
Mlocked:            1408 kB
SwapTotal:       2097148 kB
SwapFree:        1060108 kB
Dirty:               200 kB
Writeback:             0 kB
AnonPages:        538800 kB
Mapped:            71992 kB
Shmem:             50524 kB
Slab:              89312 kB
SReclaimable:      17608 kB
SUnreclaim:        71704 kB
KernelStack:        4368 kB
PageTables:        14768 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2612464 kB
Committed_AS:    4943664 kB
VmallocTotal:    1039360 kB
VmallocUsed:        6916 kB
VmallocChunk:     961204 kB
Iwao@DS116:~/gcc_test/Test/t_linux/T_mem/t_mem$ ./a.out
16474112
1055367168
Iwao@DS116:~/gcc_test/Test/t_linux/T_mem/t_mem$ cat main.cpp

#include        <iostream>
#include        <sys/sysinfo.h>

int     main    ()
{
        {
                struct  sysinfo meminfo ;
                ::sysinfo(&meminfo);
                std::cout << meminfo.freeram  << std::endl;
                std::cout << meminfo.totalram << std::endl;
                }
        return 0;
        }

Iwao@DS116:~/gcc_test/Test/t_linux/T_mem/t_mem$

Synology NAS DS116 ::sysinfo
最初 getrusage を見つけたが,マニュアルにある様にこの目的では使えない.値は 0 で返ってくる.
次に見つけたのが sysinfo
Fedora や Raspberry Pi ,Synology NAS で動作することを確認.

-		meminfo	{...}			sysinfo
		uptime		17198		__kernel_long_t
-		loads				__kernel_ulong_t [3]
		[0]		35520		__kernel_ulong_t
		[1]		30240		__kernel_ulong_t
		[2]		26880		__kernel_ulong_t
		totalram	2078154752	__kernel_ulong_t
		freeram 	107687936	__kernel_ulong_t
		sharedram	19849216	__kernel_ulong_t
		bufferram	145534976	__kernel_ulong_t
		totalswap	2227171328	__kernel_ulong_t
		freeswap	2206625792	__kernel_ulong_t
		procs   	468		__u16
		pad     	0		__u16
		totalhigh	0		__kernel_ulong_t
		freehigh	0		__kernel_ulong_t
		mem_unit	1		__u32
		_f				char [0]

memstat.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

漢字を含むソースのテスト

’90 年代前半の頃は JIS と シフトJIS のソースを扱っていた.
そのプロジェクトの最初の頃は,ターゲット環境のみでソースを管理していた.
0x1c 0x2d 漢字 0x1c 0x2e の形式.wiki 漢字シフトコード
途中からソース管理は PC-9801DA などに移行してシフトJIS になった.
ターゲット環境に移す時,ソースのコピーとシフトJIS から JIS への変換を行っていた.


Linux 環境を意識し始めてから新規に書いた共通のコードは 7 ビットの範囲にしている.
Windows AP であれば rc ファイルの STRINGTABLE が使用できるが,これにあたるものをどうするか?
まず一番簡単な方法の漢字を含むソースでの動作をテストしてみた.
この中の ccc(const char* s) の部分はまだ暫定的なコードで,登録されたテーブルから対応する JPN を求めるもの.

#include	<clocale>
#include	<iostream>
#include	"i_define.hxx"
#include	"_tdefine.hxx"
#include	"ccc_mlg.hxx"

bool	test	(void)
{
	ccc_mlg*	cm = ::get_ccc_mlg() ;
	{
		ccc_mlg_1	cm_1 ;	cm_1.Name = _T("Name_1") ;	cm_1.JPN = _T("名称 1") ;
		ccc_mlg_1	cm_2 ;	cm_2.Name = _T("Name_2") ;	cm_2.JPN = _T("名称 2") ;
		ccc_mlg_1	cm_3 ;	cm_3.Name = _T("Name_3") ;	cm_3.JPN = _T("名称 3") ;
		ccc_mlg_1	cm_4 ;	cm_4.Name = _T("Name_4") ;	cm_4.JPN = _T("名称 4") ;
		ccc_mlg_1	cm_5 ;	cm_5.Name = _T("Name_5") ;	cm_5.JPN = _T("名称 5") ;
		cm->push_back(cm_1) ;
		cm->push_back(cm_2) ;
		cm->push_back(cm_3) ;
		cm->push_back(cm_4) ;
		cm->push_back(cm_5) ;
		}
	std::tout << ccc("Name_3") << std::endl ;
	return	true ;
	}

int _tmain(int argc, TCHAR* argv[])
{
	_tsetlocale(LC_ALL,_T("")) ;
	test() ;
	return 0 ;
	}

gcc 漢字 shiftjis」で検索すると -finput-charset で文字コードを指定できるとある.

pi@raspberrypi:~/projects/cc_ml_1 $ g++ cc_ml_1.cpp 
pi@raspberrypi:~/projects/cc_ml_1 $ ./a.out 
���� 3
pi@raspberrypi:~/projects/cc_ml_1 $ g++ -finput-charset=SJIS-WIN cc_ml_1.cpp 
pi@raspberrypi:~/projects/cc_ml_1 $ ./a.out 
名称 3
pi@raspberrypi:~/projects/cc_ml_1 $ 

g++ -finput-charset=SJIS-WIN
-finput-charset=SJIS ではよくわからないエラーになる.
g++ -finput-charset=SJIS
cp932 でも良さそう.


Synology NAS DS116 は g++ の-finput-charset の指定では変換できないみたい.

Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ g++ cc_ml_1.cpp -Wall
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ ll
total 72
drwxrwxrwx+  3 Iwao users  4096 Jan 16 22:01 .
drwxrwxrwx+ 10 Iwao users  4096 Jan 16 21:36 ..
-rwxrwxrwx   1 Iwao users 50452 Jan 16 22:01 a.out
drwxrwxrwx+  2 Iwao users  4096 Jan 16 21:53 bak
-rwxrwxrwx+  1 Iwao users  2001 Jan 16 22:00 cc_ml_1.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ ./a.out
 3
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ uconv -f sjis cc_ml_1.cpp > dd.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ g++ dd.cpp
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ ./a.out
名称 3
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ g++ -finput-charset=SJIS cc_ml_1.cpp
cc1plus: error: conversion from SJIS to UTF-8 not supported by iconv
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ g++ -finput-charset=sjis cc_ml_1.cpp
cc1plus: error: conversion from sjis to UTF-8 not supported by iconv
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$ iconv
-sh: iconv: command not found
Iwao@DS116:~/gcc_test/Test/t_linux/cc_ml_1$
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux での cp コマンド

ssh 接続 した linux 環境で,ファイルをコピーしようとして cp コマンドを使用.
その時,更新日時が変更されることに気付いた.

[Iwao@fedora ~]$ cp --help
使用法: cp [OPTION]... [-T] SOURCE DEST
または: cp [OPTION]... SOURCE... DIRECTORY
または: cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.
  -a, --archive                -dR --preserve=all と同様
      --attributes-only        ファイルのデータをコピーせず、ファイルの属性のみコピーする
      --backup[=CONTROL]       コピー先ファイルが存在する時にバックアップを作成する
  -b                           --backup と同様だが引数を受け付けない
      --copy-contents          再帰時に特殊ファイルの内容をコピーする
  -d                           --no-dereference --preserve=links と同様
  -f, --force                  if an existing destination file cannot be
                                 opened, remove it and try again (this option
                                 is ignored when the -n option is also used)
  -i, --interactive            prompt before overwrite (overrides a previous -n option)
  -H                           follow command-line symbolic links in SOURCE
  -l, --link                   コピーの代わりにファイルのハードリンクを作成する
  -L, --dereference            SOURCE にあるシンボリックリンクを常にたどる
  -n, --no-clobber             存在するファイルを上書きしない (前に指定した
                                 -i オプションを上書きする)
  -P, --no-dereference         SOURCE にあるシンボリックリンクを決してたどらない
  -p                           --preserve=mode,ownership,timestamps と同様
      --preserve[=ATTR_LIST]   指定した属性を保護する (デフォルト: mode,ownership,timestamps)。
                                 追加可能な属性: context, links, xattr, all
  -c                           deprecated, same as --preserve=context
      --no-preserve=ATTR_LIST  指定した属性を保護しない
      --parents                DIRECTORY 配下で SOURCE ファイルのフルパス名を使用する
  -R, -r, --recursive          再帰的にディレクトリをコピーする
      --reflink[=WHEN]         clone/CoW コピーを制御する。下記を参照
      --remove-destination     コピー先にファイルが存在する場合、開く前に削除する (--force と対照的)
      --sparse=WHEN            スパースファイル作成を制御する。下記を参照
      --strip-trailing-slashes  各 SOURCE 引数から末尾のスラッシュを全て削除する
  -s, --symbolic-link          コピーの代わりにシンボリックリンクを作成する
  -S, --suffix=SUFFIX          通常のバックアップ接尾辞を上書きする
  -t, --target-directory=DIRECTORY  全ての SOURCE 引数を DIRECTORY にコピーする
  -T, --no-target-directory    DEST を通常ファイルとして扱う
  -u, --update                 SOURCE ファイルがコピー先ファイルより新しいか存在しない時だけコピーする
  -v, --verbose                実行していることを説明する
  -x, --one-file-system        このファイルシステムだけで実行する
  -Z                           set SELinux security context of destination file to default type
      --context[=CTX]          like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX
      --help     この使い方を表示して終了する
      --version  バージョン情報を表示して終了する

Fedora での cp コマンドの --help
-p オプションで意図した動作となる.
また GUI 版の「ファイルマネージャ」などでは更新日時などは引き継がれる.
mv コマンドは更新日時は引き継がれる.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux 文字コード変換のコード

iconv を使用した方法

std::string	SJIS_to_UTF8	(const std::string& sj_str)
{
	tstring	u8_str ;
	iconv_t	icd = ::iconv_open("UTF8","Shift_JIS") ;
	if (icd == (iconv_t)-1) {
		u8_str = ::iconv_SJIS_UTF8(sj_str) ;
		}
	else {
		{
			size_t	sj_size = sj_str.length() ;
			size_t	u8_size = sj_str.length()*3 + 1024 ;
			u8_str.resize(u8_size) ;
			char*	sj_ptr = (char*)(&sj_str[0]) ;
			char*	u8_ptr = (char*)(&u8_str[0]) ;
			::iconv(icd,&sj_ptr,&sj_size,&u8_ptr,&u8_size) ;
			}
		::iconv_close(icd) ;
		}
	return	u8_str.c_str() ;
	}

iconv,uconv の部分

#define	cmd_iconv		_T("iconv")		//	linux
#define	cmd_uconv		_T("uconv")		//	DS116
 
bool	exec_x_conv	(const tstring& s_j_name,const tstring& u_8_name)
{
	tstring	sj_name = ::QuotM_Add_Auto(s_j_name) ;
	tstring	u8_name = ::QuotM_Add_Auto(u_8_name) ;
	tstring	param = _T(" -f sjis -t utf8 ") + sj_name + _T(" -o ") + u8_name ;
	if (::which( cmd_iconv)) {
		tstring	 exe_iconv = cmd_iconv	_T(" ") + param ;
		_tsystem(exe_iconv.c_str()) ;
		return	true ;
		}
	if (::which( cmd_uconv)) {
		tstring	 exe_uconv = cmd_uconv	_T(" ") + param ;
		_tsystem(exe_uconv.c_str()) ;
		return	true ;
		}
	return	false ;
	}
 
std::string	iconv_SJIS_UTF8(const std::string& sj_str)
{
	tstring	tmp_path = ::Get_i_Tools_tmp_date() ;
	tstring	now_str  = ::Now_Format(_T("%M%S")) ;
	tstring	s_j_name = ::Path_AddLastSP(tmp_path) + _T("sj_") + now_str + _T(".txt") ;
	tstring	u_8_name = ::Path_AddLastSP(tmp_path) + _T("u8_") + now_str + _T(".txt") ;
		s_j_name = ::CreateUniqueEmpty(s_j_name.c_str()) ;
		u_8_name = ::CreateUniqueEmpty(u_8_name.c_str()) ;
	std::string	u8_str ;
	{
		v_char	v_c_u8 ;
		v_char	v_c_sj = ::To_v_char(sj_str.c_str()) ;
				 ::v_c_SaveText(s_j_name.c_str(),v_c_sj) ;
		{
				 ::exec_x_conv(s_j_name,u_8_name) ;
			}
		v_c_u8 = ::v_c_Load (u_8_name.c_str()) ;
		u8_str = ::To_tstring( v_c_u8   ).c_str() ;
		}
	return	u8_str.c_str() ;
	}

Fedora  iconv コマンドでの変換


うまく置き換わっていない文字があった.
‘~'(0x7e) が ‘‾'(0x203e) になってしまっていた.
他にも ‘\'(0x5c) が ‘¥'(0xa5) .
http://ossforum.jp/jossfiles/Linux_SJIS_Support.pdf
幾つか違う文字があるようで,iconv の -f sjis を SJIS-WIN でうまくいった.

	tstring	i_param = _T(" -f SJIS-WIN -t utf8 ") + sj_name + _T(" -o ") + u8_name ;
	tstring	u_param = _T(" -f sjis     -t utf8 ") + sj_name + _T(" -o ") + u8_name ;

2020/04/30 ASUSTOR NAS に対応
text_gnc.hxx exec_ic.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Linux で文字コードの変換

Windows での文字コードの変換部分は MultiByteToWideChar,WideCharToMultiByte でうまく機能している.

 exe \ 入力 シフトJIS UTF-16 UTF-8
_UNICODE → WideChar そのまま → WideChar(CP_UTF8)
_MBCS そのまま → MultiByte → WideChar(CP_UTF8) → MultiByte

MultiByteToWideCharWideCharToMultiByte の使い方は C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\crt\src\ などの mbstowcs.c,wcstombs.c を参照.


MSDN で見つけた記事
C++ – STL の文字列クラスと Win32 API による Unicode エンコーディングの変換


Linux 環境での動作は 2014/03 に一度調べていたみたいで ” gcc iconv ” とコメントになっている.
それで https://ja.wikipedia.org/wiki/Iconv にあるコードを Raspberry Pi 環境で実行するとうまく変換できる.
コンパイルエラーになったので string.h のインクルードが必要かも?
同じコードを Synology NAS の DS116 でコンパイルして実行するとうまく動作しない
(そのままのコードでは止まってしまう).
iconv_open で (iconv_t)-1 が返されていて errno は EINVAL になってしまう.


iconv コマンドを試すと Raspberry Pi では OK .
Synology NAS は iconv が存在しない.
検索すると uconv が使えると書かれている.
https://forum.synology.com/enu/viewtopic.php?t=82591


Iwao@DS116:~$ uconv -L
ASCII-Latin Accents-Any Amharic-Latin/BGN Any-Accents Any-Publishing Arabic-Latin Arabic-Latin/BGN Armenian-Latin Armenian-Latin/BGN Azerbaijani-Latin/BGN Belarusian-Latin/BGN Bengali-Devanagari Bengali-Gujarati Bengali-Gurmukhi Bengali-Kannada Bengali-Latin Bengali-Malayalam Bengali-Oriya Bengali-Tamil Bengali-Telugu Bopomofo-Latin Bulgarian-Latin/BGN Cyrillic-Latin Devanagari-Bengali Devanagari-Gujarati Devanagari-Gurmukhi Devanagari-Kannada Devanagari-Latin Devanagari-Malayalam Devanagari-Oriya Devanagari-Tamil Devanagari-Telugu Digit-Tone Fullwidth-Halfwidth Georgian-Latin Georgian-Latin/BGN Greek-Latin Greek-Latin/BGN Greek-Latin/UNGEGN Gujarati-Bengali Gujarati-Devanagari Gujarati-Gurmukhi Gujarati-Kannada Gujarati-Latin Gujarati-Malayalam Gujarati-Oriya Gujarati-Tamil Gujarati-Telugu Gurmukhi-Bengali Gurmukhi-Devanagari Gurmukhi-Gujarati Gurmukhi-Kannada Gurmukhi-Latin Gurmukhi-Malayalam Gurmukhi-Oriya Gurmukhi-Tamil Gurmukhi-Telugu Halfwidth-Fullwidth Han-Latin Han-Latin/Names Hangul-Latin Hans-Hant Hant-Hans Hebrew-Latin Hebrew-Latin/BGN Hiragana-Katakana Hiragana-Latin IPA-XSampa Jamo-Latin Kannada-Bengali Kannada-Devanagari Kannada-Gujarati Kannada-Gurmukhi Kannada-Latin Kannada-Malayalam Kannada-Oriya Kannada-Tamil Kannada-Telugu Katakana-Hiragana Katakana-Latin Katakana-Latin/BGN Kazakh-Latin/BGN Kirghiz-Latin/BGN Korean-Latin/BGN Latin-ASCII Latin-Arabic Latin-Armenian Latin-Bengali Latin-Bopomofo Latin-Cyrillic Latin-Devanagari Latin-Georgian Latin-Greek Latin-Greek/UNGEGN Latin-Gujarati Latin-Gurmukhi Latin-Hangul Latin-Hebrew Latin-Hiragana Latin-Jamo Latin-Kannada Latin-Katakana Latin-Malayalam Latin-NumericPinyin Latin-Oriya Latin-Syriac Latin-Tamil Latin-Telugu Latin-Thaana Latin-Thai Macedonian-Latin/BGN Malayalam-Bengali Malayalam-Devanagari Malayalam-Gujarati Malayalam-Gurmukhi Malayalam-Kannada Malayalam-Latin Malayalam-Oriya Malayalam-Tamil Malayalam-Telugu Maldivian-Latin/BGN Mongolian-Latin/BGN NumericPinyin-Latin NumericPinyin-Pinyin Oriya-Bengali Oriya-Devanagari Oriya-Gujarati Oriya-Gurmukhi Oriya-Kannada Oriya-Latin Oriya-Malayalam Oriya-Tamil Oriya-Telugu Pashto-Latin/BGN Persian-Latin/BGN Pinyin-NumericPinyin Publishing-Any Russian-Latin/BGN Serbian-Latin/BGN Simplified-Traditional Syriac-Latin Tamil-Bengali Tamil-Devanagari Tamil-Gujarati Tamil-Gurmukhi Tamil-Kannada Tamil-Latin Tamil-Malayalam Tamil-Oriya Tamil-Telugu Telugu-Bengali Telugu-Devanagari Telugu-Gujarati Telugu-Gurmukhi Telugu-Kannada Telugu-Latin Telugu-Malayalam Telugu-Oriya Telugu-Tamil Thaana-Latin Thai-Latin Tone-Digit Traditional-Simplified Turkmen-Latin/BGN Ukrainian-Latin/BGN Uzbek-Latin/BGN XSampa-IPA am-am_FONIPA az-Lower az-Title az-Upper ch-ch_FONIPA cs-cs_FONIPA cs-ja cs-ko cs_FONIPA-ja cs_FONIPA-ko dsb-dsb_FONIPA el-Lower el-Title el-Upper eo-eo_FONIPA es-am es-es_FONIPA es-ja es-zh es_419-ja es_419-zh es_FONIPA-am es_FONIPA-es_419_FONIPA es_FONIPA-ja es_FONIPA-zh ia-ia_FONIPA it-am it-ja ja_Latn-ko ja_Latn-ru ky-ky_FONIPA la-la_FONIPA lt-Lower lt-Title lt-Upper nl-Title pl-ja pl-pl_FONIPA pl_FONIPA-ja ro-ja ro-ro_FONIPA ro_FONIPA-ja ru-ja ru-zh sk-ja sk-sk_FONIPA sk_FONIPA-ja tlh-tlh_FONIPA tr-Lower tr-Title tr-Upper uz_Cyrl-uz_Latn uz_Latn-uz_Cyrl yo-yo_BJ zh_Latn_PINYIN-ru Any-Null Any-Lower Any-Upper Any-Title Any-Name Name-Any Any-Remove Any-Hex/Unicode Any-Hex/Java Any-Hex/C Any-Hex/XML Any-Hex/XML10 Any-Hex/Perl Any-Hex Hex-Any/Unicode Hex-Any/Java Hex-Any/C Hex-Any/XML Hex-Any/XML10 Hex-Any/Perl Hex-Any Any-NFC Any-NFKC Any-NFD Any-NFKD Any-FCD Any-FCC Any-ch_FONIPA Any-Latin Any-Telugu Any-Gurmukhi Any-Gujarati Any-Malayalam Any-Oriya Any-Devanagari Any-Kannada Any-Tamil Any-cs_FONIPA Any-ru Any-Bengali Any-uz_Latn Any-Katakana Any-ro_FONIPA Any-ky_FONIPA Any-zh Any-yo_BJ Any-am Any-es_419_FONIPA Any-eo_FONIPA Any-es_FONIPA Any-sk_FONIPA Any-Hant Any-Hans Any-Hiragana Any-la_FONIPA Any-Syriac Any-Greek Any-Greek/UNGEGN Any-Cyrillic Any-Hangul Any-Bopomofo Any-Arabic Any-Thai Any-Armenian Any-Thaana Any-Georgian Any-Hebrew Any-am_FONIPA Any-dsb_FONIPA Any-ia_FONIPA Any-uz_Cyrl Any-pl_FONIPA
Iwao@DS116:~$
DS116 で uconv -L


iconv_open で失敗した場合,iconv コマンドまたは uconv コマンドとするか?


Linux 文字コード変換のコード


2022/07/15
SynoCli File Tools v2.6-16 で iconv が追加された.
SynoCli File Tools などのインストール方法は次の所に書いています.
https://dev.mish.work/wordpress/2022/06/15/ds116-entware/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi に ImageMagick

以前調べた時に入っていた ImageMagick
先日追加した SD の Pi 環境には入っていないのでインストール.
検索すると sudo apt install ImageMagick とある.が,入力すると,
pi@raspberrypi:~ $ sudo apt install ImageMagick
パッケージリストを読み込んでいます… 完了
依存関係ツリーを作成しています
状態情報を読み取っています… 完了
E: パッケージ ImageMagick が見つかりません
正しくは,
sudo apt install imagemagick
Raspberry Pi に ImageMagick のインストール
パッケージ名は小文字で指定する. imagemagick

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Fedora 環境で bmp が読めない

先日 GLUT でテクスチャ表示 の動作を確認していた時のこと.
Raspberry Pi ではうまく表示できることまで確認.
Raspberry Pi で GLUT テスクチャ表示
Fedora ではうまく読めない.
コードでテクスチャを生成しての表示ではうまくいく.
Fedora コードでテクスチャを作成しての表示
32 ビット色 BMP のコードは Synology NAS Web サーバなどでもそれなりに動作している.
Synology NAS で i_DIB を使用
32 bit exe ではうまく読み書きできているみたい.


Raspberry Pi (ARM) と Fedora (x64) で BITMAPFILEHEADER などを見ると 64 bit 環境でうまくない.
Raspberry Pi の BITMAPFILEHEADER BITMAPINFOHEADER
Fedora の BITMAPFILEHEADER BITMAPINFOHEADER
例えば bmih.biSize が x64 では 0x50 になっている(ARM では 0x28).


def_bmp.hxx が間違っているみたい.
どうも long の定義が Windows と Linux などでは異なるため.wiki 整数型


DWORD と LONG の定義を u_32 と i_32 に変更(u_32 ,i_32 は i_define.hxx で定義している).

//typedef unsigned long       DWORD;
typedef   u_32                DWORD;
//typedef long                LONG;
typedef   i_32                LONG;

Fedora での GLUT テクスチャ表示

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi で NAS が …

以前は表示されていたと思うが…
Raspberry Pi のファイルマネージャ Pcmanfm で「移動」-「ネットワーク」で NAS などが表示されていない.
Raspberry Pi のファイルマネージャで「移動」-「ネットワーク」
しばらく対応方法がわからなかった.
「ファイルマネージャ」の「アドレス欄」に smb://ds116/ の様に入力することで接続できることを確認.
Raspberry Pi ファイルマネージャのアドレス欄に smb://ds116/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

GLUT でテクスチャ表示

今度はテクスチャ.次の様なコードで面に貼り付け.

#include	"glut_cg.hxx"
#include	"gonsprmt.hxx"
#include	"i_dib_f.hxx"

i_DIB	tex_01 ;

int	main(int argc, char* argv[])
{
	{
		tstring	test_bmp = _T("./Tex01.bmp") ;
		//     	test_bmp = _T("/run/user/1000/gvfs/smb-share:server=ds116.local,share=web/i_Tools/Doc/blog/3D_Data/Tex01.bmp") ;
		#ifdef  _MSC_VER
		      	test_bmp = _T("//DS116/web/i_Tools/Doc/blog/3D_Data/Tex01.bmp") ;
		#endif
		tex_01 = ::DIB_Load(test_bmp.c_str()) ;
		}
	{
		GonsA	gnsa ;
		{
			Gons1	box = ::Gons_Box(Vd3(5,0,5)) ;
			box.SetColor(0xffffff) ;
			gnsa.push_back(box) ;
			}
		::set_GonsA(gnsa) ;
		::set_Extent(::GonsA_GetExtent(gnsa)) ;
		{
			C_glut*	gm = ::get_c_glut() ;
			gm->BG     = Vd4(0.9) ;
			gm->EP     = Vd3(0,-10,0) ;
			}
		}
	::glutInitWindowPosition(200,100) ;
	::glutInitWindowSize	(600,600) ;
	::glutInitDisplayMode	(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH) ;
	::glutInit           	(&argc,argv) ;
	::glutCreateWindow  	(argv[0]) ;
	::glutReshapeFunc   	(cv_resize) ;
	::glutDisplayFunc   	(cg_display) ;
	::glutKeyboardFunc  	(cv_keyboard) ;
	::glutMouseFunc   	(cv_mouse) ;
	::glutMotionFunc  	(cv_motion) ;
	::cv_init       	() ;
	{
		::glPixelStorei(GL_UNPACK_ALIGNMENT,1) ;
		::glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,tex_01.GetWidth(),tex_01.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,tex_01.GetP_Bits()) ;
		::glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST) ;
		::glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST) ;
		::glEnable(GL_TEXTURE_2D) ;
		}
	::glutMainLoop   	() ;
	return	0 ;
	}

::glTexImage2D の指定と Tex01.bmp の形式が合っていないため
GLUT でテクスチャ表示 間違った GL_RGB の指定でずれている
32 ビット色の画像なので ::glTexImage2D の GL_RGB を GL_RGBA に.
GLUT でのテスクチャ表示 R と B  が合っていない
色の順番が違うので ::glTexImage2D を見ると GL_BGRA_EXT があったのでこれを指定.
GLUT でテクスチャ表示 GL_BGRA_EXT を指定

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VC Linux の include 設定

VC Linux プロジェクトの include 設定
次のようなコードをビルドするのに include の設定がわからなかった.

#include	<cstdio>
#include	"gettickc.hxx"

int main()
{
	printf("VC 2019 hello !\n");
	for (long index = 0; index < 100; index++) {
		::Sleep_ms(100);
		printf("hello \t");
		fflush(stdout);
		if (index%5 == 4)	{
			printf("\n");
			}
		}
	printf("VC 2019 hello !\n");
	return 0;
	}

VC Linux プロジェクトの 「インクルードディレクトリ」設定


MFC のプロジェクトなどであれば,次の所で指定している.
C:\Users\Iwao\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props
共通のインクルードディレクトリは,次の様なもの.
\\DevS\Documents\Develop\_.SRC\__CPR_;\\DevS\Documents\Develop\_.SRC\__Iwao;…


ソース内で次の様に指定してもエラーに.
#include “\\DevS\Documents\Develop\_.SRC\__CPR_\i_define.hxx”

1>main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Application Type\Linux\1.0\Linux.targets(412,5): error : g++ がコード 1 で終了しました。詳細については、出力ウィンドウでビルド出力をご確認ください (注: 出力ウィンドウで詳細を確認するには、ツール オプションでビルド出力の詳細度を変更する必要があります)。
1>プロジェクト "ConsoleApplication2.vcxproj" のビルドが終了しました -- 失敗。

他に #include “//devs/documents/develop/_.src/__cpr_/i_define.hxx” としてみたが変わらず.


Raspberry Pi でビルドするともう少しわかりやすいエラーの表示になった.

1>main.cpp
1>D:\Document\VS\VS\2019\T_Linux\ConsoleApplication2\main.cpp(18,10): error : \\DevS\Documents\Develop\_.SRC\__CPR_\i_define.hxx: そのようなファイルやディレクトリはありません
1>D:\Document\VS\VS\2019\T_Linux\ConsoleApplication2\main.cpp(18,10): error :  #include "\\DevS\Documents\Develop\_.SRC\__CPR_\i_define.hxx"
1>D:\Document\VS\VS\2019\T_Linux\ConsoleApplication2\main.cpp(18,10): error :           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>D:\Document\VS\VS\2019\T_Linux\ConsoleApplication2\main.cpp(18,10): error : compilation terminated.
1>プロジェクト "ConsoleApplication2.vcxproj" のビルドが終了しました -- 失敗。

いろいろやって,次の様に指定することでうまくいった.
#include “/mnt/_.src/__cpr_/i_define.hxx”
プロジェクトの設定で次のものを指定することでビルドできることを確認.
/mnt/_.src/__CPR_;/mnt/_.src/__Iwao;/mnt/_.src/__Mlt_;/mnt/_.src/_gcc;/mnt/_.src/Test


/mnt/_.src はマウントしている.
Linux から Windows 環境への接続
g++ インクルードパスの設定

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi Desktop の設定

Raspberry Pi Desktop を自分好みにするためのいくつかの設定.


Scratch は「日本語」になっているが Scratch 2 は英語のまま.
「File」メニューの左をクリックすると言語が選べて,下の方に「日本語」がある.
Scratch 2 言語設定


ブラウザの Chromium
「メインメニュー」の「設定」-「Add / Remove Software」.
Raspberry Pi Desktop メインメニューから Add / Remove Software
「Chromium」で検索して「ウェブブラウザ – 言語パック」にチェック.
Raspberry Pi Desktop ウェブブラウザ 言語パックにチェック
「OK」でインストール.
私の個人的なテスト用サイトの表示は,持っている Raspberry Pi よりスムーズ?
itl.mydns.jp

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi Desktop インストール

Debian Stretch with Raspberry Pi Desktop」のインストール
Raspberry Pi Desktop
次の所を参考にインストール.
Windows PCにPIXEL(Raspberry Pi OS) for PCをインストールしてみよう (2/3)
見た目が異なるだけで指定内容はほぼ同じ.
もう一つ見つけたのは,
[メモ] VirtualBoxにて、Raspberry Pi Desktop(2017-11-16-rpd-x86-stretch版)
こちらは今とほぼ同じ様な表示で,こちらの方がわかりやすいかもしれない.


他の Linux 環境と同じようにするためのいくつかの設定.
/mnt/_.src を作成.
$ sudo mkdir /mnt/_.src
mountCPATH を設定する set_z_inc.sh をコピー.
Raspberry Pi Desktop 共通ソースのフォルダをマウント


GLUT のインストール
$ sudo apt install freeglut3 freeglut3-dev
$ g++ test.cpp -lGL -lGLU -lglut
Raspberry Pi Desktop GLUT インストール


PyOpenGL のインストール.
$ pip install PyOpenGL
$ pip install PyOpenGL_accelerate
Raspberry Pi Desktop   PyOpenGL のインストール

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Raspberry Pi にインストール

Raspberry Pi 用に micro SD を購入.

パッケージから micro SD を取り出すのがちょっと大変(金属部分に触ってしまいそう).
micro SD の動作確認のために「KoKaRasPi1181118.img」をコピーして OS が起動することを確認.


今度は Raspbian からのインストール.
ダウンロードできるページにアクセスすると幾つかあり.
https://www.raspberrypi.org/downloads/ NOOBS と Raspbian
今回は Raspbian Buster with desktop and recommended software を選択.
「2019-07-10-raspbian-buster-full.img」を microSD にコピー
あとは Raspberry Pi に挿して起動.
Raspbian Buster with desktop を起動
幾つかの設定を「Japanese」に.
再起動して Wi-Fi などの設定後,ソフトウェアのアップデートに.これは 1 時間程度かかった.
Update Software の画面
また再起動して何とか使える状態に.


ssh で接続しようとすると,何かの設定をしなければならない様なメッセージ.

C:\Users\Iwao\AppData\Local\Temp>ssh -l pi 192.168.1.34
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:+XCHdOHLyB0hFfxDrAR2xEvYhuiylCLzFYhmznJyzYg.
Please contact your system administrator.
Add correct host key in C:\\Users\\Iwao/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\Iwao/.ssh/known_hosts:1
ECDSA host key for 192.168.1.34 has changed and you have requested strict checking.
Host key verification failed.

C:\Users\Iwao\AppData\Local\Temp>

検索すると,
SSH接続で WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
エディタで …/.ssh/known_hosts の 1 行目の 192.168.1.34 を 192.168.1.35 に.
もう一度,ssh -l pi 192.168.1.34 とすることで接続できた.
また,known_hosts には 192.168.1.34 が追加されている.
192.168.1.35 にしたものを 192.168.1.34 に戻すことで,前の SD でも動作可能なことを確認.
known_hosts を編集


2019/09/21
microSD が増えてきたので,ケースを購入.
レビューにある様に,収まりが良くない.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

PyOpenGL インストール – 2

今度は Ubuntu 環境へのインストール.
先ず Python 2.7 .

iwao@VB-Ubuntu:~$ sudo apt install python
[sudo] iwao のパスワード: 
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  libpython-stdlib libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib
  python-minimal python2 python2-minimal python2.7 python2.7-minimal
提案パッケージ:
  python-doc python-tk python2-doc python2.7-doc binfmt-support
以下のパッケージが新たにインストールされます:
  libpython-stdlib libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib
  python python-minimal python2 python2-minimal python2.7 python2.7-minimal
アップグレード: 0 個、新規インストール: 10 個、削除: 0 個、保留: 9 個。
3,883 kB のアーカイブを取得する必要があります。
この操作後に追加で 16.7 MB のディスク容量が消費されます。
続行しますか? [Y/n] 

Ubuntu に Python 2.7 をインストール
続いて pip .

iwao@VB-Ubuntu:~$ pip

Command 'pip' not found, but can be installed with:

sudo apt install python-pip

iwao@VB-Ubuntu:~$ sudo apt install python-pip
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  javascript-common libexpat1 libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython-all-dev
  libpython-dev libpython2-dev libpython2.7 libpython2.7-dev python-all python-all-dev python-asn1crypto
  python-cffi-backend python-configparser python-crypto python-cryptography python-dbus python-dev python-entrypoints
  python-enum34 python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-pip-whl
  python-pkg-resources python-secretstorage python-setuptools python-six python-wheel python-xdg python2-dev
  python2.7-dev
提案パッケージ:
  apache2 | lighttpd | httpd python-crypto-doc python-cryptography-doc python-cryptography-vectors python-dbus-dbg
  python-dbus-doc python-enum34-doc python-gi-cairo libkf5wallet-bin gir1.2-gnomekeyring-1.0 python-gdata
  python-keyczar python-secretstorage-doc python-setuptools-doc
以下のパッケージが新たにインストールされます:
  javascript-common libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython-all-dev libpython-dev
  libpython2-dev libpython2.7 libpython2.7-dev python-all python-all-dev python-asn1crypto python-cffi-backend
  python-configparser python-crypto python-cryptography python-dbus python-dev python-entrypoints python-enum34
  python-gi python-idna python-ipaddress python-keyring python-keyrings.alt python-pip python-pip-whl
  python-pkg-resources python-secretstorage python-setuptools python-six python-wheel python-xdg python2-dev
  python2.7-dev
以下のパッケージはアップグレードされます:
  libexpat1
アップグレード: 1 個、新規インストール: 36 個、削除: 0 個、保留: 8 個。
37.0 MB 中 36.9 MB のアーカイブを取得する必要があります。
この操作後に追加で 72.7 MB のディスク容量が消費されます。
続行しますか? [Y/n] 

Ubuntu に pip をインストール


PyOpenGL .
$ pip install PyOpenGL
$ pip install PyOpenGL_accelerate
PyOpenGL のインストール
Ubuntu はこのインストールで良いみたい.
Fedora の様に OpenGL.GL にあたるパッケージのインストールは必要なさそう.


Raspberry Pi へのインストール.
Python 2.7 は入っているので PyOpenGL のインストール.
$ pip install PyOpenGL
$ pip install PyOpenGL_accelerate
Raspberry Pi に PyOpenGL のインストール
これだけ良いみたい.


2020/07/29
PyOpenGL 3.x The Python OpenGL Binding

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Python のインストール状態

PyOpenGL を使えるようにしたいと思い Python のインストール状態を調べてみた.
PyOpenGL は Python 2.7 が奨励となっている?


Ubuntu
Python のインストール状態 Ubuntu

iwao@VB-Ubuntu:~$ python

Command 'python' not found, but can be installed with:

sudo apt install python3         # version 3.7.3-1, or
sudo apt install python          # version 2.7.16-1
sudo apt install python-minimal  # version 2.7.16-1

You also have python3 installed, you can run 'python3' instead.

iwao@VB-Ubuntu:~$ python3
Python 3.7.3 (default, Aug 20 2019, 17:04:43) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
iwao@VB-Ubuntu:~$ 

Fedora
Python のインストール状態 Fedora

[Iwao@fedora ~]$ python
bash: python: コマンドが見つかりませんでした...
コマンド python' を提供するためにパッケージ 'python-unversioned-command' をインストールしますか? [N/y] n


[Iwao@fedora ~]$ python3
Python 3.7.4 (default, Jul  9 2019, 16:32:37) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
[Iwao@fedora ~]$ 

Raspberry Pi
Python のインストール状態 Raspberry Pi

pi@raspberrypi:~ $ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
pi@raspberrypi:~ $ 

Win10 (VS 2017 , VS 2019)
Python のインストール状態 Win10

Microsoft Windows [Version 10.0.18362.356]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\Iwao>py
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z


C:\Users\Iwao>where py
C:\Windows\py.exe

C:\Users\Iwao>

Python のインストール状態 .../VS/Shared/
VS 2013 以降の「新規プロジェクト」で「Python」がある.
VS 2013 新規プロジェクト Python

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.