veilidchat/setup_linux.sh
Rivka Segan e0a3baaefd Disrecommend Flutter snap (Corrosion builds fail)
If Flutter has not been installed before building VeilidChat on Linux,
the user can end up with CMake 3.16.3 and encounter errors for
Corrosion files that require CMake 3.22 or later. Unfortunately,
recovering from this is apparently more complex than putting a newer
cmake earlier in the PATH, so it's perhaps best not to obtain CMake
3.16.3 in the first place.

The set of conflicts that cause this issue to exist include:

veilidchat indirectly recommends the Flutter snap:

268b86d131/setup_linux.sh (L19)

f59c4509ea/veilid-flutter/setup_flutter.sh (L23)

https://docs.flutter.dev/get-started/install

https://docs.flutter.dev/get-started/install/linux

"The easiest way to install Flutter on Linux is by using snapd."

Flutter apparently requires CMake 3.16.3 and someone is not especially
interested in newer versions. Historically, CMake in the Flutter snap
has been multiple minor versions behind upstream CMake (e.g., 3.10
when a user needed 3.16, 3.16 when a user needed 3.22, etc.):

9427b77376/packages/flutter_tools/test/general.shard/linux/linux_doctor_test.dart (L120)

https://github.com/canonical/flutter-snap/issues/53

https://github.com/flutter/flutter/issues/101726#issuecomment-1095681610

"We discourage plugin developers from requiring a newer version of
CMake than Flutter requires, but we cannot control what third-party
developers do. ... If you want to use the snap installation, and want
an update with a newer version of CMake, you'd need to file a request
at https://github.com/canonical/flutter-snap"

When the Flutter snap is installed, flutter commands execute cmake
from within the snap's read-only filesystem, and do not use the cmake
found in the PATH. This may lead to challenges regardless of whether
the user already has a /usr/bin/cmake that is recent enough, or
whether the user needs to replace /usr/bin/cmake by following the
https://apt.kitware.com process.

3.16.3 is not recent enough because veilid uses Corrosion from GitHub:

f59c4509ea/veilid-flutter/linux/rust.cmake (L11)

https://corrosion-rs.github.io/corrosion/

"The master branch of Corrosion currently requires CMake 3.22 or
newer."
2023-10-01 17:43:42 +00:00

54 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $SCRIPTDIR/_script_common
if [[ "$(uname)" != "Linux" ]]; then
echo Not running Linux
exit 1
fi
if [ "$(lsb_release -d | grep -qEi 'debian|buntu|mint')" ]; then
echo Not a supported Linux
exit 1
fi
# run setup for veilid
$VEILIDDIR/dev-setup/setup_linux.sh
# run setup for veilid_flutter
echo 'If prompted to install Flutter, choose an installation bundle (storage.googleapis.com), not snap.'
$VEILIDDIR/veilid-flutter/setup_flutter.sh
# ensure protoc is installed
if command -v protoc &> /dev/null; then
echo '[X] protoc is available in the path'
else
echo 'protoc is not available in the path'
exit 1
fi
# Install protoc-gen-dart
dart pub global activate protoc_plugin
if command -v protoc-gen-dart &> /dev/null; then
echo '[X] protoc-gen-dart is available in the path'
else
echo 'protoc-gen-dart is not available in the path. Add "$HOME/.pub-cache/bin" to your path.'
exit 1
fi
# # ensure rsync is installed
# if command -v rsync &> /dev/null; then
# echo '[X] rsync is available in the path'
# else
# echo 'rsync is not available in the path'
# exit 1
# fi
# # ensure sed is installed
# if command -v sed &> /dev/null; then
# echo '[X] sed is available in the path'
# else
# echo 'sed is not available in the path'
# exit 1
# fi