Skip to content

Commit

Permalink
docs/desk/tint2-03: **24.12.3** ## arm64-hk1box-staticOK
Browse files Browse the repository at this point in the history
  • Loading branch information
huapox committed Dec 4, 2024
1 parent 8d3cdf3 commit 7813cf5
Showing 1 changed file with 181 additions and 1 deletion.
182 changes: 181 additions & 1 deletion docs/desk/tint2-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,184 @@ tint2: could not open display!
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x7fb2285000)
libxml2.so.2 => /usr/lib/libxml2.so.2 (0x7fb1b47000)
libz.so.1 => /lib/libz.so.1 (0x7fb1cb6000)
```
```

## arm64-hk1box-staticOK

- 24.12.3
- v-tint2/ldd.txt 解析移so-ex,余下/lib/libz.so.1依赖
- 尝试更名libz.so.1-ex; make needed
- viewMakefile,改`./CMakeFiles/tint2.dir/link.txt` 构建static-tint2 OK

**Dtl**

- v-tint2/ldd.txt 解析移so-ex,余下/lib/libz.so.1依赖

```bash
# buildLog:
file /tmp/tint2/build/tint2 is not statically linked: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, stripped
TARGETPATH=/usr/local/static_temp1
/usr/local/static_temp1/bin/tint2
/usr/local/static_temp1/bin/tint2conf

bash-5.1# ldd /usr/local/static_temp1/bin/tint2
/lib/ld-linux-aarch64.so.1 (0x7f8122b000)
libz.so.1 => /lib/libz.so.1 (0x7f81204000)
libc.musl-aarch64.so.1 => /lib/ld-linux-aarch64.so.1 (0x7f8122b000)
# bash-5.1# ldd /usr/local/static_temp1/bin/tint2conf
/lib/ld-musl-aarch64.so.1: /usr/local/static_temp1/bin/tint2conf: Not a valid dynamic program
# bash-5.1# /usr/local/static_temp1/bin/tint2conf
(tint2conf:49414): GModule-CRITICAL **: 05:29:44.600: g_module_symbol: assertion 'module != NULL' failed
(tint2conf:49414): GModule-CRITICAL **: 05:29:44.600: g_module_close: assertion 'module != NULL' failed
(tint2conf:49414): Gtk-WARNING **: 05:29:44.609: cannot open display:
# bash-5.1# /usr/local/static_temp1/bin/tint2
bash: /usr/local/static_temp1/bin/tint2: No such file or directory
```

- 尝试更名libz.so.1-ex; make needed

```bash
# bash-5.1# mv /lib/libz.so.1 /lib/libz.so.1-ex
# bash-5.1# cd /tmp/tint2/build/
bash-5.1# make
Error loading shared library libz.so.1: No such file or directory (needed by /usr/bin/cmake)
Error loading shared library libz.so.1: No such file or directory (needed by /usr/lib/libarchive.so.13)
Error loading shared library libz.so.1: No such file or directory (needed by /usr/lib/libcurl.so.4)
Error relocating /usr/lib/libarchive.so.13: inflateReset: symbol not found
Error relocating /usr/lib/libarchive.so.13: inflateEnd: symbol not found
Error relocating /usr/lib/libarchive.so.13: deflate: symbol not found
Error relocating /usr/lib/libarchive.so.13: deflateInit_: symbol not found
Error relocating /usr/lib/libarchive.so.13: inflateInit2_: symbol not found
Error relocating /usr/lib/libarchive.so.13: inflate: symbol not found
Error relocating /usr/lib/libarchive.so.13: crc32: symbol not found
Error relocating /usr/lib/libarchive.so.13: deflateEnd: symbol not found
Error relocating /usr/lib/libarchive.so.13: deflateReset: symbol not found
Error relocating /usr/lib/libarchive.so.13: inflateSetDictionary: symbol not found
Error relocating /usr/lib/libarchive.so.13: inflateInit_: symbol not found
Error relocating /usr/lib/libarchive.so.13: deflateInit2_: symbol not found
Error relocating /usr/lib/libcurl.so.4: inflateEnd: symbol not found
Error relocating /usr/lib/libcurl.so.4: inflateInit2_: symbol not found
Error relocating /usr/lib/libcurl.so.4: inflate: symbol not found
Error relocating /usr/lib/libcurl.so.4: zlibVersion: symbol not found
Error relocating /usr/lib/libcurl.so.4: inflateInit_: symbol not found
Error relocating /usr/bin/cmake: gzwrite: symbol not found
Error relocating /usr/bin/cmake: gzopen: symbol not found
Error relocating /usr/bin/cmake: gzclose: symbol not found
make: *** [Makefile:1448: cmake_check_build_system] Error 127
# bash-5.1# mv /lib/libz.so.1-ex /lib/libz.so.1

# zlib依赖@arm;
bash-5.1# apk info --no-network --no-progress 2>/dev/null |grep zlib
zlib
zlib-dev
zlib-static

# arm-hk1box
# bash-5.1# find /usr/lib /usr/local/lib |grep libz
/usr/lib/pkgconfig/libzstd.pc
/usr/lib/libzstd.so
/usr/lib/libzstd.so.1.5.0
/usr/lib/libzstd.so.1
# bash-5.1# find /usr/lib /usr/local/lib |grep zlib
/usr/lib/pkgconfig/zlib.pc
/usr/local/lib/imlib2/loaders/zlib.la
/usr/local/lib/imlib2/loaders/zlib.a

# /lib/libz.a
# bash-5.1# find /usr/lib /usr/local/lib /lib/ |grep libz
/usr/lib/pkgconfig/libzstd.pc
/usr/lib/libzstd.so
/usr/lib/libzstd.so.1.5.0
/usr/lib/libzstd.so.1
/lib/libz.so.1
/lib/libz.so.1.2.12
/lib/libz.so
/lib/libz.a
```

