From Fedora Project Wiki
(Building packages in stage3)
Line 25: Line 25:
 
  cd /rpmbuild/SPECS
 
  cd /rpmbuild/SPECS
  
You may need to disable hardened build by adding:
+
You may need to disable hardened build and debuginfo by adding:
  
 +
%global debug_package %{nil}
 
  %undefine _hardened_build
 
  %undefine _hardened_build
  
Line 33: Line 34:
 
You can now try building the package:
 
You can now try building the package:
  
  rpmbuild -ba the_package.spec --define "debug_package %{nil}"
+
  rpmbuild -ba the_package.spec --nodeps
  
 
If it builds successfully, brilliant!  More usually this will require many cycles of debugging and fixing things.  Removing dependencies or parts of the spec file is an option for these stage3 builds.
 
If it builds successfully, brilliant!  More usually this will require many cycles of debugging and fixing things.  Removing dependencies or parts of the spec file is an option for these stage3 builds.

Revision as of 18:29, 21 August 2016

All about bootstrapping Fedora on RISC-V.

Building packages in stage3

The stage3 environment can be built from source or you can download a snapshot binary image. See above for links to git etc.

Pick a package which:

  • has very few dependencies
  • is written in C or C++
  • is part of Fedora @Core

Grab the source RPM from Koji.

Copy the source RPM into the stage3 disk image. The disk image must not be running when you do this:

virt-copy-in -a stage3-disk.img the_package.src.rpm /var/tmp/

Boot the disk image in qemu:

make boot-stage3-in-qemu

Inside the VM you can now "install" the source RPM, which makes it available under /rpmbuild:

rpm -i /var/tmp/the_package.src.rpm
cd /rpmbuild/SPECS

You may need to disable hardened build and debuginfo by adding:

%global debug_package %{nil}
%undefine _hardened_build

to the spec file. Use vim to edit files.

You can now try building the package:

rpmbuild -ba the_package.spec --nodeps

If it builds successfully, brilliant! More usually this will require many cycles of debugging and fixing things. Removing dependencies or parts of the spec file is an option for these stage3 builds.

If you get a build, it will be in /rpmbuild inside the VM. sync and shut down the VM, then do:

virt-copy-out -a stage3-disk.img /rpmbuild ./

and the files will be downloaded to ./SRPMS and ./RPMS in the current directory. Note: Keep the source RPM too, especially if you modified it.

Add notes to the section below. Also come to #fedora-riscv and discuss where to put your built packages.

Notes on packages built so far

The list of packages in this section was constantly out of date, so I deleted it

To see the packages which have been built so far, look in the git repo. If you are planning to port another package, please ping us on #fedora-riscv first, just to make sure that two people don't do overlapping work.

"all-recursive" bug in make

Making all in .
Makefile:742: recipe for target 'all-recursive' failed

Added this to the spec file as a workaround:

sed 's/\$(am__cd) \$\$subdir \&\&/cd $$subdir ;/g' -i Makefile.in

debugedit missing

Use %global debug_package %{nil} (temporarily for stage3, in stage4 we will attempt to build the debuginfo packages).

bugs about locking, random "Permission denied"

Update to the latest riscv-gnu-toolchain and rebuild the kernel from the repo. All known locking bugs have been fixed.