FreeBSD: Gradle failure of PosixFileFunctions.chmod

When I was building my Java project with Gradle on FreeBSD 10.3/amd64, the gradlew failed.

$ ./gradlew build
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE

FAILURE: Build failed with an exception.

* What went wrong:

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


Total time: 3.733 secs

When I gave an -S option, I got:

:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE

FAILURE: Build failed with an exception.

* What went wrong:

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
java.lang.UnsatisfiedLinkError: net.rubygrapefruit.platform.internal.jni.PosixFi
        at net.rubygrapefruit.platform.internal.jni.PosixFileFunctions.chmod(Nat
ive Method)
        at net.rubygrapefruit.platform.internal.DefaultPosixFiles.setMode(Defaul
        at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(
        at org.gradle.api.internal.file.collections.MapFileTree$FileVisitDetailsImpl.getFile(
        at org.gradle.api.internal.file.AbstractFileTree$1.visitFile(
        at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree$1.visitFile(
        at org.gradle.api.internal.file.collections.MapFileTree$Visit.visit(
        at org.gradle.api.internal.file.collections.MapFileTree.visit(
        at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(
        at org.gradle.api.internal.file.AbstractFileTree$FilteredFileTree.visit(
        at org.gradle.api.internal.file.AbstractFileTree.getFiles(
        at org.gradle.api.internal.file.CompositeFileCollection.getFiles(
        at org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter.snapshot(
        at org.gradle.api.internal.changedetection.rules.TaskUpToDateState.(
        at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.getStates(
        at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.isUpToDate(
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(
        at org.gradle.execution.SelectedTaskExecutionAction.execute(
        at org.gradle.execution.DefaultBuildExecuter.execute(
        at org.gradle.execution.DefaultBuildExecuter.access$200(
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(
        at org.gradle.execution.DryRunBuildExecutionAction.execute(
        at org.gradle.execution.DefaultBuildExecuter.execute(
        at org.gradle.execution.DefaultBuildExecuter.execute(
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(
        at org.gradle.launcher.Main.doAction(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(
        at org.gradle.launcher.GradleMain.main(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at org.gradle.wrapper.BootstrapMainStarter.start(
        at org.gradle.wrapper.WrapperExecutor.execute(
        at org.gradle.wrapper.GradleWrapperMain.main(


Total time: 3.752 secs

Some people are saying that I need gcc. I fixed this problem by:

$ sudo pkg install gcc6

Android Studio: Cannot execute aidl

When I built my Android application on Ubuntu Linux 16.04 in my amd64 machine with Andriod Studio, the Android Studio caused an error. The Andrdoid Studio said:

Error:Execution failed for task ':foobarbazquux:compileDebugAidl'.
> java.lang.RuntimeException: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/home/tom/Android/Sdk/build-tools/21.1.2/aidl''

Because the Sdk/build-tools/21.1.2/aidl is a 32bit application.

$ file aidl
aidl: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.15, not stripped

This executable needs 32bit libraries to work. I installed these with:

$ sudo apt-get install lib32z1 lib32ncurses5 libbz2-1.0:i386 lib32stdc++6

After this, the aidl got usable.

$ ./aidl
INPUT required
       aidl --preprocess OUTPUT INPUT...

   -I<DIR>    search path for import statements.
   -d<FILE>   generate dependency file.
   -a         generate dependency file next to the output file with the name based on the input file.
   -p<FILE>   file created by --preprocess to import.
   -o<FOLDER> base output folder for generated files.
   -b         fail when trying to compile a parcelable.

   An aidl interface file.

   The generated interface files.
   If omitted and the -o option is not used, the input filename is used, with the .aidl extension changed to a .java extension.
   If the -o option is used, the generated files will be placed in the base output folder, under their package folder

FreeBSD: missing /usr/local/sbin/pkg

I have installed FreeBSD 10.3/amd64 to my machine. The new significant feature of FreeBSD is pkg.

pkg initialized itself at first time of executing. This process must give me /usr/local/sbin/pkg, but I did not get. What I had was only /usr/local/sbin/pkg-static.

I fixed this problem with

# pkg-static upgrade -f pkg

cLayz 1/6 のの (Nono)


のの (Nono) is a character in ぽぽたん (Popotan). Unboxing review of this kit is in my blog.

I took some photos of the legs before assembling.

The skin color is Pale Orange over Carrot Orange of 美少女フィギュア・フレッシュ セット (Cutie Girls Figure Fresh Color Set). 袴 (hakama, the red pant) is painted with Mr. Color 79 Shine Red. The blue of the hair is mixed of Mr. Color 1 White and Mr. Color 110 Character Blue. I painted the white cloth with Mr. Color 107 Character White over a layer of Smalt Blue in Mr. Color みるきぃぱすてるカラーセット ブルーver. (Milky Pastel Color Set Blue Ver.).

Simple daemon example using kqueue

The below code is a simple daemon. This daemon listens the port of number 4,226. When a client connects to this, this daemon disconnects immediately. This daemon stops for SIGTERM. This daemon works on FreeBSD.

I wrote this daemon to investigate other software, but I found that this is helpful to start writing a new daemon using kqueue(2).

This code is also available in Gist.

 * This is public domain.
#include <sys/types.h>
#include <sys/event.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
#include <libgen.h>
#include <netinet/in.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>

static void
die(const char *fmt, ...)
	va_list ap;
	int errnum;
	char buf[8192], buf2[8192];

	errnum = errno;

	va_start(ap, fmt);
	vsnprintf(buf, sizeof(buf), fmt, ap);
	snprintf(buf2, sizeof(buf2), "%s: %s", buf, strerror(errnum));

	fputs(buf2, stderr);
	syslog(LOG_ERR, "%s", buf2);


#define	array_sizeof(a)	(sizeof((a)) / sizeof((a)[0]))
#define	PORT		4226

main(int argc, const char *argv[])
	struct sockaddr_storage addr;
	struct sockaddr_in *paddr;
	struct kevent changelist[2], eventlist[2];
	sigset_t set;
	uintptr_t ident;
	int fd, i, kq, level, nchanges, nev, nevents, optname, optval, sock;
	u_short flags;
	char buf[256];

	strncpy(buf, argv[0], sizeof(buf));
	openlog(basename(buf), LOG_PID, LOG_DAEMON);

	sock = socket(PF_INET, SOCK_STREAM, 0);
	if (sock == -1)
		die("cannot socket(2)");
	level = SOL_SOCKET;
	optname = SO_REUSEADDR;
	optval = 1;
	if (setsockopt(sock, level, optname, &optval, sizeof(optval)) == -1)
		die("cannot setsockopt(2)");
	paddr = (struct sockaddr_in *)&addr;
	paddr->sin_len = sizeof(*paddr);
	paddr->sin_family = AF_INET;
	paddr->sin_port = htons(PORT);
	paddr->sin_addr.s_addr = INADDR_ANY;
	if (bind(sock, (struct sockaddr *)paddr, paddr->sin_len) == -1)
		die("cannot bind(2)");
	if (listen(sock, 0) == -1)
		die("cannot listen(2)");

	if (daemon(1, 0) == -1)
		die("cannot daemon(3)");
	syslog(LOG_INFO, "started");

	kq = kqueue();
	if (kq == -1)
		die("cannot kqueue(2)");
	flags = EV_ADD | EV_ENABLE;
	EV_SET(&changelist[0], sock, EVFILT_READ, flags, 0, 0, NULL);
	EV_SET(&changelist[1], SIGTERM, EVFILT_SIGNAL, flags, 0, 0, NULL);
	nchanges = array_sizeof(changelist);
	if (kevent(kq, changelist, nchanges, NULL, 0, NULL) == -1)
		die("cannot kevent(2)");

	if (sigemptyset(&set) == -1)
		die("cannot sigemptyset(3)");
	if (sigaddset(&set, SIGTERM) == -1)
		die("cannot sigaddset(3)");
	if (sigprocmask(SIG_BLOCK, &set, NULL) == -1)
		die("cannot sigprocmask(2)");

	nevents = array_sizeof(eventlist);
	while (0 < (nev = kevent(kq, NULL, 0, eventlist, nevents, NULL)))
		for (i = 0; i < nev; i++)
			switch (eventlist[i].filter) {
			case EVFILT_READ:
				if ((fd = accept(sock, NULL, 0)) == -1)
					die("cannot accept(2)");
				syslog(LOG_INFO, "connected");
				if (close(fd) == -1)
					die("cannot close(2)");
				goto exit;

	syslog(LOG_INFO, "exit");

	return (0);

Bandai 1/144 HGUC Ball


I built a ball with metallic paints.

This kit has some ABS parts. I coated them as a first layer with the primer of Tamiya. And I painted it with

  • Mr. Color 8, silver (for the body)
  • Mr. Color 75, metallic red (for the red parts)
  • Mr. Color 28, steel (for the canon)

A build custom GP base is applicable to this. The manual is saying that you can also use an Action Base 2.