diff --git a/chroot.py b/chroot.py index 62a8000..09cf36a 100644 --- a/chroot.py +++ b/chroot.py @@ -162,7 +162,9 @@ def mount_crossdirect(native_chroot: str, target_chroot: str, target_arch: str, """ if host_arch is None: host_arch = config.runtime['arch'] - gcc = f'{GCC_HOSTSPECS[host_arch][target_arch]}-gcc' + hostspec = GCC_HOSTSPECS[host_arch][target_arch] + cc = f'{hostspec}-cc' + gcc = f'{hostspec}-gcc' native_mount = os.path.join(target_chroot, 'native') logging.debug(f'Activating crossdirect in {native_mount}') @@ -172,11 +174,21 @@ def mount_crossdirect(native_chroot: str, target_chroot: str, target_arch: str, if results['crossdirect'].returncode != 0: raise Exception('Failed to install crossdirect') + cc_path = os.path.join(native_chroot, 'usr', 'bin', cc) + target_lib_dir = os.path.join(target_chroot, 'lib64') + + for target, source in {cc_path: gcc, target_lib_dir: 'lib'}.items(): + if not os.path.exists(target): + logging.debug(f'Symlinking {source} at {target}') + os.symlink(source, target) + ld_so = os.path.basename(glob(f"{os.path.join(native_chroot, 'usr', 'lib', 'ld-linux-')}*")[0]) + ld_so_target = os.path.join(target_lib_dir, ld_so) + if not os.path.islink(ld_so_target): + os.symlink(os.path.join('/native', 'usr', 'lib', ld_so), ld_so_target) + else: + logging.debug('ld-linux.so symlink already exists, skipping for {target_chroot}') + os.makedirs(native_mount, exist_ok=True) - - ld_so = glob(f"{os.path.join(native_chroot, 'usr', 'lib', 'ld-linux-')}*")[0] - copy(ld_so, os.path.join(target_chroot, 'usr', 'lib')) - logging.debug(f'Mounting {native_chroot} to {native_mount}') result = mount(native_chroot, native_mount) if result.returncode != 0: diff --git a/packages.py b/packages.py index 1274733..1703cf9 100644 --- a/packages.py +++ b/packages.py @@ -358,7 +358,7 @@ def setup_build_chroot(arch: str, extra_packages=[]) -> str: chroot_path = create_chroot( chroot_name, arch=arch, - packages=list(set(['base-devel', 'git', 'ccache'] + extra_packages)), + packages=list(set(['base-devel', 'git'] + extra_packages)), extra_repos=get_kupfer_local(arch).repos, ) pacman_cache = mount_pacman_cache(chroot_path, arch)