GSoC 2020: [rtems/rsb]: Error while adding ptp support. This time building for xilinx_zynq_a9_qemu

Gedare Bloom gedare at rtems.org
Sun Jun 7 20:30:41 UTC 2020


On Sat, Jun 6, 2020 at 10:50 PM junkes <junkes at fhi-berlin.mpg.de> wrote:
>
> This is an unusually long text for the mailing list. I tried to write a kind
> of tutorial using an example for a GSOC student. I'm looking forward to the
> comments from the pros and can write it down completely.
>
> Hello, Mritunjay
>
> if I understood it correctly, one idea of the rtems source builder is to make existing
> software packages usable for RTEMS. Most existing software packages do not work without
> changes in the RTEMS environment. You have already noticed this with ptpd ;-)
>
> The most common auto-tools and configure have trouble making the correct
> assumptions for the rtems environment. Here you have to intervene. This can
> be done with the builder-cfg files.
>
> This is a bit of hard work and you have to approach it with small steps.
> You also have to use not so clean tricks in different places. When you have
> achieved the integration you can/must then try to optimize it so that it becomes
> generally valid.
>
> That's my policy. Maybe the others here in the maillist have more ideas, also for me.
>
> I have now tried to implement what I mean using a similar example (openntp).
> Unfortunately, I haven't finished yet, but I hope to clear a few hurdles for you.
>
> I was doing some digging around and I came across this:
> https://github.com/openntpd-portable/openntpd-portable
>
> Here I was then confronted with the same problems as you with autoreconf etc. Here it
> didn't work, just run autoreconf twice and generate a tar-file for installation like
> I did with the ptpd from github.
> Then I found this: https://artfiles.org/openbsd/OpenNTPD/openntpd-6.2p3.tar.gz
>
> Now I have made a "standard" config file for rsb:
>
> #
> # OpenNTPd 6.2p3 Version 1.
> #
> # This configuration file configure's, make's and install's OpenNTPd.
> #
>
> %if %{release} == %{nil}
> %define release 1
> %endif
>
> Name:      openntpd-%{openntpd_version}-%{_host}-%{release}
> Summary:   NTP is the Network Time Protocol.
> Version:   %{openntpd_version}
> Release:   %{release}
> URL:       https://github.com/openntpd-portable
>
> #
> # NTP Source
> #
> %source set openntpd https://artfiles.org/openbsd/OpenNTPD/openntpd-%{openntpd_version}.tar.gz
> %hash sha512 openntpd-%{openntpd_version}.tar.gz 56a04bfd8b161b365607673ac80086ff53ae943938fa49bf52edbc541432eca30730a46a4af581fe26ce3bbceb144cb25982a38959b7a3f9304c727fe60f9
> f50
>
> #
> # Prepare the source code.
> #
> %prep
> build_top=$(pwd)
>
>
>  source_dir_openntpd="openntpd-%{openntpd_version}"
>  %source setup openntpd -q -n openntpd-%{openntpd_version}
>  %patch setup openntpd -p1
>
>  cd ${build_top}
>
> %build
>  build_top=$(pwd)
>
>  %{build_directory}
>
>  mkdir -p ${build_dir}
>  cd ${build_dir}
>
>  %{host_build_flags}
>
>  ../${source_dir_openntpd}/configure \
>    --host=%{_host} \
>    --prefix=%{_prefix} \
>    --bindir=%{_bindir} \
>    --exec_prefix=%{_exec_prefix} \
>    --includedir=%{_includedir} \
>    --libdir=%{_libdir} \
>    --libexecdir=%{_libexecdir} \
>    --mandir=%{_mandir} \
>    --infodir=%{_infodir} \
>    --datadir=%{_datadir} \
>    --disable-shared \
>    --enable-static \
>    --with-gnu-ld \
>    --disable-https-constraint
>
>  %{__make} all
>
>  cd ${build_top}
>
> %install
>  build_top=$(pwd)
>
>  %{__rmdir} $SB_BUILD_ROOT
>
> cd ${build_dir}
>  %{__make} DESTDIR=$SB_BUILD_ROOT install
>  cd ${build_top}
>
>
> Then I "executed" that.
> [h1 at earth rtems (master *)]$ ../source-builder/sb-set-builder --log log.ntpd.txt --with-rtems-bsp=xilinx_zynq_a9_qemu --host=arm-rtems5 --prefix /home/h1/GSOC/RTEMS/5.0.0-m20
> 03 net/ntpd
> RTEMS Source Builder - Set Builder, 5 (26e335ca159e modified)
> Build Set: net/ntpd
> config: net/openntpd-6.2p3-1.cfg
> package: openntpd-6.2p3-arm-rtems5-1
> building: openntpd-6.2p3-arm-rtems5-1
> error: building openntpd-6.2p3-arm-rtems5-1
> Build FAILED
>  See error report: rsb-report-openntpd-6.2p3-arm-rtems5-1.txt
> error: building openntpd-6.2p3-arm-rtems5-1
> Build Set: Time 0:00:16.036623
> Build FAILED
>
> Error! I looked at that one:
> [h1 at earth rtems (master *)]$ tail -20 rsb-report-openntpd-6.2p3-arm-rtems5-1.txt
>  CC       setproctitle.lo
>  CC       bsd-setresgid.lo
>  CC       bsd-setresuid.lo
>  CCLD     libcompat.la
> arm-rtems5-ar: `u' modifier ignored since `D' is the default (see `U')
>  CCLD     libcompatnoopt.la
> arm-rtems5-ar: `u' modifier ignored since `D' is the default (see `U')
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/compat'
> Making all in src
> make[1]: Entering directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
>  CC       ntpd-client.o
> arm-rtems5-gcc: fatal error: /home/h1/GSOC/RTEMS/5.0.0-m2003/arm-rtems5/xilinx_zynq_a9_qemu/lib/bsp_specs: attempt to rename spec 'endfile' to already defined spec 'old_endfi
> le'
> compilation terminated.
> Makefile:526: recipe for target 'ntpd-client.o' failed
> make[1]: *** [ntpd-client.o] Error 1
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
> Makefile:401: recipe for target 'all-recursive' failed
> make: *** [all-recursive] Error 1
> shell cmd failed: /bin/sh -ex  /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/do-build
>
> In build/openntpd-6.2p3-arm-rtems5-1/openntpd-6.2p3/src/Makefile.am I found that CFLAGS gets includes twice which leads to this error "attempt to rename..."
> ...
> ntpd_CFLAGS = $(CFLAGS)
> ntpd_CFLAGS += -DSYSCONFDIR=\"$(sysconfdir)\"
> ntpd_CFLAGS += -DLOCALSTATEDIR=\"$(localstatedir)\"
> ...
>
> Then I changed the cfg-file:
>
> ...
> %{host_build_flags}
>
> # src/Makefile.am includes CFLAGS twice?
> # this leads to : bsp_specs: attempt to rename spec 'endfile' to already defined spec 'old_endfile'
> #
>  sed -i 's/ntpd_CFLAGS = $(CFLAGS)/ntpd_CFLAGS = $(CFLAGS)/g' ../${source_dir_openntpd}/src/Makefile.am
>  sed -i 's/ntpd_CFLAGS += -DSYSCONFDIR=/ntpd_CFLAGS = -DSYSCONFDIR=/g' ../${source_dir_openntpd}/src/Makefile.am
>
>  ../${source_dir_openntpd}/configure \
>    --host=%{_host} \
> ...
>
> Now I've come a long way, but
>
> [h1 at earth rtems (master *)]$ tail -20 rsb-report-openntpd-6.2p3-arm-rtems5-1.txt
>       asnprintf
>  CC       ntpd-ntp.o
>  CC       ntpd-ntp_dns.o
> ../../openntpd-6.2p3/src/ntp_dns.c: In function 'ntp_dns':
> ../../openntpd-6.2p3/src/ntp_dns.c:58:6: warning: implicit declaration of function 'setpriority'; did you mean 'setprotoent'? [-Wimplicit-function-declaration]
>  if (setpriority(PRIO_PROCESS, 0, 0) == -1)
>      ^~~~~~~~~~~
>      setprotoent
> ../../openntpd-6.2p3/src/ntp_dns.c:58:18: error: 'PRIO_PROCESS' undeclared (first use in this function); did you mean 'EINPROGRESS'?
>  if (setpriority(PRIO_PROCESS, 0, 0) == -1)
>                  ^~~~~~~~~~~~
>                  EINPROGRESS
> ../../openntpd-6.2p3/src/ntp_dns.c:58:18: note: each undeclared identifier is reported only once for each function it appears in
> Makefile:624: recipe for target 'ntpd-ntp_dns.o' failed
> make[1]: *** [ntpd-ntp_dns.o] Error 1
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
> make: *** [all-recursive] Error 1
> Makefile:401: recipe for target 'all-recursive' failed
> shell cmd failed: /bin/sh -ex  /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/do-build
>
> Now a little bit of searching...
>
> Adding "#include <rtems/bsd/sys/resource.h>" solves the problem.
>
> But the next one arises:
>
> make[1]: Entering directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
>  CC       ntpd-ntpd.o
>  CC       ntpd-parse.o
> parse.y: In function 'yyerror':
> parse.y:473:6: warning: implicit declaration of function 'vasprintf'; did you mean 'vasnprintf'? [-Wimplicit-function-declaration]
> parse.y: In function 'yylex':
> parse.y:686:22: warning: implicit declaration of function 'strtonum'; did you mean 'strtoul'? [-Wimplicit-function-declaration]
>  CC       ntpd-fake-sensors.o
>  CC       ntpd-server.o
> ../../openntpd-6.2p3/src/server.c: In function 'setup_listeners':
> ../../openntpd-6.2p3/src/server.c:65:21: error: 'struct if_data' has no member named 'ifi_rdomain'; did you mean 'ifi_addrlen'?
>      rdomain = ifd->ifi_rdomain;
>                     ^~~~~~~~~~~
>                     ifi_addrlen
> Makefile:708: recipe for target 'ntpd-server.o' failed
>
> That looks a little more complicated. It uses an if_data structure that is probably only available in openbsd?
>
> But also here google helps ;-)
> Here I found a patch : https://github.com/freebsd/freebsd-ports/tree/master/net/openntpd/files
>
> [h1 at earth build-cxc (master *)]$ patch ../openntpd-6.2p3/src/server.c /tmp/openntp/openntpd-6.2p3/patch-src_server.c
>
> And it's gotten me this far:
>
> [h1 at earth build-cxc (master *)]$ make
> Making all in include
> make[1]: Entering directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/include'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/include'
> Making all in compat
> make[1]: Entering directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/compat'
> make[1]: Nothing to be done for 'all'.
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/compat'
> Making all in src
> make[1]: Entering directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
>  CC       ntpd-server.o
>  CC       ntpd-util.o
>  CCLD     ntpd
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntp_dns.o: in function `ntp_dns':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntp_dns.c:59: undefined reference to `setpriority'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `main':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:243: undefined reference to `setpriority'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/b
> uild-cxc/src/../../openntpd-6.2p3/src/ntpd.c:251: undefined reference to `daemon'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/b
> uild-cxc/src/../../openntpd-6.2p3/src/ntpd.c:330: undefined reference to `daemon'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `dispatch_imsg':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:435: undefined reference to `daemon'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `ntpd_adjtime':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:487: undefined reference to `update_time_sy
> nc_status'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `ntpd_adjfreq':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:498: undefined reference to `adjfreq'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/b
> uild-cxc/src/../../openntpd-6.2p3/src/ntpd.c:522: undefined reference to `adjfreq'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `ntpd_settime':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:542: undefined reference to `settimeofday'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: ntpd-ntpd.o: in function `readfreq':
> /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src/../../openntpd-6.2p3/src/ntpd.c:565: undefined reference to `adjfreq'
> /home/h1/GSOC/RTEMS/5.0.0-m2003/lib/gcc/arm-rtems5/7.5.0/../../../../arm-rtems5/bin/ld: /home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/b
> uild-cxc/src/../../openntpd-6.2p3/src/ntpd.c:574: undefined reference to `adjfreq'
> collect2: error: ld returned 1 exit status
> Makefile:476: recipe for target 'ntpd' failed
> make[1]: *** [ntpd] Error 1
> make[1]: Leaving directory '/home/h1/GSOC/RTEMS_DEV/rtems-source-builder/rtems/build/openntpd-6.2p3-arm-rtems5-1/build-cxc/src'
> Makefile:401: recipe for target 'all-recursive' failed
> make: *** [all-recursive] Error 1
>
> This is where I am now. From now on, it's gonna be exciting. Now it's all about anchoring the daemon process in RTEMS.
> But that is nice work now. I still have to do it.
>
> But I wanted to show you this step-by-step so you can get over the first hurdles.
> I hope this helps you and it was not too long.
> Heinz
>
>

This is in fact really great. This is similar to what I like to see
GSoC students putting in their blog posts (hint to GSoC Students). It
is often neglected for us to codify our thinking in words that can be
helpful for others struggling with similar problems.


More information about the devel mailing list