Skip to content

Commit 0505dbb

Browse files
authored
Fix toolchain selection and packages on linux x86 (#1133)
* Fix toolchain selection on linux. * Add path to 32-bit packages to pkgconfig environment variable. * Add extra libsecret package. * Remove conflicting packages * Remove and add at the same time. * Add a check after installing dependencies to verify they installed. * Write package config path to temp toolchain file. * Add readme.
1 parent 03a2204 commit 0505dbb

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

cmake/toolchains/linux_32.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")
1818
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
1919
set(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu")
2020
set(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} "/usr/include/i386-linux-gnu")
21+
set(ENV{PKG_CONFIG_PATH} "/usr/lib/i386-linux-gnu/pkgconfig:$ENV{PKG_CONFIG_PATH}")

release_build_files/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,10 @@ workflow use only during the development of your app, not for publicly shipping
634634
code.
635635

636636
## Release Notes
637+
### Upcoming Release
638+
- Changes
639+
- General (Desktop): Linux x86 libraries have been fixed.
640+
637641
### 10.1.0
638642
- Changes
639643
- General (Android): Update to Firebase Android BoM version 31.0.2.

scripts/gha/build_desktop.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ def cmake_configure(build_dir, arch, msvc_runtime_library='static', linux_abi='l
171171
# workaround, absl doesn't build without tests enabled
172172
cmd.append('-DBUILD_TESTING=off')
173173

174-
if not disable_vcpkg:
174+
if disable_vcpkg:
175+
if utils.is_linux_os() and arch == 'x86':
176+
toolchain_file_path = os.path.join(os.getcwd(), 'cmake', 'toolchains', 'linux_32.cmake')
177+
cmd.append('-DCMAKE_TOOLCHAIN_FILE={0}'.format(toolchain_file_path))
178+
else: # not disable_vcpkg - therefore vcpkg is enabled
175179
if utils.is_linux_os() and arch == 'x86':
176180
# Use a separate cmake toolchain for cross compiling linux x86 builds
177181
vcpkg_toolchain_file_path = os.path.join(os.getcwd(), 'external', 'vcpkg',

scripts/gha/build_testapps.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ def main(argv):
277277
'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32")\n',
278278
'set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")\n',
279279
'set(CMAKE_LIBRARY_PATH "/usr/lib/i386-linux-gnu")\n',
280-
'set(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} "/usr/include/i386-linux-gnu")\n'])
280+
'set(INCLUDE_DIRECTORIES ${INCLUDE_DIRECTORIES} "/usr/include/i386-linux-gnu")\n',
281+
'set(ENV{PKG_CONFIG_PATH} "/usr/lib/i386-linux-gnu/pkgconfig:$ENV{PKG_CONFIG_PATH}")'])
281282
temp_toolchain_file.flush()
282283
# Leave the file open, as it will be deleted on close, i.e. when this script exits.
283284
# (On Linux, the file can be opened a second time by cmake while still open by

scripts/gha/utils.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,33 @@ def install_x86_support_libraries(gha_build=False):
231231
if is_linux_os():
232232
packages = ['gcc-multilib', 'g++-multilib', 'libglib2.0-dev:i386',
233233
'libsecret-1-dev:i386', 'libpthread-stubs0-dev:i386',
234-
'libssl-dev:i386']
234+
'libssl-dev:i386', 'libsecret-1-0:i386']
235+
remove_packages = []
235236

236237
# First check if these packages exist on the machine already
237238
with open(os.devnull, "w") as devnull:
238-
process = subprocess.run(["dpkg", "-s"] + packages, stdout=devnull, stderr=subprocess.STDOUT)
239+
process = subprocess.run(["dpkg", "-s"] + packages, stdout=devnull,
240+
stderr=subprocess.STDOUT)
239241

240242
if process.returncode != 0:
241-
# This implies not all of the required packages are already installed on user's machine
242-
# Install them.
243-
run_command(['dpkg', '--add-architecture', 'i386'], as_root=True, check=True)
243+
# This implies not all of the required packages are already installed on
244+
# user's machine. Install them.
245+
run_command(['dpkg', '--add-architecture', 'i386'], as_root=True,
246+
check=True)
244247
run_command(['apt', 'update'], as_root=True, check=True)
245248
run_command(['apt', 'install', 'aptitude'], as_root=True, check=True)
246-
run_command(['aptitude', 'install', '-V', '-y'] + packages, as_root=True, check=True)
249+
if gha_build:
250+
# Remove libpcre to prevent package conflicts.
251+
# Only remove packages on GitHub runners.
252+
remove_packages = ['libpcre2-dev:amd64', 'libpcre2-32-0:amd64',
253+
'libpcre2-8-0:amd64', 'libpcre2-16-0:amd64']
254+
# Note: With aptitude, you can remove package 'xyz' by specifying 'xyz-'
255+
# in the package list.
256+
run_command(['aptitude', 'install', '-V', '-y'] + packages +
257+
['%s-' % pkg for pkg in remove_packages], as_root=True, check=True)
258+
259+
# Check if the packages were installed
260+
with open(os.devnull, "w") as devnull:
261+
subprocess.run(["dpkg", "-s"] + packages, stdout=devnull, stderr=subprocess.STDOUT,
262+
check=True)
263+

0 commit comments

Comments
 (0)