od-contrib / commander

Dual pane file manager
MIT License
16 stars 15 forks source link

Build repeatability #13

Closed Michel-FK closed 1 year ago

Michel-FK commented 3 years ago

I have an issue with a custom build for the (not yet supported) FunKey S platform (https://github.com/FunKey-Project/commander): the first build does not take into account my settings in the CMake/funkey-s_defs.cmake file.

In particular, the FILE_SYSTEM variable is ignored and get its default value of "/dev/mmcblk1p1". But if I run the build a second time, it gets the right "/dev/mmcblk0p4" value :

mstempin@Mikeul:~/FunKey/commander$ rm -r build-funkey-s/
mstempin@Mikeul:~/FunKey/commander$ TOOLCHAIN=/opt/FunKey-sdk-2.1.0 ./build.sh funkey-s
+ make_buildroot
+ [[ -z '' ]]
+ return
+ build
+ mkdir -p build-funkey-s
+ cd build-funkey-s
+ cmake .. -DCMAKE_BUILD_TYPE=Release -DTARGET_PLATFORM=funkey-s -DCMAKE_TOOLCHAIN_FILE=/opt/FunKey-sdk-2.1.0/usr/share/buildroot/toolchainfile.cmake -DRES_DIR=
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Check for working C compiler: /opt/FunKey-sdk-2.1.0/usr/bin/arm-funkey-linux-musleabihf-gcc
-- Check for working C compiler: /opt/FunKey-sdk-2.1.0/usr/bin/arm-funkey-linux-musleabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/FunKey-sdk-2.1.0/usr/bin/arm-funkey-linux-musleabihf-g++
-- Check for working CXX compiler: /opt/FunKey-sdk-2.1.0/usr/bin/arm-funkey-linux-musleabihf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found SDL: /opt/FunKey-sdk-2.1.0/usr/arm-funkey-linux-musleabihf/sysroot/usr/lib/libSDLmain.a;/opt/FunKey-sdk-2.1.0/usr/arm-funkey-linux-musleabihf/sysroot/usr/lib/libSDL.so (found version "1.2.15") 
-- Found SDL_image: /opt/FunKey-sdk-2.1.0/usr/arm-funkey-linux-musleabihf/sysroot/usr/lib/libSDL_image.so (found version "1.2.12") 
-- Found Freetype: /opt/FunKey-sdk-2.1.0/usr/arm-funkey-linux-musleabihf/sysroot/usr/lib/libfreetype.so (found version "2.10.4") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mstempin/FunKey/commander/build-funkey-s
++ getconf _NPROCESSORS_ONLN
+ cmake --build . -j 8
Scanning dependencies of target SDL_ttf
Scanning dependencies of target SDL_gfx
[  8%] Building C object CMakeFiles/SDL_gfx.dir/third_party/SDL_gfx-2.0.25/SDL_rotozoom.c.o
[  8%] Building C object CMakeFiles/SDL_ttf.dir/third_party/SDL_ttf/SDL_ttf.c.o
/home/mstempin/FunKey/commander/third_party/SDL_ttf/SDL_ttf.c: Dans la fonction « UTF8_to_UNICODE »:
/home/mstempin/FunKey/commander/third_party/SDL_ttf/SDL_ttf.c:979:11: attention: le débordement dans la conversion de « int » vers « Uint16 » {alias « short unsigned int »} change la valeur de « (int)*(utf8 + (sizetype)i) << 18 & 1835008 » en « 0 » [-Woverflow]
  979 |    ch  =  (Uint16)(utf8[i]&0x07) << 18;
      |           ^
[ 12%] Linking C static library libSDL_gfx.a
[ 16%] Linking C static library libSDL_ttf.a
[ 16%] Built target SDL_gfx
[ 16%] Built target SDL_ttf
Scanning dependencies of target commander
[ 29%] Building CXX object CMakeFiles/commander.dir/dialog.cpp.o
[ 29%] Building CXX object CMakeFiles/commander.dir/fileutils.cpp.o
[ 29%] Building CXX object CMakeFiles/commander.dir/commander.cpp.o
[ 33%] Building C object CMakeFiles/commander.dir/fk_menu.c.o
[ 37%] Building C object CMakeFiles/commander.dir/fk_instant_play.c.o
[ 41%] Building CXX object CMakeFiles/commander.dir/keyboard.cpp.o
[ 50%] Building CXX object CMakeFiles/commander.dir/fileLister.cpp.o
[ 50%] Building CXX object CMakeFiles/commander.dir/config.cpp.o
[ 58%] Building CXX object CMakeFiles/commander.dir/main.cpp.o
[ 58%] Building CXX object CMakeFiles/commander.dir/panel.cpp.o
[ 62%] Building CXX object CMakeFiles/commander.dir/screen.cpp.o
[ 66%] Building CXX object CMakeFiles/commander.dir/resourceManager.cpp.o
[ 70%] Building CXX object CMakeFiles/commander.dir/utf8.cpp.o
[ 75%] Building CXX object CMakeFiles/commander.dir/image_viewer.cpp.o
[ 79%] Building CXX object CMakeFiles/commander.dir/text_viewer.cpp.o
[ 83%] Building CXX object CMakeFiles/commander.dir/text_edit.cpp.o
[ 87%] Building CXX object CMakeFiles/commander.dir/sdlutils.cpp.o
[ 91%] Building CXX object CMakeFiles/commander.dir/sdl_ttf_multifont.cpp.o
[ 95%] Building CXX object CMakeFiles/commander.dir/window.cpp.o
[100%] Linking CXX executable commander
[100%] Built target commander
+ cd -
/home/mstempin/FunKey/commander
+ package_opk
+ ./package-opk.sh funkey-s
+ mksquashfs opkg/default.funkey-s.desktop opkg/readme.funkey-s.txt opkg/commander.png res/file-image.png res/file-ipk.png res/file-is-symlink.png res/file-opk.png res/file-text.png res/folder.png res/up.png res/DroidSansFallback.ttf res/Fiery_Turk.ttf res/FreeSans.ttf build-funkey-s/commander build-funkey-s/commander-funkey-s.opk -all-root -no-xattrs -noappend -no-exports
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on build-funkey-s/commander-funkey-s.opk, block size 131072.
[====================================================================================================================================================================================================|] 52/52 100%

Squashfs 4.0 filesystem, gzip compressed, data block size 131072
    compressed data, compressed metadata, compressed fragments,
    no xattrs, compressed ids
    duplicates are removed
Filesystem size 2553.55 Kbytes (2.49 Mbytes)
    49.15% of uncompressed filesystem size (5195.86 Kbytes)
Inode table size 346 bytes (0.34 Kbytes)
    53.56% of uncompressed inode table size (646 bytes)
Directory table size 225 bytes (0.22 Kbytes)
    69.44% of uncompressed directory table size (324 bytes)
Number of duplicate files found 0
Number of inodes 15
Number of files 14
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of ids (unique uids + gids) 1
Number of uids 1
    root (0)
Number of gids 1
    root (0)
mstempin@Mikeul:~/FunKey/commander$ grep mmcblk0p4 build-funkey-s/commander
mstempin@Mikeul:~/FunKey/commander$ grep mmcblk1p1 build-funkey-s/commander
Fichier binaire build-funkey-s/commander correspondant
mstempin@Mikeul:~/FunKey/commander$ TOOLCHAIN=/opt/FunKey-sdk-2.1.0 ./build.sh funkey-s
+ make_buildroot
+ [[ -z '' ]]
+ return
+ build
+ mkdir -p build-funkey-s
+ cd build-funkey-s
+ cmake .. -DCMAKE_BUILD_TYPE=Release -DTARGET_PLATFORM=funkey-s -DCMAKE_TOOLCHAIN_FILE=/opt/FunKey-sdk-2.1.0/usr/share/buildroot/toolchainfile.cmake -DRES_DIR=
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mstempin/FunKey/commander/build-funkey-s
++ getconf _NPROCESSORS_ONLN
+ cmake --build . -j 8
[ 16%] Built target SDL_gfx
[ 16%] Built target SDL_ttf
Scanning dependencies of target commander
[ 37%] Building CXX object CMakeFiles/commander.dir/fileutils.cpp.o
[ 37%] Building CXX object CMakeFiles/commander.dir/config.cpp.o
[ 37%] Building CXX object CMakeFiles/commander.dir/fileLister.cpp.o
[ 37%] Building CXX object CMakeFiles/commander.dir/commander.cpp.o
[ 37%] Building CXX object CMakeFiles/commander.dir/dialog.cpp.o
[ 41%] Building C object CMakeFiles/commander.dir/fk_instant_play.c.o
[ 50%] Building C object CMakeFiles/commander.dir/fk_menu.c.o
[ 50%] Building CXX object CMakeFiles/commander.dir/keyboard.cpp.o
[ 54%] Building CXX object CMakeFiles/commander.dir/panel.cpp.o
[ 58%] Building CXX object CMakeFiles/commander.dir/main.cpp.o
[ 62%] Building CXX object CMakeFiles/commander.dir/resourceManager.cpp.o
[ 66%] Building CXX object CMakeFiles/commander.dir/screen.cpp.o
[ 70%] Building CXX object CMakeFiles/commander.dir/sdlutils.cpp.o
[ 75%] Building CXX object CMakeFiles/commander.dir/sdl_ttf_multifont.cpp.o
[ 79%] Building CXX object CMakeFiles/commander.dir/text_edit.cpp.o
[ 83%] Building CXX object CMakeFiles/commander.dir/utf8.cpp.o
[ 87%] Building CXX object CMakeFiles/commander.dir/text_viewer.cpp.o
[ 95%] Building CXX object CMakeFiles/commander.dir/image_viewer.cpp.o
[ 95%] Building CXX object CMakeFiles/commander.dir/window.cpp.o
[100%] Linking CXX executable commander
[100%] Built target commander
+ cd -
/home/mstempin/FunKey/commander
+ package_opk
+ ./package-opk.sh funkey-s
+ mksquashfs opkg/default.funkey-s.desktop opkg/readme.funkey-s.txt opkg/commander.png res/file-image.png res/file-ipk.png res/file-is-symlink.png res/file-opk.png res/file-text.png res/folder.png res/up.png res/DroidSansFallback.ttf res/Fiery_Turk.ttf res/FreeSans.ttf build-funkey-s/commander build-funkey-s/commander-funkey-s.opk -all-root -no-xattrs -noappend -no-exports
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on build-funkey-s/commander-funkey-s.opk, block size 131072.
[====================================================================================================================================================================================================|] 52/52 100%

Squashfs 4.0 filesystem, gzip compressed, data block size 131072
    compressed data, compressed metadata, compressed fragments,
    no xattrs, compressed ids
    duplicates are removed
Filesystem size 2553.48 Kbytes (2.49 Mbytes)
    49.14% of uncompressed filesystem size (5195.86 Kbytes)
Inode table size 345 bytes (0.34 Kbytes)
    53.41% of uncompressed inode table size (646 bytes)
Directory table size 225 bytes (0.22 Kbytes)
    69.44% of uncompressed directory table size (324 bytes)
Number of duplicate files found 0
Number of inodes 15
Number of files 14
Number of fragments 1
Number of symbolic links  0
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 1
Number of ids (unique uids + gids) 1
Number of uids 1
    root (0)
Number of gids 1
    root (0)
mstempin@Mikeul:~/FunKey/commander$ grep mmcblk0p4 build-funkey-s/commander
Fichier binaire build-funkey-s/commander correspondant
mstempin@Mikeul:~/FunKey/commander$ grep mmcblk1p1 build-funkey-s/commander
glebm commented 3 years ago

How strange. I have no idea.

glebm commented 1 year ago

Before CMake 2.21 (CMP0126), a set(CACHE) would override a normal variable.

So we had set(FILE_SYSTEM ...) in the platform file but it was completely ignored until a cache variable got created (and then populated in the subsequent build with the correct value).

Fixed in https://github.com/od-contrib/commander/commit/0f476028f7c75bac919a3a69ed302f3c9c5ec1d9