Skip to contentSkip to conversation

apt: Fix do_compile error when enable ccache

PATCH In review Chen Qi 2 participants 4 messages Mar 31, 2021 – Apr 1, 2021

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/1 apt: Fix do_compile error when enable ccache

When apt was upgraded, the '-DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True' was dropped. However, it was there to fix do_compile error when ccache is enabled. See details in the following commit.

"""
commit 0aa7d612b8b7e5f14b4ed38f2a32b3f7eefca31c

Author: Robert Yang <[email protected]>
Date:   Tue Jan 19 01:23:45 2021 -0800

apt: Fix do_compile error when enable ccache

Fixed:
apt-pkg/libapt-pkg.so.5.0.2: undefined reference to `ZSTD_endStream'
collect2: error: ld returned 1 exit status

This is because ccache-native depends on zstd-native which makes apt wronly
find it. Disable zstd for apt to fix the problem.
"""

Now we are meeting do_compile failure again when enabling ccache, so add it back to solve the problem.

---
 meta/recipes-devtools/apt/apt_2.2.2.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/apt/apt_2.2.2.bb +1 -0
index d1aa5de8df..7d1bce558d 100644
@@ -44,6 +44,7 @@ DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
 EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
     -DDPKG_DATADIR=${datadir}/dpkg \
     -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
+    -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
     -DWITH_TESTS=False \
 "
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 11 lines · Chen Qi

When apt was upgraded, the '-DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True' was dropped. However, it was there to fix do_compile error when ccache is enabled. See details in the following commit.

"""
commit 0aa7d612b8b7e5f14b4ed38f2a32b3f7eefca31c

Author: Robert Yang <[email protected]>
Date:   Tue Jan 19 01:23:45 2021 -0800

apt: Fix do_compile error when enable ccache

Quoted 7 lines

Fixed:
apt-pkg/libapt-pkg.so.5.0.2: undefined reference to `ZSTD_endStream'
collect2: error: ld returned 1 exit status

This is because ccache-native depends on zstd-native which makes apt wronly
find it. Disable zstd for apt to fix the problem.
"""

should this only be disabled for apt-native then ? and perhaps it could be turned into a packageconfig knob as well

Quoted 26 lines

Now we are meeting do_compile failure again when enabling ccache, so add it back to solve the problem.

---
  meta/recipes-devtools/apt/apt_2.2.2.bb | 1 +
  1 file changed, 1 insertion(+)
meta/recipes-devtools/apt/apt_2.2.2.bb +1 -0
index d1aa5de8df..7d1bce558d 100644
@@ -44,6 +44,7 @@ DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt xxhash"
  EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
      -DDPKG_DATADIR=${datadir}/dpkg \
      -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
+    -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
      -DWITH_TESTS=False \
  "
 
author
#2 lore raw
Quoted 19 lines · Khem Raj
Quoted 16 lines · Chen Qi

When apt was upgraded, the '-DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True' was dropped. However, it was there to fix do_compile error when ccache is enabled. See details in the following commit.

"""
commit 0aa7d612b8b7e5f14b4ed38f2a32b3f7eefca31c

Author: Robert Yang <[email protected]>
Date:   Tue Jan 19 01:23:45 2021 -0800

apt: Fix do_compile error when enable ccache

Fixed:
apt-pkg/libapt-pkg.so.5.0.2: undefined reference to
`ZSTD_endStream'
collect2: error: ld returned 1 exit status

Quoted 6 lines
Quoted 4 lines

This is because ccache-native depends on zstd-native which makes
apt wronly
find it. Disable zstd for apt to fix the problem.
"""

should this only be disabled for apt-native then ? and perhaps it could be turned into a packageconfig knob as well

No. It should be disabled for both, and mainly for the target apt. Because apt sets 'CMAKE_FIND_ROOT_PATH_MODE_INCLUDE' to 'BOTH'.

The packageconfig also does not solve the problem for the current codes, as the zstd dependency is added in ccache.bbclass via python anonymous function.
To make packageconfig work, the apt upstream needs to be patched to be able to enable/disable zstd explicitly. But there are many other 'find_package' in apt, they will need to be changed in the same way. Not sure apt upstream would be happy to do so. I don't think It's worth the effort.

Best Regards,
Chen Qi

Quoted 28 lines
Quoted 27 lines

Now we are meeting do_compile failure again when enabling ccache, so add it back to solve the problem.

---
  meta/recipes-devtools/apt/apt_2.2.2.bb | 1 +
  1 file changed, 1 insertion(+)
meta/recipes-devtools/apt/apt_2.2.2.bb +0 -0
index d1aa5de8df..7d1bce558d 100644
@@ -44,6 +44,7 @@ DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt 

xxhash"

  EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
      -DDPKG_DATADIR=${datadir}/dpkg \
      -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
+    -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
      -DWITH_TESTS=False \

"

#3 lore raw
Quoted 33 lines · ChenQi
Quoted 20 lines · Khem Raj
Quoted 17 lines · Chen Qi

When apt was upgraded, the '-DCMAKE_DISABLE_FIND_PACKAGE_Zstd=True' was dropped. However, it was there to fix do_compile error when ccache is
enabled. See details in the following commit.

"""
commit 0aa7d612b8b7e5f14b4ed38f2a32b3f7eefca31c

Author: Robert Yang <[email protected]>
Date:   Tue Jan 19 01:23:45 2021 -0800

apt: Fix do_compile error when enable ccache

Fixed:
apt-pkg/libapt-pkg.so.5.0.2: undefined reference to
`ZSTD_endStream'
collect2: error: ld returned 1 exit status

Quoted 7 lines
Quoted 4 lines

This is because ccache-native depends on zstd-native which makes
apt wronly
find it. Disable zstd for apt to fix the problem.
"""

should this only be disabled for apt-native then ? and perhaps it could be turned into a packageconfig knob as well

No. It should be disabled for both, and mainly for the target apt. Because apt sets 'CMAKE_FIND_ROOT_PATH_MODE_INCLUDE' to 'BOTH'.

Quoted 8 lines

The packageconfig also does not solve the problem for the current codes, as the zstd dependency is added in ccache.bbclass via python anonymous function.
To make packageconfig work, the apt upstream needs to be patched to be able to enable/disable zstd explicitly. But there are many other 'find_package' in apt, they will need to be changed in the same way. Not sure apt upstream would be happy to do so. I don't think It's worth the effort.

OK thanks for explanation. I think this approach is fine for now.

Quoted 35 lines

Best Regards,
Chen Qi

Quoted 30 lines
Quoted 29 lines

Now we are meeting do_compile failure again when enabling ccache, so add it
back to solve the problem.

---
  meta/recipes-devtools/apt/apt_2.2.2.bb | 1 +
  1 file changed, 1 insertion(+)
meta/recipes-devtools/apt/apt_2.2.2.bb +0 -0
index d1aa5de8df..7d1bce558d 100644
@@ -44,6 +44,7 @@ DEPENDS += "db gnutls lz4 zlib bzip2 xz libgcrypt

xxhash"

  EXTRA_OECMAKE_append = " -DCURRENT_VENDOR=debian -DWITH_DOC=False \
      -DDPKG_DATADIR=${datadir}/dpkg \
      -DTRIEHASH_EXECUTABLE=${WORKDIR}/triehash \
+    -DCMAKE_DISABLE_FIND_PACKAGE_ZSTD=True \
      -DWITH_TESTS=False \

"