Aclocal failing to find pkg.m4

When you don’t have a system wide pkgconfig/aclocal for example because it’s a shared server with a module loadable package system,
then typical symptom during the execution of ./configure
that certain macros are not found or reported to cause syntax error because they are not expanded.

Example for “Command not found”:

# configure script:
   3890     as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
   3891   fi
   3892 fi
   3893
   3894 PKG_PROG_PKG_CONFIG
   3895
   3896
   3897 if test "x$PY_PREFIX" = x; then :

Here the macro PKG_PROG_PKG_CONFIG, should have been resolved at this point to something else.

# execution output:
./configure: line 3894: PKG_PROG_PKG_CONFIG: command not found

Example for syntax error because not expanded:

# configure script:
17090 PKG_CHECK_MODULES(QT, QtCore >= 4.3, QtNetwork >= 4.3, have_qt=yes, have_qt=no)

This should have been expanded too to something like “… ($PKG_CONFIG –exists –print-errors “QtCore >= 4.3, QtNetwork >= 4.3″) … ”

# execution output:
./configure: line 17090: syntax error near unexpected token `QT,'
./configure: line 17090: `    PKG_CHECK_MODULES(QT, QtCore >= 4.3, QtNetwork >= 4.3, have_qt=yes, have_qt=no)'

Solution, as mentioned here:

export ACLOCAL_PATH=/app/vbuild/SLED11-x86_64/pkgconfig/0.25/share/aclocal/
# This is where the pkg.m4 can be found:
ls -lah /app/vbuild/SLED11-x86_64/pkgconfig/0.25/share/aclocal/pkg.m4

Alternatively if further macros are missing then consider setting AL_OPTS, as suggested here:

AL_OPTS=-I/path/where/you/installed/the/stuff/share/aclocal

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>mavenUberJarWithDependencies</artifactId>
<packaging>jar</packaging>
<version>0.1.0</version>
<properties>
   <java.version>1.8</java.version>
</properties>
<!-- alternatively
<configuration>
 <source>1.8</source>
 <target>1.8</target>
</configuration>
-->
<dependencies>
  <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.4</version>
  </dependency>
</dependencies>
<build>
  <plugins>
    <plugin>
      <!-- Collect all the dependencies in lib/ for inclusion in über JAR -->
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <executions>
          <execution>
              <id>copy-dependencies</id>
              <phase>prepare-package</phase>
              <goals>
                  <goal>copy-dependencies</goal>
              </goals>
              <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                  <overWriteReleases>false</overWriteReleases>
                  <overWriteSnapshots>false</overWriteSnapshots>
                  <overWriteIfNewer>true</overWriteIfNewer>
              </configuration>
          </execution>
      </executions>
    </plugin>
    <plugin>
      <!-- Build an executable JAR -->
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>3.0.2</version>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>
            <!-- Make the collected dependencies available in the lib dir >
            <classpathPrefix>lib/</classpathPrefix>
            <mainClass>Test</mainClass>
          </manifest>
        </archive>
      </configuration>
    </plugin>
    <plugin>
      <!-- Build an executable JAR -->
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
      <executions>
        <execution>
          <id>default-testCompile</id>
          <phase>test-compile</phase>
          <goals>
             <goal>testCompile</goal>
          </goals>
          <configuration>
            <compilerVersion>${java.version}</compilerVersion>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </execution>
        <execution>
          <id>default-compile</id>
          <phase>compile</phase>
          <goals>
            <goal>compile</goal>
          </goals>
          <configuration>
            <compilerVersion>${java.version}</compilerVersion>
            <source>${java.version}</source>
            <target>${java.version}</target>
          </configuration>
        </execution>
      </executions>
      <configuration>
         <compilerVersion>${java.version}</compilerVersion>
         <source>${java.version}</source>
         <target>${java.version}</target>
      </configuration>
    </plugin>
  </plugins>
</build>
</project>

VMware 12.1.1 and 4.7.0-1

VMware 12.1.1 and 4.7.0-1 [openSUSE Tumbleweed (20160730) (x86_64)]:

1. VMware Virtual ethernet module:

/usr/lib/vmware/modules/source/vmnet-only/netif.c: In function ‘VNetNetifStartXmit’:
/usr/lib/vmware/modules/source/vmnet-only/netif.c:468:7: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean ‘mem_start’?
    dev->trans_start = jiffies;
       ^~

Robert Gadsdon’s solution was to remove that line entirely:
http://rglinuxtech.com/?p=1746

Also virtualbox developers did basically the same:
https://www.virtualbox.org/ticket/15444
https://www.virtualbox.org/changeset/61429/vbox

VMware and 4.6.1-1

Today while trying to compile kernel modules for VMware Workstation 12.1.1 + 4.6.1-1-default [openSUSE Tumbleweed (20160422) (x86_64)] I got two compilation errors:

1. VMware Virtual ethernet module:

/usr/lib/vmware/modules/source/vmnet-only/userif.c:116:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, addr,
             ^

2. VMware Virtual machine monitor:

/usr/lib/vmware/modules/source/vmmon-only/linux/hostif.c:1165:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
             ^

VMware Community member alexsandr1981 has the correct answer in the discussion, which is to replace every get_user_pages call with get_user_pages_remote calls.
After replacing the original tar, the compilation succeeded for me.

Python generator functions simulated in C++ with Boost Coroutines

I recently looked into a somewhat older Open-STD paper here about “Resumable Functions v.2”, which suggests resumable lambdas as generator expressions:

C++ does not need generator expressions… it already has them!

The paper compares a Python generator expression with a proposed C++ resumable lambda.

Generator expressions are basically additional shortcut to build generators, an alternative to generator functions.

