Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4th Gen Airport Time Capsule - Compile rsync #6

Open
raghu-mp opened this issue Jan 19, 2023 · 9 comments
Open

4th Gen Airport Time Capsule - Compile rsync #6

raghu-mp opened this issue Jan 19, 2023 · 9 comments

Comments

@raghu-mp
Copy link

Hi, I am following the guide at https://github.com/ipatch/theairportwiki/wiki/build-a-cross-compile-NetBSD-toolchain-armv6-Notes
Setup a NetBSD 9.0 VM on Proxmox and trying compile rsync for NetBSD 4.0 and earmv5 in it instead of the airport (not brave enough to try doing it on the target yet). You mentioned rsync-3.1.3nb1 (need to compile a simple perl working) and i am trying to figure out how exactly to do that. Can you please help?

@ipatch
Copy link
Owner

ipatch commented Jan 19, 2023

@gchehab

you might giving this guy a hand?

@raghu-mp
Copy link
Author

raghu-mp commented Jan 19, 2023

Thank you for the quick response. Also i seem to be missing /etc/mk.conf based on the below output after building the sets. How should this be configured for this cross-compile?

MAKECONF file: /etc/mk.conf (File not found)

I created one based on a sample and getting the following error when compiling rsync.

Beginning configuration for bash-5.1-release for arm--netbsdelf-eabi

=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for rsync-3.2.5.tar.gz
=> Checksum SHA512 OK for rsync-3.2.5.tar.gz
===> Installing dependencies for rsync-3.2.5

The supported build options for rsync are:

    acl

The currently selected options are:

    acl

You can select which build options to use by setting PKG_DEFAULT_OPTIONS
or the following variable. Its current value is shown:

    PKG_OPTIONS.rsync (not defined)

==========================================================================

The following variables will affect the build process of this package,
rsync-3.2.5. Their current value is shown below:

    * SSLBASE = /usr
    * SSLCERTBUNDLE (not defined)
    * SSLCERTS = /etc/openssl/certs
    * SSLDIR = /etc/openssl
    * SSLKEYS = /etc/openssl/private

You may want to abort the process now with CTRL-C and change the value
of variables in the first group before continuing. Be sure to run
`/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/bin/nbmake clean' after the changes.

=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
=> Full dependency bash-[0-9]*: NOT found
=> Verifying reinstall for ../../shells/bash
=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for bash-5.1.tar.gz
=> Checksum SHA512 OK for bash-5.1.tar.gz
=> Checksum BLAKE2s OK for bash51-001
=> Checksum SHA512 OK for bash51-001
=> Checksum BLAKE2s OK for bash51-002
=> Checksum SHA512 OK for bash51-002
=> Checksum BLAKE2s OK for bash51-003
=> Checksum SHA512 OK for bash51-003
=> Checksum BLAKE2s OK for bash51-004
=> Checksum SHA512 OK for bash51-004
=> Checksum BLAKE2s OK for bash51-005
=> Checksum SHA512 OK for bash51-005
=> Checksum BLAKE2s OK for bash51-006
=> Checksum SHA512 OK for bash51-006
=> Checksum BLAKE2s OK for bash51-007
=> Checksum SHA512 OK for bash51-007
=> Checksum BLAKE2s OK for bash51-008
=> Checksum SHA512 OK for bash51-008
=> Checksum BLAKE2s OK for bash51-009
=> Checksum SHA512 OK for bash51-009
=> Checksum BLAKE2s OK for bash51-010
=> Checksum SHA512 OK for bash51-010
=> Checksum BLAKE2s OK for bash51-011
=> Checksum SHA512 OK for bash51-011
=> Checksum BLAKE2s OK for bash51-012
=> Checksum SHA512 OK for bash51-012
=> Checksum BLAKE2s OK for bash51-013
=> Checksum SHA512 OK for bash51-013
=> Checksum BLAKE2s OK for bash51-014
=> Checksum SHA512 OK for bash51-014
=> Checksum BLAKE2s OK for bash51-015
=> Checksum SHA512 OK for bash51-015
=> Checksum BLAKE2s OK for bash51-016
=> Checksum SHA512 OK for bash51-016
===> Installing dependencies for bash-5.1.16

The supported build options for bash are:

    nls

The currently selected options are:

    nls

You can select which build options to use by setting PKG_DEFAULT_OPTIONS
or the following variable. Its current value is shown:

    PKG_OPTIONS.bash (not defined)

==========================================================================
=> Tool dependency bison>=1.0: found bison-3.8.2
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
===> Skipping vulnerability checks.
WARNING: No /root/netbsd/obj/destdir.evbarm/var/db/pkg/pkg-vulnerabilities file found.
WARNING: To fix run: `/usr/pkg/sbin/pkg_admin -K /root/netbsd/obj/destdir.evbarm/var/db/pkg fetch-pkg-vulnerabilities'.
===> Overriding tools for bash-5.1.16
===> Extracting for bash-5.1.16
===> Patching for bash-5.1.16
=> Applying distribution patches for bash-5.1.16
=> Applying pkgsrc patches for bash-5.1.16
===> Creating toolchain wrappers for bash-5.1.16
===> Configuring for bash-5.1.16
/bin/rm -f /root/netbsd/pkgsrc/shells/bash/work.earmv5/bash-5.1/y.tab.c
=> Modifying GNU configure scripts to avoid --recheck
=> Replacing config-guess with pkgsrc versions
=> Replacing config-sub with pkgsrc versions
=> Replacing install-sh with pkgsrc version
=> Adding run-time search paths to pkg-config files.
INFO: [subst.mk:_pkgconfig] Nothing changed in "support/bash.pc.in".
=> Fixing locale directory references.
INFO: [subst.mk:pkglocaledir] Nothing changed in "doc/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "examples/loadables/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "examples/loadables/Makefile.inc.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "examples/loadables/perl/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/glob/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/malloc/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/readline/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/sh/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/termcap/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "lib/tilde/Makefile.in".
INFO: [subst.mk:pkglocaledir] Nothing changed in "support/Makefile.in".
checking build system type... arm--netbsdelf-eabi
checking host system type... arm--netbsdelf-eabi

