OpenVPN / openvpn3-linux

OpenVPN 3 Linux client
GNU Affero General Public License v3.0
554 stars 148 forks source link

syntax error near unexpected token `${datarootdir}/selinux/devel,' Ubuntu 20.04 #24

Closed farbodahm closed 3 years ago

farbodahm commented 3 years ago

Hi dear OpenVpn Team, I tried to build this project on my Xubuntu 20.04, but it failed when I ran: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/va And I should verify that autoconf-archive is installed too.

Here is the log:

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking how to create a pax tar archive... gnutar checking whether make supports nested variables... (cached) yes checking for g++... g++ checking whether the C++ compiler works... yes checking for C++ compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking whether make supports the include directive... yes (GNU style) checking dependency style of g++... gcc3 checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking dependency style of gcc... gcc3 checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes checking how to run the C preprocessor... gcc -E checking for ranlib... ranlib checking whether ln -s works... yes checking for a sed that does not truncate output... /usr/bin/sed checking whether make sets $(MAKE)... (cached) yes checking whether g++ supports C++11 features by default... yes checking whether g++ supports C++14 features by default... yes checking for a Python interpreter with version >= 3.5... python3 checking for python3... /usr/bin/python3 checking for python3 version... 3.8 checking for python3 platform... linux checking for python3 script directory... ${prefix}/lib/python3.8/site-packages checking for python3 extension module directory... ${exec_prefix}/lib/python3.8/site-packages checking for LIBLZ4... yes checking for LIBJSONCPP... yes checking for LIBGLIBGIO... yes checking for LIBUUID... yes checking for LIBCAPNG... yes checking for OPENSSL... yes configure: Using ASIO source directory: ./vendor/asio configure: Using OpenVPN 3 Core Library directory: ./openvpn3-core checking OpenVPN 3 Core Library version... 3.git:HEAD:5b15dbe9 configure: Using ovpn-dco source directory: ./ovpn-dco ./configure: line 7699: syntax error near unexpected token ${datarootdir}/selinux/devel,' ./configure: line 7699: AX_RECURSIVE_EVAL(${datarootdir}/selinux/devel, selinux_devel_path)'

dsommers commented 3 years ago

You are missing the autoconf-archive package.

# apt-get install build-essential git pkg-config autoconf autoconf-archive libglib2.0-dev libjsoncpp-dev uuid-dev liblz4-dev libcap-ng-dev libxml2-utils python3-minimal python3-dbus python3-docutils python3-jinja2 libxml2-utils libtinyxml2-dev

This should give you all the dependencies you need. If you also want to test out the --enable-dco feature (also requires a kernel module), you need to add libnl-3-dev libnl-genl-3-dev protobuf-compiler libprotobuf-dev as well (README.md will be updated accordingly before next release)

farbodahm commented 3 years ago

@dsommers Thanks for your answer, I have all these packages installed, but still can't build the project with the same problem.

sudo apt-get install build-essential git pkg-config autoconf autoconf-archive libglib2.0-dev libjsoncpp-dev uuid-dev liblz4-dev libcap-ng-dev libxml2-utils python3-minimal python3-dbus python3-docutils python3-jinja2 libxml2-utils libtinyxml2-dev Reading package lists... Done Building dependency tree
Reading state information... Done autoconf is already the newest version (2.69-11.1). build-essential is already the newest version (12.8ubuntu1). git is already the newest version (1:2.25.1-1ubuntu3). libcap-ng-dev is already the newest version (0.7.9-2.1build1). libjsoncpp-dev is already the newest version (1.7.4-3.1ubuntu2). liblz4-dev is already the newest version (1.9.2-2). libxml2-utils is already the newest version (2.9.10+dfsg-5). pkg-config is already the newest version (0.29.1-0ubuntu4). python3-dbus is already the newest version (1.2.16-1build1). python3-docutils is already the newest version (0.16+dfsg-2). python3-jinja2 is already the newest version (2.10.1-2). python3-minimal is already the newest version (3.8.2-0ubuntu2). autoconf-archive is already the newest version (20190106-2.1ubuntu1). libtinyxml2-dev is already the newest version (7.0.0+dfsg-1build1). libglib2.0-dev is already the newest version (2.64.3-1~ubuntu20.04.1). uuid-dev is already the newest version (2.34-0.1ubuntu9.1). 0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.

dsommers commented 3 years ago

That's really odd. Do you have this file: /usr/share/aclocal/ax_recursive_eval.m4? This is the file (from autoconf-archive) which defines the AX_RECURSIVE_EVAL m4 macro.

farbodahm commented 3 years ago

Yeah I have that, it contains these lines:

sudo cat /usr/share/aclocal/ax_recursive_eval.m4

AC_DEFUN([AX_RECURSIVE_EVAL], [_lcl_receval="$1" $2=(test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" _lcl_receval_old='' while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do _lcl_receval_old="[$]_lcl_receval" eval _lcl_receval="\"[$]_lcl_receval\"" done echo "[$]_lcl_receval")])

dsommers commented 3 years ago

Can you try to re-run the ./bootstrap.sh script before running ./configure ? ... and then pastebin config.log.

farbodahm commented 3 years ago

Re-running ./bootstrap.sh solved the problem and ./configure completed successfully! I wanna to try to contribute on main C++ code, so, whenever I changed something should I re-run ./bootstrap.sh and ./configure or just make and make install would be enough?

farbodahm commented 3 years ago

Well, I have one more question too. Running make takes about 10 mins to run on my machine, do I need to run make every time that I make changes on main C++ code? (Because I want to start contributing on C++ part of project, I want to find an alternative way to run away from that long compile time :D)

dsommers commented 3 years ago

If you only change the source code (C++, Python), makeand make install should be enough. If you modify Makefile.am files, you might want to re-run ./configure if make fails. And if you modify configure.ac, you must re-run autoreconf (which bootstrap.sh runs).

To get an up-to-date version reference from the git commit (useful to ensure you really run the expected code), just do rm -f config-version.h before make. You can see the version reference with openvpn3 version and openvpn3-admin version --services.

And really cool that you want to contribute! Feel free to reach out on mailing lists (openpvn-devel@lists.sourceforge.net, sign up here: https://sourceforge.net/p/openvpn/mailman/) or reach out on IRC: #openvpn-devel @ FreeNode (details here: https://community.openvpn.net/openvpn/wiki/GettingHelp#Developersupport)

dsommers commented 3 years ago

Well, I have one more question too. Running make takes about 10 mins to run on my machine, do I need to run make every time that I make changes on main C++ code? (Because I want to start contributing on C++ part of project, I want to find an alternative way to run away from that long compile time :D)

You can shorten the build-time a bit by not compiling the various test programs with ./configure --disable-build-test-progs. But more importantly, if your computer has multiple CPU cores (grep -E ^processor /proc/cpuinfo) you can compile code in parallel. If the grep command gives you 4 lines, then you build with make -j4. But you need minimum 1GB per CPU core to build successfully, and the more RAM you have, the better and faster it builds.

dsommers commented 3 years ago

Just a word on the test-programs. Building them has the advantage of doing an API check. If these programs stops building, the API the failing program uses has changed somehow. And running them might be useful for debugging various specific issues.

farbodahm commented 3 years ago

Thanks for your great answers, I didn't know that make have a parallel computing! That's really interesting! I'm going to put my C++ readings in practice, I hope I can do helpful commits to Openvpn project :) Thanks!

dsommers commented 3 years ago

A few areas where you can quickly get going .... and doesn't require much C++ coding.

This would at least give you a good understanding of how OpenVPN 3 Linux works, which will probably help you understand where to fix issues in the C++ code.