oxen-io/oxen-core

`make: *** [Makefile:160: all] Error 2` when trying to compile static release build

martin-braun opened this issue · 1 comments

Describe the bug
When trying to compile a static release build with cd build && cmake .. -DBUILD_STATIC_DEPS=ON -DARCH=x86-64 -DCMAKE_BUILD_TYPE=Release the generated build/Makefile fails with make: *** [Makefile:160: all] Error 2. I have a bunch of different causes in the Makefile2 while compiling with make -j$(nproc) flag, depending on which package fails first. Without the -j flag (single threaded) the first issue is:

checking for gperf... no
configure: error: *** gperf not found
make[2]: *** [CMakeFiles/eudev_external.dir/build.make:128: static-deps-sources/src/eudev_external-stamp/eudev_external-configure] Error 1
make[1]: *** [CMakeFiles/Makefile2:1375: CMakeFiles/eudev_external.dir/all] Error 2
make: *** [Makefile:160: all] Error 2

I went down the rabbit hole. Makefile2 fails in this one at:

# All Build rule for target.
CMakeFiles/eudev_external.dir/all:
	$(MAKE) $(MAKESILENT) -f CMakeFiles/eudev_external.dir/build.make CMakeFiles/eudev_external.dir/depend
	$(MAKE) $(MAKESILENT) -f CMakeFiles/eudev_external.dir/build.make CMakeFiles/eudev_external.dir/build
	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/marty/oxen-core/build/CMakeFiles --progress-num=44,45 "Built target eudev_external"
.PHONY : CMakeFiles/eudev_external.dir/all

which is one of many build instructions that fail in this file. It precisely fails in CMakeFiles/eudev_external.dir/build.make:128 which is this generated line in my configuration:

cd /home/marty/oxen-core/build/static-deps-sources/src/eudev_external && autoreconf -ivf && ./configure --prefix=/home/marty/oxen-core/build/static-deps --disable-shared --disable-introspection --disable-programs --disable-manpages --disable-hwdb --with-pic CC=/usr/bin/cc "CFLAGS=-O2 -flto"

If I run this manually in my terminal, I get:

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4 ${ACLOCAL_FLAGS}
autom4te: need GNU m4 1.4 or later: /usr/bin/m4
aclocal: error: /usr/bin/autom4te failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

But my /usr/bin/m4 --version is m4 (GNU M4) 1.4.18. This is a fresh Debian install.

To Reproduce

git clone --recursive https://github.com/oxen-io/oxen-core.git
cd oxen-core
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DBUILD_STATIC_DEPS=ON -DARCH=x86-64 -DCMAKE_BUILD_TYPE=Release
make

Expected behaviour
It should build.

Current Behaviour
See description above.

Screenshots or Logs
See description above.

Additional Information (please complete the following information):

       _,met$$$$$gg.
    ,g$$$$$$$$$$$$$$$P.
  ,g$$P"     """Y$$.".
 ,$$P'              `$$$.     marty@debian
',$$P       ,ggs.     `$$b:   ------------
`d$$'     ,$P"'   .    $$$    OS: Debian GNU/Linux 11 (bullseye) x86
 $$P      d$'     ,    $$P    Host: Parallels Virtual Platform None
 $$:      $$.   -    ,d$$'    Kernel: 5.10.0-25-amd64
 $$;      Y$b._   _,d$P'      Uptime: 2 days, 58 mins
 Y$$.    `.`"Y$$$$P"'         Packages: 752 (dpkg)
 `$$b      "-.__              Shell: bash 5.1.4
  `Y$$                        Resolution: 1024x768
   `Y$$.                      Terminal: /dev/pts/3
     `$$b.                    CPU: Intel i9-9980HK (4) @ 2.400GHz
       `Y$$b.                 GPU: 01:00.0 Red Hat, Inc. Virtio GPU
          `"Y$b._             Memory: 249MiB / 7936MiB
              `"""

I believe the problematic build steps are triggered by the fact that gperf cannot be found. I did apt install gperf and now the issue is not happening anymore. gperf should be added as an optional dependency in the README.md, perhaps with a footnote explaining that it is necessary for statically bound release builds? @jagerman