Beginning configuration for bash-5.1-release for arm--netbsdelf-eabi

checking for arm--netbsdelf-eabi-gcc... arm--netbsdelf-eabi-gcc
checking whether the C compiler works... no
configure: error: in /root/netbsd/pkgsrc/shells/bash/work.earmv5/bash-5.1': configure: error: C compiler cannot create executables See config.log' for more details

config.log --

configure:3765: $? = 0
configure:3754: arm--netbsdelf-eabi-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/netbsd/pkgsrc/shells/bash/work.earmv5/.gcc/bin/arm--netbsdelf-eabi-gcc
COLLECT_LTO_WRAPPER=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/libexec/gcc/arm--netbsdelf-eabi/7.4.0/lto-wrapper
Target: arm--netbsdelf-eabi
Configured with: /root/netbsd/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=arm--netbsdelf-eabi --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb3 20190319' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-sysroot=/root/netbsd/obj/destdir.evbarm --with-mpc=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --with-mpfr=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --with-gmp=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --disable-nls --disable-multilib -with-float=soft --program-transform-name='s,^,arm--netbsdelf-eabi-,' --enable-languages='c c++ objc' --prefix=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --disable-shared
Thread model: posix
gcc version 7.4.0 (NetBSD nb3 20190319)
configure:3765: $? = 0
configure:3754: arm--netbsdelf-eabi-gcc -V >&5
arm--netbsdelf-eabi-gcc: error: unrecognized command line option '-V'
arm--netbsdelf-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3765: $? = 1
configure:3754: arm--netbsdelf-eabi-gcc -qversion >&5
arm--netbsdelf-eabi-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
arm--netbsdelf-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3765: $? = 1
configure:3785: checking whether the C compiler works
configure:3807: arm--netbsdelf-eabi-gcc -O2 -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include -DDEFAULT_PATH_VALUE=""/sbin:/usr/sbin:/usr/bin:/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin"" -I/usr/include -z muldefs -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib conftest.c >&5
/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find crtbeginS.o: No such file or directory
/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find -lgcc_s
/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find -lgcc_s
/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find crtendS.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:3811: $? = 1
configure:3849: result: no
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME "bash"
| #define PACKAGE_TARNAME "bash"
| #define PACKAGE_VERSION "5.1-release"
| #define PACKAGE_STRING "bash 5.1-release"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define USING_BASH_MALLOC 1
| #define ALIAS 1
| #define PUSHD_AND_POPD 1
| #define RESTRICTED_SHELL 1
| #define PROCESS_SUBSTITUTION 1
| #define PROMPT_STRING_DECODE 1
| #define SELECT_COMMAND 1
| #define HELP_BUILTIN 1
| #define ARRAY_VARS 1
| #define DPAREN_ARITHMETIC 1
| #define BRACE_EXPANSION 1
| #define COMMAND_TIMING 1
| #define EXTENDED_GLOB 1
| #define EXTGLOB_DEFAULT 0
| #define COND_COMMAND 1
| #define COND_REGEXP 1
| #define COPROCESS_SUPPORT 1
| #define ARITH_FOR_COMMAND 1
| #define NETWORK_REDIRECTIONS 1
| #define PROGRAMMABLE_COMPLETION 1
| #define DEBUGGER 1
| #define CASEMOD_ATTRS 1
| #define CASEMOD_EXPANSIONS 1
| #define GLOBASCII_DEFAULT 1
| #define FUNCTION_IMPORT 1
| #define MEMSCRAMBLE 1
| /
end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3854: error: in /root/netbsd/pkgsrc/shells/bash/work.earmv5/bash-5.1': configure:3857: error: C compiler cannot create executables See config.log' for more details