And then I started thinking about generator functions.
So how would a standard C++14 && Boost Coroutine based solution compare to Python generator functions?

For the sake of comparison I took a nice Python generator example from here:

def fibonacci(max):
    a, b = 0, 1
    while a < max:
        yield a
        a, b = b, a + b

for n in fibonacci(500):
    print(n, end=' ')

Google link for tutorialspoint’s execute_python3_online
Direct link to the same thing

Then first I implemented the same functionality in C++ (with Boost Asymmetric Coroutine), having the exact same a while loop and the exact same LOC value:

auto fibonacci=[](ac::push_type& yield, int max){
        int a=0, b=1, c;
        while(a<max)
            yield(a),
            c=a+b, a=b, b=c; };

for(ac::pull_type f(std::bind(fibonacci,_1,500)); f; f())
        std::cout<<f.get()<<' ';

Then as a cosmetic change, I switched to a for loop, scoped variables, and one less (172 vs 171) non-whitespace character 🙂
Which is a non-argument, only an interesting fact:

'while'(5) => 'for'(3) + ';'(1)

So here it is:

auto fibonacci=[](ac::push_type& yield, int max){
            for(int a=0, b=1, c;
                a<max;
                yield(a), c=a+b, a=b, b=c); };

for(ac::pull_type f(std::bind(fibonacci,_1,500)); f; f())
        std::cout<<f.get()<<' ';

And here is the complete C++ code:

#include <iostream>
#include <functional>
#include <boost/coroutine/asymmetric_coroutine.hpp>

using ac = boost::coroutines::asymmetric_coroutine<int>;
using namespace std::placeholders;

int main()
{
    auto fibonacci=[](ac::push_type& yield, int max){
                for(int a=0, b=1, c;
                    a<max;
                    yield(a), c=a+b, a=b, b=c); };

    for(ac::pull_type f(std::bind(fibonacci,_1,500)); f; f())
            std::cout<<f.get()<<' ';
}

If you feel like taking this code to a spin, than check out the CoLiRu archive.

VMware and linux 4.0.5-3

Today on openSUSE Tumbleweed, the usual module recompilation with

vmware-modconfig --console --install-all

failed, with

Unable to parse gcc version

This is because the guys releasing Tumbleweed started compiling everything with gcc 5, even the kernel, which made the vmware-modconfig unhappy:

workstation:/tmp # uname -a
Linux workstation 4.0.5-3-desktop #1 SMP PREEMPT Thu Jun 18 15:11:06 UTC 2015 (56152db) x86_64 x86_64 x86_64 GNU/Linux
workstation:/tmp # cat /etc/os-release
NAME=openSUSE
VERSION="20150702 (Tumbleweed)"
VERSION_ID="20150702"
PRETTY_NAME="openSUSE 20150702 (Tumbleweed) (x86_64)"
ID=opensuse
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:opensuse:20150702"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://opensuse.org/"
ID_LIKE="suse"
workstation:/tmp # vmware --version
VMware Workstation 11.1.0 build-2496824
workstation:/tmp # tail -n 6 /tmp/vmware-root/vmware-14006.log
2015-07-07T22:43:30.926+02:00| modconfig| I120: Trying to find a suitable PBM set for kernel "4.0.5-3-desktop".
2015-07-07T22:43:30.926+02:00| modconfig| I120: No matching PBM set was found for kernel "4.0.5-3-desktop".
2015-07-07T22:43:30.926+02:00| modconfig| I120: Found compiler at "/usr/bin/gcc"
2015-07-07T22:43:30.929+02:00| modconfig| I120: Got gcc version "5".
2015-07-07T22:43:30.930+02:00| modconfig| I120: Unable to parse gcc version
2015-07-07T22:43:30.932+02:00| modconfig| I120: We are now shutdown. Ready to die!
workstation:/tmp #

Here is a remedy from rainerklier posted in this vmware community link.

cd /usr/lib/vmware/modules/source
tar -xf vmnet.tar
cd vmnet-only
make
cd ..
tar -xf vmmon.tar
cd vmmon-only
make
cd ..
cp vmmon.o /lib/modules/`uname -r`/misc/vmmon.ko
cp vmnet.o /lib/modules/`uname -r`/misc/vmnet.ko
depmod -a
/etc/init.d/vmware restart

Linux, Flash and DRM content playback

Currently Chromium’s and Chrome’s Pepper Plugin Api (PPAPI) flash doesn’t have DRM support and it looks like a “won’t fix”, so if you want to play DRM-enabled flash content on Linux natively, (and by that I mean without running Windows plugins in Wine like Pipelight does) then you are left with the ancient abandoned Linux Flash plugin.
Since it’s abandoned, it depends on ancient libhal libs, that your current distro probably doesn’t provide, or at a cost of dependency hell.

But, Chris Horler has this project on github, which is a very lightweight, (no dependency hell)

libhal stub library forwarding to UDisks

, basically the library that flashplayer depends on when dealing with DRM -enabled media.

If you don’t want to compile it for yourself, then for openSUSE the usual suspect is the
the libhal1-flash search term on software.opensuse.org

Probably it’s just me, but for Ubuntu the PPA search is hardly usable. Anyhow for my Precise machine I used flash-hal-helper from Chris Coulson’s PPA

Oh and in case you don’t know how to test ( or you don’t even know what I am talking about), then here is _THE_ test case, quote from Chris Horler’s site:

Enter this into your browser:
http://drmtest2.adobe.com:8080/SVP/SampleVideoPlayer_FP.html
Enter this into the form:
http://drmtest2.adobe.com:8080/Content/anonymous.f4v
Press play.