Building unicorn on Fedora's s390x build hosts fails with the error message below. I suspect this is due to a compiler change or perhaps a change to a dependency. Reproducible: Always Steps to Reproduce: Run "fedpkg build" from the package's Git repository. Actual Results: See https://kojipkgs.fedoraproject.org//work/tasks/8545/103368545/build.log. Here is a summary: /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_ldo_le_mmu_ppc64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_ldo_be_mmu_ppc64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_cmpxchgo_le_mmu_aarch64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_cmpxchgo_be_mmu_aarch64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_sto_be_mmu_s390x' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_ldo_be_mmu_s390x' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_cmpxchgo_be_mmu_s390x' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_cmpxchgo_be_mmu_ppc64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_sto_be_mmu_ppc64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_cmpxchgo_le_mmu_ppc64' /usr/bin/ld: libunicorn.so.2: undefined reference to `helper_atomic_sto_le_mmu_ppc64' collect2: error: ld returned 1 exit status gmake[2]: *** [CMakeFiles/sample_batch_reg.dir/build.make:98: sample_batch_reg] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:779: CMakeFiles/sample_batch_reg.dir/all] Error 2 A similar report upstream: https://github.com/unicorn-engine/unicorn/issues/1840
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle. Changing version to 39.
I disabled the s390x build for now. Ubuntu's package seems to build: https://packages.ubuntu.com/mantic/libunicorn-dev I am not yet sure what is causing the problem here.
The problems is missing linking with libatomic. It has been fixed upstream if I see right, please see commits from Dec 28 2023 in the "staged" tree.
I applied the following, and the build still failed: # These are from the staging branch, and it fixes the build failure on s390x # (12/28/23). Commits: Patch0001: 2362-Add-latomic-for-arm-and-riscv64.patch # 55560a2474f68b1ffa77433361cf591784e28b50 Patch0002: 2363-Fix-typo.patch # f389666ea6eb653f040094ef9c7ee05479e23671 Patch0003: 2364-Add-latomic-to-samples-and-tests.patch # db0acd5ace38ea3d5cdb94c275e324b53d70bce0 Patch0004: 2365-Refine-latomic-fix.patch # e3163ccda178bca42d5a7d123ebd26acd76dae62 Patch0005: 2366-Reflect-in-pkg-config.patch # 60cf9eba40e1edbf49d4e9194c54bd8118b9d849 Patch0006: 2367-Also-add-atomic-to-samples-lib-linkage.patch # e5fa037aebd9c74355200aec8a0cc77f2a15675e You can review the result at: https://copr.fedorainfracloud.org/coprs/mikep/scratch/build/7255371/
hmm, I will have a closer look then ...
Interestingly it's problem of the rpm build. When building the upstream sources locally, it has no such problem. Looking further ...
IMO there is something wrong with how the rpm is built. First it builds unicorn, the lib, samples, etc. and all goes well. Then it goes for the python bindings and here the python script builds unicorn for the second time and things go bad. I believe the python bindings should just use the unicorn library built in the first step, probably via the prebuilt subdir and some symlinks. In the current rpms (for all arches) both unicorn and python3-unicorn rpms provide the libunicorn.so.2 file (the python3 subpackage even contains libunicorn.a). This sounds wrong ... I suppose the "python" version of unicorn is built with some different cmake options (setup.py calls cmake) or something like that.