@gchehab
Copy link
Collaborator

gchehab commented Jan 19, 2023

Hey @raghu-mp, sorry for the delay, I am in between jobs and have a lot going on... I was redoing my steps to get a good build environment running.

I lost the older one... As far as I remember the rsync's makefile uses perl version to bootstrap the compile environment. I do not remember if it used perl or mini-perl.

Polishing the procedure up is still on my plans, I want to get rsync again, and my try to push it further, perhaps rclone..

Anyway, as for your problem, you can try to workaround linking the existing crt* libraries to the ending with S.

You must have this on your /usr/lib folder:
crt0.o crtbegin.o crtend.o crti.o crtn.o

Try this:
ln -s crtbegin.o crtbeginS.o

I remember that it got me further... For some reason it tries to link to the shared objects version of the crt libraries

@raghu-mp
Copy link
Author

Thank you. The ln -s resolved the crtbeginS.o and crtendS.o issue. But the following still persists.

/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find -lgcc_s
/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/lib/gcc/arm--netbsdelf-eabi/7.4.0/../../../../arm--netbsdelf-eabi/bin/ld: cannot find -lgcc_s

Any idea how to resolve these?

@gchehab
Copy link
Collaborator

gchehab commented Jan 20, 2023

Again tries to use the shared library, even on a static build… As the kernel is not compiled with shared libs support, the tools build had them disabled. That is why there are no s ending versions of some common libraries.

In this case check if you have the static version /var/lib/libgcc.o

link it to libgcc_s.o

Even though, I believe that you have a setting on somewhere (or an environment variable) to select the right libgcc for all compilations, this should work as well.

@raghu-mp
Copy link
Author

Tried that symlink and the error went away. But it still fails and config.log does not show the exact problem.

