Bug 2223039 - Something is preventing unicorn from building on s390x
Summary: Something is preventing unicorn from building on s390x
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: unicorn
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: W. Michael Petullo
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker
TreeView+ depends on / blocked
 
Reported: 2023-07-14 22:50 UTC by W. Michael Petullo
Modified: 2024-04-04 16:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description W. Michael Petullo 2023-07-14 22:50:13 UTC
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

Comment 1 Fedora Release Engineering 2023-08-16 08:12:54 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 2 W. Michael Petullo 2023-12-16 22:16:37 UTC
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.

Comment 3 Dan Horák 2024-04-03 14:19:32 UTC
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.

Comment 4 W. Michael Petullo 2024-04-03 23:13:42 UTC
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/

Comment 5 Dan Horák 2024-04-04 12:11:51 UTC
hmm, I will have a closer look then ...

Comment 6 Dan Horák 2024-04-04 15:29:24 UTC
Interestingly it's problem of the rpm build. When building the upstream sources locally, it has no such problem. Looking further ...

Comment 7 Dan Horák 2024-04-04 16:06:15 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.