Skip to content

Commit 990ccf7

Browse files
build.gradle に android.ndkVersion を追記
libsrt に patchelf の説明を追記
1 parent f4c3f76 commit 990ccf7

4 files changed

Lines changed: 138 additions & 0 deletions

File tree

dConnectDevicePlugin/dConnectDeviceUVC/libuvccamera/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 29
5+
ndkVersion "21.0.6113669"
56

67
defaultConfig {
78
minSdkVersion 21

dConnectSDK/dConnectLibStreaming/libopus/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 29
5+
ndkVersion "21.0.6113669"
56

67
defaultConfig {
78
minSdkVersion 21

dConnectSDK/dConnectLibStreaming/libsrt/README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,133 @@ unzip がインストールされていない場合には以下のコマンド
284284
$ sudo apt install unzip
285285
```
286286

287+
### patchelf のビルド
288+
289+
Android OS 5.0 以前では、ライブラリの soname とそのパスの違いを認識できません。<br>
290+
soname を変更するのに、patchelf を使用します。
291+
292+
下記のサイトからソースコードをダウンロードします。<br>
293+
[http://nixos.org/releases/patchelf/](http://nixos.org/releases/patchelf/)
294+
295+
最新版があれば、そちらをダウンロードしてください。<br>
296+
297+
```
298+
$ wget http://nixos.org/releases/patchelf/patchelf-0.10/patchelf-0.10.tar.bz2
299+
$ tar xfa patchelf-0.10.tar.bz2
300+
```
301+
302+
カレントディレクトリを移動して、configure を実行し Makefile を作成します。
303+
304+
```sh
305+
$ cd patchelf-0.10
306+
$ ./configure --prefix=/usr/local
307+
checking for a BSD-compatible install... /usr/bin/install -c
308+
checking whether build environment is sane... yes
309+
checking for a thread-safe mkdir -p... /bin/mkdir -p
310+
checking for gawk... gawk
311+
checking whether make sets $(MAKE)... yes
312+
checking whether make supports nested variables... yes
313+
checking whether make supports the include directive... yes (GNU style)
314+
checking for gcc... gcc
315+
checking whether the C compiler works... yes
316+
checking for C compiler default output file name... a.out
317+
checking for suffix of executables...
318+
checking whether we are cross compiling... no
319+
checking for suffix of object files... o
320+
checking whether we are using the GNU C compiler... yes
321+
checking whether gcc accepts -g... yes
322+
checking for gcc option to accept ISO C89... none needed
323+
checking whether gcc understands -c and -o together... yes
324+
checking dependency style of gcc... gcc3
325+
checking for g++... g++
326+
checking whether we are using the GNU C++ compiler... yes
327+
checking whether g++ accepts -g... yes
328+
checking dependency style of g++... gcc3
329+
Setting page size to 4096
330+
checking that generated files are newer than configure... done
331+
configure: creating ./config.status
332+
config.status: creating Makefile
333+
config.status: creating src/Makefile
334+
config.status: creating tests/Makefile
335+
config.status: creating patchelf.spec
336+
config.status: executing depfiles commands
337+
```
338+
339+
make を実行して、patchelf をビルドします。
340+
341+
```sh
342+
$ make
343+
Making all in src
344+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10/src'
345+
g++ -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.10\" -DPACKAGE_STRING=\"patchelf\ 0.10\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.10\" -DPAGESIZE=4096 -I. -Wall -std=c++11 -D_FILE_OFFSET_BITS=64 -g -O2 -MT patchelf.o -MD -MP -MF .deps/patchelf.Tpo -c -o patchelf.o patchelf.cc
346+
mv -f .deps/patchelf.Tpo .deps/patchelf.Po
347+
g++ -Wall -std=c++11 -D_FILE_OFFSET_BITS=64 -g -O2 -o patchelf patchelf.o
348+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/src'
349+
Making all in tests
350+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10/tests'
351+
make[1]: Nothing to be done for 'all'.
352+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/tests'
353+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10'
354+
make[1]: Nothing to be done for 'all-am'.
355+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10'
356+
```
357+
358+
ルート権限で、ビルドした patchelf をインストールします。
359+
360+
```sh
361+
$ sudo make install
362+
Making install in src
363+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10/src'
364+
make[2]: Entering directory '/home/vagrant/workspace/patchelf-0.10/src'
365+
/bin/mkdir -p '/usr/local/bin'
366+
/usr/bin/install -c patchelf '/usr/local/bin'
367+
make[2]: Nothing to be done for 'install-data-am'.
368+
make[2]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/src'
369+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/src'
370+
Making install in tests
371+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10/tests'
372+
make[2]: Entering directory '/home/vagrant/workspace/patchelf-0.10/tests'
373+
make[2]: Nothing to be done for 'install-exec-am'.
374+
make[2]: Nothing to be done for 'install-data-am'.
375+
make[2]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/tests'
376+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10/tests'
377+
make[1]: Entering directory '/home/vagrant/workspace/patchelf-0.10'
378+
make[2]: Entering directory '/home/vagrant/workspace/patchelf-0.10'
379+
make[2]: Nothing to be done for 'install-exec-am'.
380+
/bin/mkdir -p '/usr/local/share/doc/patchelf'
381+
/usr/bin/install -c -m 644 README '/usr/local/share/doc/patchelf'
382+
/bin/mkdir -p '/usr/local/share/man/man1'
383+
/usr/bin/install -c -m 644 patchelf.1 '/usr/local/share/man/man1'
384+
make[2]: Leaving directory '/home/vagrant/workspace/patchelf-0.10'
385+
make[1]: Leaving directory '/home/vagrant/workspace/patchelf-0.10'
386+
```
387+
388+
patchelf を実行して、インストールされていることを確認します。
389+
390+
```sh
391+
$ /usr/local/bin/patchelf
392+
syntax: /usr/local/bin/patchelf
393+
[--set-interpreter FILENAME]
394+
[--page-size SIZE]
395+
[--print-interpreter]
396+
[--print-soname] Prints 'DT_SONAME' entry of .dynamic section. Raises an error if DT_SONAME doesn't exist
397+
[--set-soname SONAME] Sets 'DT_SONAME' entry to SONAME.
398+
[--set-rpath RPATH]
399+
[--remove-rpath]
400+
[--shrink-rpath]
401+
[--allowed-rpath-prefixes PREFIXES] With '--shrink-rpath', reject rpath entries not starting with the allowed prefix
402+
[--print-rpath]
403+
[--force-rpath]
404+
[--add-needed LIBRARY]
405+
[--remove-needed LIBRARY]
406+
[--replace-needed LIBRARY NEW_LIBRARY]
407+
[--print-needed]
408+
[--no-default-lib]
409+
[--debug]
410+
[--version]
411+
FILENAME
412+
```
413+
287414
### SRT のビルド
288415
289416
SRT は、下記のサイトに公開されています。<br>
@@ -395,6 +522,14 @@ SRT ビルドの完了後に下記のコマンドを実行し、ライブラリ
395522
396523
```
397524
$ ./packjni
525+
/vagrant_data/srt/docs/Android/jniLibs/armeabi-v7a/libsrt.so: file format elf32-little
526+
SONAME libsrt.so
527+
/vagrant_data/srt/docs/Android/jniLibs/arm64-v8a/libsrt.so: file format elf64-little
528+
SONAME libsrt.so
529+
/vagrant_data/srt/docs/Android/jniLibs/x86/libsrt.so: file format elf32-i386
530+
SONAME libsrt.so
531+
/vagrant_data/srt/docs/Android/jniLibs/x86_64/libsrt.so: file format elf64-x86-64
532+
SONAME libsrt.so
398533
```
399534
400535
コマンドの実行に成功すると jniLibs というファイルが作成されます。

dConnectSDK/dConnectLibStreaming/libsrt/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 29
5+
ndkVersion "21.0.6113669"
56

67
defaultConfig {
78
minSdkVersion 21

0 commit comments

Comments
 (0)