debian/rules文件是debian打包脚本中的核心文件,规定了debian对upstream 项目进行配置、编译、安装一系列的动作。下面,主要是通过code example来学习下众多的rule case.
export PYBUILD_NAME=tpm2-pkcs11-tools
export PYBUILD_DIR=$(CURDIR)/tools
D=$(CURDIR)/debian
D_PY=$D/python3-tpm2-pkcs11-tools
D_TOOLS=$D/libtpm2-pkcs11-tools
export DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,now
override_dh_auto_configure:
dh_auto_configure -- --enable-unit
override_dh_auto_build-indep:
dh_auto_build --buildsystem pybuild
override_dh_auto_install-indep:
dh_auto_install --buildsystem pybuild
mkdir -p -- '${D_TOOLS}/usr/bin'
mv -- '${D_PY}/usr/bin/tpm2_ptool' '${D_TOOLS}/usr/bin/'
rmdir -- '${D_PY}/usr/bin'
%:
dh $@ --exclude=.la --exclude=.pc
其中, $(CURDIR)默认是Debian的临时编译文件存放的目录,这里可以灵活修改自己想要掌控的目录。
全局的针对编译系统的一个变量是DEB_LDFLAGS_MAINT_APPEND
,或者还有CFLAGS
,这里有一个wiki专门介绍了这点。
override_dh_auto_configure:
dh_auto_configure -- --enable-unit
指定运行配置项,这也是一个需要注意的地方。
debmake-doc 这里有一个更详细的编译顺序。
The current directory is set as: $(CURDIR)=/path/to/package-version/
DESTDIR=debian/binarypackage/ (single binary package)
DESTDIR=debian/tmp/ (multi binary package)
其中的DESTDIR是和Makefile的安装路径一起配合使用的。
dh是一个来自debhelper包的辅助命令,如下:
dh clean : clean files in the source tree.
dh build : build the source tree
dh build-arch : build the source tree for architecture dependent packages
dh build-indep : build the source tree for architecture independent packages
dh install : install the binary files to $(DESTDIR)
dh install-arch : install the binary files to $(DESTDIR) for architecture dependent packages
dh install-indep : install the binary files to $(DESTDIR) for architecture independent packages
dh binary : generate the deb file
dh binary-arch : generate the deb file for architecture dependent packages
dh binary-indep : generate the deb file for architecture independent packages
备注: For debhelper “compat >= 9”, the dh command exports compiler flags (CFLAGS, CXXFLAGS, FFLAGS, CPPFLAGS and LDFLAGS) with values as returned by dpkg-buildflags if they are not set previously. (The dh command calls set_buildflags defined in the Debian::Debhelper::Dh_Lib module.)
override_dh_auto_configure:
# Rebuild ./configure to get build system patches working
aclocal
autoconf
# --with-error-policy=retry-job # Set default job error policy to "retry-job", since it is less confusing and a better default on most machines
# --enable-sync-on-close # Set SyncOnClose to yes; considered saner on Linux
# --with-max-log-size=0 # Deactivate CUPS' internal logrotating, as we provide a better one, especially LogLevel debug2 gets usable now
dh_auto_configure -- \
$(CUPS_CONFIGURE_DISTRO_OPTIONS) \
--with-docdir=/usr/share/cups/doc-root \
--localedir=/usr/share/cups/locale \
...
这个片段来自cup. 可以重新configure
,然后重点看下配置项是怎么添加进去的。
override_dh_auto_build:
dh_auto_build -- "`dpkg-buildflags --export=configure`"
override_dh_auto_install:
make install DESTDIR=debian/dds2tar
自定义安装的目录,这里需要看下Makefile的支持情况。
override_dh_installman:
rm -rf debian/dds2tar/usr/share/man/man1
dh_installman
适时的调整man手册。
这里的cases,是指遇到一些较为容易理解,自己之前没有遇到过的规则,现在总结下来,方便后面的使用。
这篇文章记录NMU。
RFS: electrum/4.3.2-0.1 [NMU] [RC] -- Easy to use Bitcoin client
electrum (4.3.2-0.1) unstable; urgency=medium
.
* Non-maintainer upload.
* New upstream release (Closes: #1001064).
* Switch to new "sourceonly" upstream tarball (see the upstream changelog
for release 4.3.1).
* debian/compat: Create file and set version to debhelper v13.
* debian/control: Update debendencies.
* debian/control: Bump Standards-Version to 4.6.1 (no changes).
* debian/copyright: Update and reformat copyright and license information.
* debian/electrum.install: Include the new electrum.png in
usr/share/icons/hicolor/128x128/apps/.
* debian/patches: Refresh 0001-Improve-message-about-PyQt5.patch.
* debian/rules: Build paymentrequest_pb2.py from the .proto file and
remove redundant license files from the binary packages.
* debian/source: Remove unneeded include-binaries file.
* debian/upstream: Strip extra signatures from signing-key.asc
* debian/watch: Update to version 4 and refactor for "sourceonly" tarball.
# 1. import orig packages
gbp import-dsc elektra_0.8.14-5.1.dsc
# 2. push repo
# 一般来说这个时候是没有 repo的,所以需要自己新建一个repo
# http://marquiz.github.io/git-buildpackage-rpm/gbp.import.html
# 3.
gbp pq import
# 4.
git checkout master
# 5. import the new upstream into upstream
gbp import-orig ../elektra-0.9.11.tar.gz
What is the upstream version? [0.9.11]
gbp:info: Importing '../elektra-0.9.11.tar.gz' to branch 'upstream'...
gbp:info: Source package is elektra
gbp:info: Upstream version is 0.9.11
gbp:info: Replacing upstream source on 'master'
gbp:info: Successfully imported version 0.9.11 of ../elektra-0.9.11.tar.gz
# 6.
gbp pq export
gbp pq drop
Generally speaking, if others DD NMUed your package(s), you have to acknowledge this num in your next upload.
You should incorporate the changes from the NMU first.
Something like this:
$ dget https://deb.debian.org/debian/pool/main/j/jimtcl/jimtcl_0.82-4.1.dsc
change directory to your jimtcl repository:
$ cd jimtcl/
import the .dsc:
$ gbp import-dsc ../jimtcl_0.82-4.1.dsc
这篇文章记录在QA修包的记录。
这里有一个上传的例子:
Urgency: medium
Maintainer: Debian QA Group <packages@qa.debian.org>
Changed-By: Håvard F. Aasen <havard.f.aasen@pfft.no>
Closes: 906938 948873 965792
Changes:
raptor2 (2.0.15-1) unstable; urgency=medium
.
* QA upload.
* New upstream release. Closes: #906938
* Set Debian QA as maintainer. See #1012727
* Rebase patches.
* d/rules:
- Rewrite to use dh-sequencer.
* d/control:
- Bump debhelper to 13. Closes: #965792
- Drop dh-autoreconf, quilt and cdbs as build dependencies.
Add pkg-config and libglib2.0-dev as build dependencies.
- Apply libraptor2-doc multi-arch: same.
- Document Rules-Requires-Root.
- Use secure URI for homepage.
- Update Standards-Version to 4.6.1
- Remove version constraints on packages, no longer needed.
- Remove breaks in package libraptor2-0.
* d/watch:
- Bump to version 4.
- Change to secure URI.
* Migrate to dbgsym packages.
* Upstream patch to use pkg-config, to find xslt library. Closes: #948873
Thanks to Hugh McMaster for patch.
* Add d/not-installed.
* Change d/*.install, install files generated at buildtime.
* Drop *.doc-base file.
* Remove end-of-line whitespace in d/changelog.
* Fix typo in patch description.
* Add lintian-overrides for 'source-is-missing' *.html files.
* wrap-and-sort -at
* d/copyright: Convert to machine-readable format.
RFS: raptor2/2.0.15-3 [QA] -- Raptor 2 RDF syntax library
Debian版本号加1.
use `dch --qa` to prepare the changelog entry
gdb -ex r --args python3 -m pytest -rsx -v -s src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculator.py::Plotter3DTest
该问题的thread在mail list。基本情况是,由于之前手动安装某个package(python),导致引发了setuptools的bug:
vimer@dev:~/build/rfs/packages/test_dir$ sudo pip3 install sphinxcontrib-ditaa
Collecting sphinxcontrib-ditaa
Using cached sphinxcontrib-ditaa-1.0.1.tar.gz (7.5 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-c2wygkxs/sphinxcontrib-ditaa_10e1c64028af47e59b8fc5bf20b6901c/setup.py", line 8, in <module>
setup(
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 86, in setup
_install_setup_requires(attrs)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 75, in _install_setup_requires
dist = MinimalDistribution(attrs)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 57, in __init__
super().__init__(filtered)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 474, in __init__ for ep in metadata.entry_points(group='distutils.setup_keywords'): File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1009, in entry_points
return SelectableGroups.load(eps).select(**params)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 459, in load
ordered = sorted(eps, key=by_group)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 1006, in <genexpr>
eps = itertools.chain.from_iterable(
File "/usr/lib/python3.10/importlib/metadata/_itertools.py", line 16, in unique_everseen
k = key(element)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 941, in _normalized_name
return self._name_from_stem(stem) or super()._normalized_name
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 622, in _normalized_name
return Prepared.normalize(self.name)
File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 871, in normalize
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
File "/usr/lib/python3.10/re.py", line 209, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
在肥猫老师的帮助下,这个问题很快解决了,主要是通过这个命令:
strace -eopenat python -c "from importlib.metadata import entry_points; print(entry_points(group='sphinx.builders'))"
这里的一个新鲜事物是strace
,之前有用过这个命令,但是没想到还可以用在这里。这是这个bug带来的最大收获。其次,为什么这里可以通过entry_points
找到触发问题的入口呢?这是我目前不理解的地方。
这里的引入新包,是指Debian中并没有,而是从头开始创建。
$ uscan # Download your package's upstream original tarball
$ tar -xvf srcpkgname_1.0.orig.tar.gz
$ cd srcpkgname_1.0
$ git init
$ git checkout -b upstream
$ git add .
$ git commit -m "import srcpkgname_1.0.orig.tar.gz"
$ git tag -s upstream/1.0
$ pristine-tar commit ../srcpkgname_1.0.orig.tar.gz upstream
$ git checkout -b debian/main
gbp import-dscs --pristine-tar --debsnap python-ssdeep
gbp:info: Downloading snapshots of 'python-ssdeep' to '/tmp/tmp_0ren7kh'...
gbp:info: No git repository found, creating one.
gbp:info: Version '3.1+dfsg-1' imported under '/home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep'
gbp:info: Version '3.1+dfsg-2' imported under '/home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep'
gbp:info: Version '3.1+dfsg-2.1' imported under '/home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep'
gbp:info: Version '3.1+dfsg-3' imported under '/home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep'
gbp:info: Version '3.1+dfsg-4' imported under '/home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep'
gbp:info: Everything imported under /home/vimer/build/rfs/nmu/23_python-ssdeep/ssddep/python-ssdeep
参考 http://marquiz.github.io/git-buildpackage-rpm/gbp.import.html
还要注意repackage的问题:
$ gbp pq import
$ git checkout debian/master
$ gbp import-orig --pristine-tar --uscan
别忘记:
$ gbp pq rebase
$ gbp pq export
Once you’ve built and uploaded your package, you should tag the release.
$ gbp buildpackage --git-tag-only
$ git push --tags
arch 一般为 all(架构独立), 只有C扩展的才是any(架构非独立)
测试一般使用pytest或者unittest(unitetest应该就是默认的)
# 可以clear:
# package-installs-python-pycache-dir [usr/lib/python3.10/dist-packages/pygubu/__pyinstaller/__pycache__/]
override_dh_python3:
dh_python3
override_dh_auto_test:
$(foreach pyv, $(PYVERS), python$(pyv) -m unittest -v tests/util.py;)
vimer@dev:~/build/rfs/packages/pygubu-0.27$ cat debian/.gitlab-ci.yml
---
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
variables:
RELEASE: 'unstable'
# no compiled code, no point running blhc
SALSA_CI_DISABLE_BLHC: 'true'
Debian python team的RFS有一些特殊的地方是,你除了发邮件外,还可以使用一些特殊手段在IRC发出请求提供帮助,那就是这样:
# on #debian-python channel
!rfs ueberzug
# remove rfs
!rfs -git-multimail
这样就可以的了。
这里,主要记载一些我自己upload的python包或者看到的一些好的打包范例。
lazy-loader 是我第一个比较打包顺利的python包,其中确实学到了不少的知识。尤其关注 2022-10 的debian python mail list对这个的初版审评意见。
pygubu这个包同 tkcanlendar
一样,用到了 X11的环境。当然,这几个文件都需要仔细看看d/rules d/tests.
# We ignore failures on hurd, since its locking is broken
override_dh_auto_test: export PYBUILD_SYSTEM=custom
override_dh_auto_test: export PYBUILD_TEST_ARGS=env PYTHONPATH={build_dir} {interpreter} tests/test_all.py
override_dh_auto_test:
dh_auto_test || [ "$(DEB_BUILD_ARCH_OS)" = "hurd" ];
在某个架构上不跑test。
包含docs目录的doc手册。
这个页面作为搜集、整理ftbfs的解决方案。
https://wiki.debian.org/qa.debian.org/FTBFS
cc -DHAVE_CONFIG_H -I. -I.. -DPACKAGE_SRC_DIR=\""."\" -DPACKAGE_DATA_DIR=\""/usr/share"\" -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -g -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -fPIE -c -o pmask.o pmask.c
pmask.c: In function ‘install_pmask’:
pmask.c:32:54: error: size of array ‘_compile_time_assert__’ is negative
32 | #define COMPILE_TIME_ASSERT(condition) {typedef char _compile_time_assert__[(condition) ? 1 : -1];}
| ^~~~~~~~~~~~~~~~~~~~~~
pmask.c:34:9: note: in expansion of macro ‘COMPILE_TIME_ASSERT’
34 | COMPILE_TIME_ASSERT((1 << MASK_WORD_BITBITS) == MASK_WORD_BITS);
| ^~~~~~~~~~~~~~~~~~~
pmask.c: In function ‘init_pmask’:
pmask.c:40:36: warning: unused variable ‘error’ [-Wunused-variable]
40 | int words, total_words, x, error = 0;
| ^~~~~
pmask.c: In function ‘get_serialized_pmask_size’:
pmask.c:105:13: warning: unused variable ‘words’ [-Wunused-variable]
105 | int words = 1 + ((w-1) >> MASK_WORD_BITBITS);
| ^~~~~
make[3]: *** [Makefile:495: pmask.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/<<PKGBUILDDIR>>/src'
make[2]: *** [Makefile:410: all-recursive] Error 1
make[2]: Leaving directory '/<<PKGBUILDDIR>>'
make[1]: *** [Makefile:342: all] Error 2
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_build: error: make -j4 returned exit code 2
make: *** [debian/rules:9: binary-arch] Error 25
dpkg-buildpackage: error: debian/rules binary-arch subprocess returned exit status 2
--- open-invaders-0.3.orig/headers/pmask.h
+++ open-invaders-0.3/headers/pmask.h
@@ -37,7 +37,7 @@ confusing.
//don't worry about setting it incorrectly
//you'll get a compile error if you do, not a run-time error
#if defined(__alpha__) || defined(__ia64__) || (defined(__x86_64__) && defined(__LP64__)) || defined(__s390x__) || (defined(__sparc__)
+&& defined(__arch64__)) \
- || defined(__powerpc64__) || defined(__aarch64__) || (defined(__mips64) && defined(__LP64__))
+ || defined(__powerpc64__) || defined(__aarch64__) || (defined(__mips64) && defined(__LP64__)) || (defined(__riscv) &&
+defined(__LP64__))
#define MASK_WORD_BITBITS 6
#else
#define MASK_WORD_BITBITS 5
在 glibc 2.34 之前, 有一个ftbfs是这样的 , 来自here
[100%] Linking CXX executable ../bin/neochat
cd /<<PKGBUILDDIR>>/obj-riscv64-linux-gnu/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/neochat.dir/link.txt --verbose=1
/usr/bin/c++ -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -fcoroutines -Wl,--enable-new-dtags -Wl,-z,relro -Wl,-z,now CMakeFiles/neochat.dir/neochat_autogen/mocs_compilation.cpp.o CMakeFiles/neochat.dir/controller.cpp.o CMakeFiles/neochat.dir/actionshandler.cpp.o CMakeFiles/neochat.dir/emojimodel.cpp.o CMakeFiles/neochat.dir/customemojimodel.cpp.o CMakeFiles/neochat.dir/customemojimodel+network.cpp.o CMakeFiles/neochat.dir/clipboard.cpp.o CMakeFiles/neochat.dir/matriximageprovider.cpp.o CMakeFiles/neochat.dir/messageeventmodel.cpp.o CMakeFiles/neochat.dir/messagefiltermodel.cpp.o CMakeFiles/neochat.dir/roomlistmodel.cpp.o CMakeFiles/neochat.dir/roommanager.cpp.o CMakeFiles/neochat.dir/neochatroom.cpp.o CMakeFiles/neochat.dir/neochatuser.cpp.o CMakeFiles/neochat.dir/userlistmodel.cpp.o CMakeFiles/neochat.dir/publicroomlistmodel.cpp.o CMakeFiles/neochat.dir/userdirectorylistmodel.cpp.o CMakeFiles/neochat.dir/utils.cpp.o CMakeFiles/neochat.dir/main.cpp.o CMakeFiles/neochat.dir/notificationsmanager.cpp.o CMakeFiles/neochat.dir/sortfilterroomlistmodel.cpp.o CMakeFiles/neochat.dir/chatdocumenthandler.cpp.o CMakeFiles/neochat.dir/devicesmodel.cpp.o CMakeFiles/neochat.dir/filetypesingleton.cpp.o CMakeFiles/neochat.dir/login.cpp.o CMakeFiles/neochat.dir/stickerevent.cpp.o CMakeFiles/neochat.dir/chatboxhelper.cpp.o CMakeFiles/neochat.dir/commandmodel.cpp.o CMakeFiles/neochat.dir/webshortcutmodel.cpp.o CMakeFiles/neochat.dir/blurhash.cpp.o CMakeFiles/neochat.dir/blurhashimageprovider.cpp.o CMakeFiles/neochat.dir/joinrulesevent.cpp.o CMakeFiles/neochat.dir/collapsestateproxymodel.cpp.o CMakeFiles/neochat.dir/neochataccountregistry.cpp.o CMakeFiles/neochat.dir/colorschemer.cpp.o CMakeFiles/neochat.dir/trayicon_sni.cpp.o CMakeFiles/neochat.dir/runner.cpp.o CMakeFiles/neochat.dir/neochatconfig.cpp.o CMakeFiles/neochat.dir/neochat_autogen/YCDLW3T4OG/qrc_res.cpp.o CMakeFiles/neochat.dir/neochat_autogen/YCDLW3T4OG/qrc_res_desktop.cpp.o -o ../bin/neochat /usr/lib/riscv64-linux-gnu/libKF5SonnetCore.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Kirigami2.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Notifications.so.5.94.0 /usr/lib/riscv64-linux-gnu/libQuotient.so.0.6.11 /usr/lib/riscv64-linux-gnu/libcmark.so.0.30.2 /usr/lib/riscv64-linux-gnu/libqt5keychain.so.0.13.2 /usr/lib/riscv64-linux-gnu/libKF5KIOWidgets.so.5.94.0 /usr/lib/riscv64-linux-gnu/libQt5QuickControls2.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Quick.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5QmlModels.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Qml.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Multimedia.so.5.15.4 /usr/lib/riscv64-linux-gnu/libKF5ConfigWidgets.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Codecs.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Auth.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5KIOGui.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5WindowSystem.so.5.94.0 /usr/lib/riscv64-linux-gnu/libX11.so /usr/lib/riscv64-linux-gnu/libKF5KIOCore.so.5.94.0 /usr/lib/riscv64-linux-gnu/libQt5Network.so.5.15.4 /usr/lib/riscv64-linux-gnu/libKF5AuthCore.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5JobWidgets.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Service.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5I18n.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5CoreAddons.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5DBusAddons.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Solid.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5Completion.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5ConfigGui.so.5.94.0 /usr/lib/riscv64-linux-gnu/libKF5ConfigCore.so.5.94.0 /usr/lib/riscv64-linux-gnu/libQt5DBus.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Xml.so.5.15.4 /usr/lib/riscv64-linux-gnu/libKF5WidgetsAddons.so.5.94.0 /usr/lib/riscv64-linux-gnu/libQt5Widgets.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Gui.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Concurrent.so.5.15.4 /usr/lib/riscv64-linux-gnu/libQt5Core.so.5.15.4
/usr/bin/ld: CMakeFiles/neochat.dir/neochatroom.cpp.o: undefined reference to symbol '__atomic_exchange_1@@LIBATOMIC_1.0'
/usr/bin/ld: /usr/lib/riscv64-linux-gnu/libatomic.so.1: error adding symbols: DSO missing from command line
可以使用下面的方法:
<bunk> +ifneq (,$(filter $(DEB_HOST_ARCH), riscv64))
<bunk> + export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-as-needed -latomic -Wl,--as-needed
<bunk> +endif
-I/usr/include/libpng16 -I/usr/include/SDL2 -c -o IOGfxSurfaceGL2.o IOGfxSurfaceGL2.cpp
> gfx_fonts.cpp: In function ‘void setup_font(TTF_Font*)’:
> gfx_fonts.cpp:296:44: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
> 296 | char *familyname = TTF_FontFaceFamilyName(font);
详见 #1015106
cc: error: unrecognized command-line option ‘-m64’
cc: error: unrecognized command-line option ‘-m32’
解决方案是,在相关的测试fail中,过滤掉不属于这个架构的测试:
--- a/tests/05_32_bits/Makefile
+++ b/tests/05_32_bits/Makefile
@@ -2,11 +2,13 @@
# Make sure the 64 bits versions are not picked up.
LD_LIBRARY_PATH=
+CPU_ARCH=$(shell uname -m)
.PHONY: clean
all: check
+ifeq ($(CPU_ARCH), $(filter x86_64 amd64 i686 i386 ppc% sparc64,$(CPU_ARCH)))
lib64/libx.so:
mkdir -p $(@D)
echo 'int a(){return 42;}' | $(CC) -shared -Wl,-soname,$(@F) -m64 -o $@ -nostdlib -x c -
@@ -25,6 +27,11 @@
../../libtree exe32
../../libtree exe64
+else
+check:
+ @echo Architecture does not support -m32 or -m64 options. Do nothing.
+endif
+
clean:
rm -rf lib32 lib64 exe*
filter
在这里是匹配返回值的意思。
https://gist.github.com/hack3ric/c6fbbc7055f19b6024340384b4fc750a