- viewMakefile,改`./CMakeFiles/tint2.dir/link.txt` 构建static-tint2 OK

```bash
# 添加: >> 一样结果;
SET(CMAKE_FIND_LIBRARY_SUFFIXES".a")
SET(BUILD_SHARED_LIBRARIES OFF)
SET(CMAKE_EXE_LINKER_FLAGS "-static")
# -static
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-static -Wall -Wpointer-arith -fno-strict-aliasing -pthread -std=${CSTD} ${ASAN_C_FLAGS} ${TRACING_C_FLAGS}" )
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-static -pthread -fno-strict-aliasing ${ASAN_L_FLAGS} ${BACKTRACE_L_FLAGS} ${TRACING_L_FLAGS}" )

# viewCode
# build/Makefile:L167 >> CMakeFiles/tint2.dir/build.make
# Build rule for target.
tint2: cmake_check_build_system
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 tint2
.PHONY : tint2

# fast build rule for target.
tint2/fast:
$(MAKE) $(MAKESILENT) -f CMakeFiles/tint2.dir/build.make CMakeFiles/tint2.dir/build
.PHONY : tint2/fast

# ./CMakeFiles/tint2.dir/build.make: L737 >> CMakeFiles/tint2.dir/link.txt
tint2: CMakeFiles/tint2.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/tmp/tint2/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_42) "Linking C executable tint2"
$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/tint2.dir/link.txt --verbose=$(VERBOSE)

# ./CMakeFiles/tint2.dir/link.txt
# -rdynamic x1
# -Bdynamic x2
/usr/bin/cc -static -rdynamic -static -pthread -fno-strict-aliasing CMakeFiles/tint2.dir/src/config.c.o CMakeFiles/tint2.dir/src/panel.c.o CMakeFiles/tint2.dir/src/util/server.c.o CMakeFiles/tint2.dir/src/main.c.o CMakeFiles/tint2.dir/src/init.c.o CMakeFiles/tint2.dir/src/util/signals.c.o CMakeFiles/tint2.dir/src/util/tracing.c.o CMakeFiles/tint2.dir/src/mouse_actions.c.o CMakeFiles/tint2.dir/src/drag_and_drop.c.o CMakeFiles/tint2.dir/src/default_icon.c.o CMakeFiles/tint2.dir/src/clock/clock.c.o CMakeFiles/tint2.dir/src/systray/systraybar.c.o CMakeFiles/tint2.dir/src/launcher/launcher.c.o CMakeFiles/tint2.dir/src/launcher/apps-common.c.o CMakeFiles/tint2.dir/src/launcher/icon-theme-common.c.o CMakeFiles/tint2.dir/src/launcher/xsettings-client.c.o CMakeFiles/tint2.dir/src/launcher/xsettings-common.c.o CMakeFiles/tint2.dir/src/taskbar/task.c.o CMakeFiles/tint2.dir/src/taskbar/taskbar.c.o CMakeFiles/tint2.dir/src/taskbar/taskbarname.c.o CMakeFiles/tint2.dir/src/tooltip/tooltip.c.o CMakeFiles/tint2.dir/src/execplugin/execplugin.c.o CMakeFiles/tint2.dir/src/button/button.c.o CMakeFiles/tint2.dir/src/freespace/freespace.c.o CMakeFiles/tint2.dir/src/separator/separator.c.o CMakeFiles/tint2.dir/src/tint2rc.c.o CMakeFiles/tint2.dir/src/util/area.c.o CMakeFiles/tint2.dir/src/util/common.c.o CMakeFiles/tint2.dir/src/util/fps_distribution.c.o CMakeFiles/tint2.dir/src/util/strnatcmp.c.o CMakeFiles/tint2.dir/src/util/timer.c.o CMakeFiles/tint2.dir/src/util/cache.c.o CMakeFiles/tint2.dir/src/util/color.c.o CMakeFiles/tint2.dir/src/util/strlcat.c.o CMakeFiles/tint2.dir/src/util/print.c.o CMakeFiles/tint2.dir/src/util/gradient.c.o CMakeFiles/tint2.dir/src/util/test.c.o CMakeFiles/tint2.dir/src/util/uevent.c.o CMakeFiles/tint2.dir/src/util/window.c.o CMakeFiles/tint2.dir/src/battery/battery.c.o CMakeFiles/tint2.dir/src/battery/linux.c.o -o tint2 -L/usr/local/lib -Wl,-rpath,/usr/local/lib: -lXcomposite -lXdamage -lXfixes -lXinerama -lXext -lXrender -lX11 -lXrandr -lXinerama -lXfixes -lXrandr -lgdk-x11-2.0 -lgtk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lX11 -lxcb -lXdmcp -lXau -lXext -lXft -lfreetype -lpng -lXrender -lexpat -lxml2 -lz -lbz2 -llzma -lbrotlidec -lbrotlicommon -lintl -lfribidi -lharfbuzz -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lgraphite2 -lffi -lgmodule-2.0 -lgobject-2.0 -lgpg-error -lgraphite2 -lpixman-1 -ljpeg -luuid -lmount -lpcre -lblkid -lXcomposite -lfontconfig -lgio-2.0 -lcairo -lXdamage -lX11-xcb -lxcb-shm -lxcb-render -lxcb-util -lmd -lcroco-0.6 -lImlib2 -lXcursor -lXi -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lcairo -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lharfbuzz -lcairo -lglib-2.0 -lintl -lgobject-2.0 -lglib-2.0 -lintl -lImlib2 -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -lstartup-notification-1 -Wl,-Bstatic -lrt -Wl,-Bdynamic -lm -lXcomposite -lXdamage -lXfixes -lXinerama -lXext -lXrender -lX11 -lXrandr -lgdk-x11-2.0 -lgtk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpangoft2-1.0 -lpango-1.0 -lfontconfig -lxcb -lXdmcp -lXau -lXft -lfreetype -lpng -lexpat -lxml2 -lz -lbz2 -llzma -lbrotlidec -lbrotlicommon -lintl -lfribidi -lharfbuzz -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lpcre -lgraphite2 -lffi -lgmodule-2.0 -lgpg-error -lpixman-1 -ljpeg -luuid -lmount -lblkid -lcairo -lX11-xcb -lxcb-shm -lxcb-render -lxcb-util -lmd -lcroco-0.6 -lImlib2 -lXcursor -lXi -lrsvg-2 -lstartup-notification-1 -Wl,-Bstatic -lrt -Wl,-Bdynamic


# make tint2; 构建static-tint2 OK
[ 97%] Building C object CMakeFiles/tint2.dir/src/battery/linux.c.o
[100%] Linking C executable tint2
[100%] Built target tint2
bash-5.1# ls -lh
total 34M
-rw-r--r-- 1 root root 84.1K Dec 3 06:21 CMakeCache.txt
drwxr-xr-x 6 root root 4.0K Dec 3 06:25 CMakeFiles
-rw-r--r-- 1 root root 47.2K Dec 3 06:21 Makefile
-rw-r--r-- 1 root root 4.9K Dec 3 06:21 cmake_install.cmake
drwxr-xr-x 3 root root 4.0K Dec 3 06:21 src
drwxr-xr-x 3 root root 4.0K Dec 3 06:21 themes
-rwxr-xr-x 1 root root 34.1M Dec 3 06:25 tint2 ##34M!
-rw-r--r-- 1 root root 36 Dec 3 06:24 version.h
bash-5.1# ldd ./tint2
/lib/ld-musl-aarch64.so.1: ./tint2: Not a valid dynamic program
bash-5.1# ./tint2
tint2: could not open display!
bash-5.1# uname -a
Linux 0f382552310e 5.15.72-flippy-77+o #182 SMP PREEMPT Wed Oct 5 20:23:56 CST 2022 aarch64 Linux
bash-5.1# history |tail -25
140 cat ../CMakeLists.txt |grep rdynamic #sed清: sed -i "s/-rdynamic//g" ../CMakeLists.txt
141 ll
142 ls
143 cmake .. --install-prefix=$TARGETPATH
144 cat CMakeFiles/tint2.dir/link.txt #cmake查看;>> 还有dynamic
145 ls\
146 ls
147 cd ..
148 mv build/ build01 #清空build
149 mkdir build
150 cd build
151* cmake .. --install-prefix=$TARGETPATH
152 cat CMakeFiles/tint2.dir/link.txt #清空build 再cmake查看;>> 还有dynamic
153 cat ../CMakeLists.txt |grep rdynamic
154 cat ../CMakeLists.txt |grep rdynamic
155 lsz CMakeFiles/tint2.dir/link.txt
156 cat CMakeFiles/tint2.dir/link.txt
157 cp CMakeFiles/tint2.dir/link.txt CMakeFiles/tint2.dir/link.txt-bk1
158 vi CMakeFiles/tint2.dir/link.txt #手清理/替换3个:-rdynamic>drop; Bdynamic> Bstatic;
159 make tint2
160 ls -lh
161 ldd ./tint2
162 ./tint2
163 uname -a
164 history |tail -25
bash-5.1#

# CMakeFiles/tint2.dir/link.txt
sed -i "s/\-rdynamic//g" CMakeFiles/tint2.dir/link.txt
sed -i "s/dynamic/static/g" CMakeFiles/tint2.dir/link.txt
```

0 comments on commit 7813cf5

Please sign in to comment.