configure:3765: $? = 0
configure:3754: arm--netbsdelf-eabi-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/netbsd/pkgsrc/shells/bash/work.earmv5/.gcc/bin/arm--netbsdelf-eabi-gcc
COLLECT_LTO_WRAPPER=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64/libexec/gcc/arm--netbsdelf-eabi/7.4.0/lto-wrapper
Target: arm--netbsdelf-eabi
Configured with: /root/netbsd/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=arm--netbsdelf-eabi --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb3 20190319' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new --with-sysroot=/root/netbsd/obj/destdir.evbarm --with-mpc=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --with-mpfr=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --with-gmp=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --disable-nls --disable-multilib -with-float=soft --program-transform-name='s,^,arm--netbsdelf-eabi-,' --enable-languages='c c++ objc' --prefix=/root/netbsd/obj/tooldir.NetBSD-9.0-amd64 --disable-shared
Thread model: posix
gcc version 7.4.0 (NetBSD nb3 20190319)
configure:3765: $? = 0
configure:3754: arm--netbsdelf-eabi-gcc -V >&5
arm--netbsdelf-eabi-gcc: error: unrecognized command line option '-V'
arm--netbsdelf-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3765: $? = 1
configure:3754: arm--netbsdelf-eabi-gcc -qversion >&5
arm--netbsdelf-eabi-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
arm--netbsdelf-eabi-gcc: fatal error: no input files
compilation terminated.
configure:3765: $? = 1
configure:3785: checking whether the C compiler works
configure:3807: arm--netbsdelf-eabi-gcc -static-libgcc -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include -DDEFAULT_PATH_VALUE=""/sbin:/usr/sbin:/usr/bin:/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin"" -I/usr/include -z muldefs --sysroot=/root/netbsd/obj/destdir.evbarm -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib conftest.c >&5
configure:3811: $? = 0
configure:3859: result: yes
configure:3862: checking for C compiler default output file name
configure:3864: result: a.out
configure:3870: checking for suffix of executables
configure:3877: arm--netbsdelf-eabi-gcc -o conftest -static-libgcc -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include -DDEFAULT_PATH_VALUE=""/sbin:/usr/sbin:/usr/bin:/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin"" -I/usr/include -z muldefs --sysroot=/root/netbsd/obj/destdir.evbarm -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib conftest.c >&5
configure:3881: $? = 0
configure:3903: result:
configure:3925: checking whether we are cross compiling
configure:3933: arm--netbsdelf-eabi-gcc -o conftest -static-libgcc -fPIC -D_FORTIFY_SOURCE=2 -I/usr/include -DDEFAULT_PATH_VALUE=""/sbin:/usr/sbin:/usr/bin:/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin"" -I/usr/include -z muldefs --sysroot=/root/netbsd/obj/destdir.evbarm -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib conftest.c >&5
configure:3937: $? = 0
configure:3944: ./conftest
eval: Cannot execute ELF binary ./conftest
configure:3948: $? = 2
configure:3955: error: in /root/netbsd/pkgsrc/shells/bash/work.earmv5/bash-5.1': configure:3959: error: cannot run C compiled programs. If you meant to cross compile, use --host'.
See `config.log' for more details

@ghost
Copy link

ghost commented Jan 26, 2023

(net)bsd... it runs so smooth on old hardware...
unless you have to actually compile something for it it... using pkgsrc...
with the recent versions... on real hardware or in a virtual machine...
since the removed all old versions... and the new is definitely not backward compatible...
depending on (and now over time failed) backups... from @gchehab
and his expertise... to breath new life into this abandon't apple devices...

would it help to ask the hackernews community for help...???

mean it is green... if you breath life into these old devices... and there are a lot of them still around...

@ghost
Copy link

ghost commented Feb 3, 2023

@Tristan79 Try it... you could also try rossmann (https://www.youtube.com/@rossmanngroup) if he could do a shout out...
Definitely a shame that perfectly good hardware with (for most people) with good enough wifi speed go to waste. (I do not have any 'ax' devices, all (expect one early adaptor) people I know do not have 'ax' devices :) And for normal home use unless you have an very extended family and everyone is streaming in 8k ;-) ... I do not think I will upgrade the next decennia... even 'ac' instead of 'n' is just overkill... for 99% of the traffic ;-)

@gchehab I have, a couple of AirPort Extreme 802.11ac, a 4th gen time capsule and a couple of airport express (the newest and the previous one) so I can help test and compile stuff on the device itself. Just let me know.

@gchehab
Copy link
Collaborator

gchehab commented Feb 4, 2023

Hey guys,

Yes, given a fresh kernel, netbsd or linux, it would be a good device, the hardware of the newer gens are not too shabby.

It is unfortunate that Apple, when discontinued the devices, did not even care to release the firmware stuff as open source, as it retired from this business altogether... Perhaps a petition, but it would take a good community...

Anyway, the devices are still high priced in Brazil, a used one will sell for up to a few hundred dollars. It is insane, as the devices are a decade old...

I am resuming my work, next week, I will try a more conservative approach, instead of a newer netbsd version, I will try to stick to the closest Apple used, hopefully, it will have less trouble.

@raghu-mp, the -D_FORTIFY_SOURCE=2 flag is troublesome, only supported on newer gcc versions, to remove it set the environment variable PKGSRC_USE_FORTIFY.

Bellow, is the latest environment I am using to try to bootstrap pkgsrc, still there is something missing... But it might get you further -- remember to weak the ARCH and MACHINE_ARCH to your hardware. I know that part of my problem is they do not match exactly the netbsd user tools I compiled... I dont remember how I fixed this a few years back, so I will start over, once again:

export ARCH=earmv6
export MACHINE_ARCH=earmv6
#export MACHINE_GNU_ARCH=arm
#export LANG="en_US.UTF-8"
#export LC_CTYPE="en_US.UTF-8"
export LC_ALL="en_US.UTF=8"

export CC1=/Volumes/dk2/root/usr/libexec/cc1
export C_INCLUDE_PATH=/Volumes/dk2/root/usr/include/
export LIBRARY_PATH=/Volumes/dk2/root/lib:/Volumes/dk2/root/usr/lib

export CFLAGS="-mno-unaligned-access -fno-use-linker-plugin"
export CPPFLAGS=
export CXXFLAGS="-mno-unaligned-access -fno-use-linker-plugin"
export CPUFLAGS=
export LDFLAGS="-fno-use-linker-plugin -zmuldefs -static"
export LDSTATIC='-static'

export ALLOW_VULNERABLE_PACKAGES=no
export CHECK_FILES=no

export MKSOFTFLOAT=yes
export PKG_DEBUG_LEVEL=1
export PKG_DEFAULT_OPTIONS="-static"
export PKGSRC_USE_FORTIFY=weak
export PKGSRC_USE_MKPIE=no
export PKGSRC_USE_MKREPRO=no
export PKGSRC_USE_RELRO=partial
export PKGSRC_USE_SSP=yes
export PKGSRC_USE_STACK_CHECK=no
export MAKE_JOBS=2
export TZ=:/etc/localtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants