AC_CONFIG_FILES not generating Makefiles - makefile

I'm writing an app in Vala with support to plugins. The app has the following directory structure:
data/
[data files]
m4/
my_project.m4
plugins/
example/
example.plugin.in
example-plugin.vala
Makefile.am
po/
src/
[source files]
The file "my_project.m4" dinamically adds plugin dirs with a simple defined function called MYPROJ_ADD_PLUGIN, and it works fine as I tested it with some other projects. Basically, it calls:
AC_CONFIG_FILES([plugins/example/Makefile])
[...]
AC_CONFIG_FILES([plugins/example/example.plugin])
The problem is, when I try to configure it, it gives back:
"error: cannot find input file: `plugins/example/Makefile.in'"
The example makefile (plugins/example/Makefile.am) is the following:
include $(top_srcdir)/common.am
plugin_LTLIBRARIES = example-plugin.la
plugin_DATA = example.plugin
example_plugin_la_SOURCES = \
example-plugin.vala
example_plugin_la_VALAFLAGS = \
$(MYPROJ_COMMON_VALAFLAGS) \
--target-glib=2.38
example_plugin_la_CFLAGS = \
$(MYPROJ_COMMON_CFLAGS) \
-I$(srcdir) \
-DG_LOG_DOMAIN='"Example"'
example_plugin_la_LIBADD = \
$(MYPROJ_COMMON_LIBS)
example_plugin_la_LDFLAGS = \
$(MYPROJ_PLUGIN_LINKER_FLAGS) \
-lm
EXTRA_DIST = example.plugin.in
Every var is correctly generated (in common.am and configure.ac).
I appreciate any advice on this issue.
Thanks in advance

Looks like I found the answer to my own question. Apparently, everything I had to do was add a "lib" prefix to my plugin output file. The plugins/example/Makefile.am now looks like:
include $(top_srcdir)/common.am
plugin_LTLIBRARIES = **lib**example.la
plugin_DATA = example.plugin
**lib**example_la_SOURCES = \
example-plugin.vala
**lib**example_la_VALAFLAGS = \
$(MYPROJ_COMMON_VALAFLAGS) \
--target-glib=2.38
**lib**example_la_CFLAGS = \
$(MYPROJ_COMMON_CFLAGS) \
-I$(srcdir) \
-DG_LOG_DOMAIN='"Example"'
**lib**example_la_LIBADD = \
$(MYPROJ_COMMON_LIBS)
**lib**example_la_LDFLAGS = \
$(MYPROJ_PLUGIN_LINKER_FLAGS) \
-lm
EXTRA_DIST = example.plugin.in
This was the only modification I did, and it works as expected now. Seems like autoconf/autotools is very rigid about the syntax of plugins and shared libs, as they MUST start with lib prefix.

Related

protobuf validator command generates file in wrong path

I am trying to include request validation for grpc. I modified the protobuf command like this.
pkg/test/test.proto contains my schema.
If i run the below command :
protoc --go_out=. \
--proto_path=${GOPATH}/src \
--proto_path=${GOPATH}/src/github.com/gogo/protobuf/gogoproto/ \
--proto_path=${GOPATH}/src/github.com/mwitkow/go-proto-validators/ \
--proto_path=. \ --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative pkg/test/test.proto --govalidators_out=.
The validator.go file generated file is not generated inside pkg/test instead it is getting generated inside a new folder created {source relative pkg}/pkg/test/test.proto/validator.go.
How to generate validator.go file without the folder structure in pkg/test?
Analysis
It looks like the *.validator.pb.go files are generated in the wrong directory.
Using the pkg/test/test.proto file with the following content:
syntax = "proto3";
option go_package = "github.com/example-user/example-repository";
service Greeter {
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
message HelloRequest {
string name = 1;
}
message HelloReply {
string message = 1;
}
Produced the file system contents:
$ find .
.
./github.com
./github.com/example-user
./github.com/example-user/example-repository
./github.com/example-user/example-repository/test.validator.pb.go
./pkg
./pkg/test
./pkg/test/test_grpc.pb.go
./pkg/test/test.proto
./pkg/test/test.pb.go
Solution
Add the --govalidators_opt=paths=source_relative command line argument.
Please, note the parameter name:
--govalidators_opt
The complete command line:
protoc --go_out=. \
--proto_path=. \
--go_opt=paths=source_relative \
--go-grpc_out=. \
--go-grpc_opt=paths=source_relative \
--govalidators_out=. \
--govalidators_opt=paths=source_relative \
pkg/test/test.proto
Produced the file system contents:
$ find .
.
./pkg
./pkg/test
./pkg/test/test_grpc.pb.go
./pkg/test/test.proto
./pkg/test/test.pb.go
./pkg/test/test.validator.pb.go
Additional references
Seems to be an example. Comment.
A GitHub issue created by the asker? How to specify path for generated validator.go ? · Issue #121 · mwitkow/go-proto-validators.

Bazel genrule: Use linebreaks in command

I use a genrule with a lot of sources, that have a long identifier. The command needs to list all sources explicitely, which would result in a reeaally long cmd. Therefore I tried to use linebreaks (as known from bash or shell commands)...
However, bazel complains about unterminated strings.
genrule(
name = "Aggregate_Reports",
srcs = ["//really/long/path/to/module/ModuleA/src:CoverageHtml",
"//really/long/path/to/module/ModuleA/src:TestRun",
"//really/long/path/to/module/ModuleB/src:CoverageHtml",],
outs = ["UT_Summary.txt"],
message = "Create unified report",
tools = [":Create_Summary"],
cmd = "$(location :Create_Summary) -t \
$(location //really/long/path/to/module/ModuleA/src:TestRun) \
$(location //really/long/path/to/module/ModuleB/src:TestRun) \
-c \
$(location //really/long/path/to/module/ModuleA/src:CoverageHtml) \
$(location //really/long/path/to/module/ModuleB/src:CoverageHtml) \
-o $(#)",
executable = True,
visibility=["//visibility:public"],
)
Escaping the \ with $ does not change anything...
As in Python, you can use triple-quotes to preserve the newlines:
cmd = """$(location :Create_Summary) -t \
$(location //really/long/path/to/module/ModuleA/src:TestRun) \
$(location //really/long/path/to/module/ModuleB/src:TestRun) \
-c \
$(location //really/long/path/to/module/ModuleA/src:CoverageHtml) \
$(location //really/long/path/to/module/ModuleB/src:CoverageHtml) \
-o $(#)""",

Yocto minimal eSDK - world-pkgdata

I've been trying to generate minimal extensible sdk using Yocto 2.5 Sumo. I've cloned only the poky and meta-openembedded repositories. In local.conf I've set the SDK type to minimal and set SDK_INCLUDE_PKGDATA. During the last task (do_populate_sdk_ext) bitbake throws that locked-sigs-pkgdata.inc is not found in this directory
tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0-r0/recipe-sysroot/world-pkgdata/
Find shows that this file is avaible here
./tmp/work/genericx86_64-poky-linux/meta-world-pkgdata/1.0-r0/image/world-pkgdata/locked-sigs-pkgdata.inc
./tmp/work/genericx86_64-poky-linux/meta-world-pkgdata/1.0-r0/recipe-sysroot/world-pkgdata/locked-sigs-pkgdata.inc
When I copy this file from on of above directories eSDK is correctly generated. I believe that this should be done automatically by one of recipe for poky/meta-openembedded. Probably I miss some config, but I'am unable to correctly identify the source of this problem.
Here is my bblayers.conf:
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/work/build/yocto/poky/meta \
/work/build/yocto/poky/meta-poky \
/work/build/yocto/poky/meta-yocto-bsp \
/work/build/yocto/meta-openembedded/meta-oe \
/work/build/yocto/meta-openembedded/meta-python \
/work/build/yocto/meta-openembedded/meta-multimedia \
/work/build/yocto/meta-openembedded/meta-perl \
/work/build/yocto/meta-openembedded/meta-gnome \
/work/build/yocto/meta-openembedded/meta-filesystems \
/work/build/yocto/meta-openembedded/meta-initramfs \
/work/build/yocto/meta-openembedded/meta-networking \
/work/build/yocto/openembedded-core/meta \
"
And my local.conf:
MACHINE = "genericx86-64"
BUILD_ARCH ?= "x86_64"
SDKMACHINE ?= "x86_64"
SDK_UPDATE_URL ?= "http://my-url/sdk-updater"
SDK_EXT_TYPE = "minimal"
SDK_INCLUDE_TOOLCHAIN = "0"
SDK_INCLUDE_PKGDATA = "1"
SSTATE_MIRRORS_append = " file://.* http://my-url/sstate/PATH \n"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_ipk"
LICENSE_FLAGS_WHITELIST = "commercial"
CONF_VERSION = "1"
I've tested
core-image-full-cmdline
and
core-image-minimal-dev
on both I've the same problem.
Thanks for any help and clues how to resolve this issue.

Yocto 1.6 no libboost_log in toolchain

I've installed Yocto 1.6 and run the bitbake to set up the toolchain, following the tutorial written by Daiane Angolini. While I see most of the boost libraries under $SDKTARGETSYSROOT/usr/lib, there seems to be no libboost_log.a nor libboost_log_setup.a. I believe these were introduced with Boost 1.55, and that Yocto 1.6 has moved to Boost 1.55. Shouldn't they be there, or have I done something wrong?
My .../fsl-community-bsp/build/conf/local.conf:
BB_NUMBER_THREADS ?= "${#oe.utils.cpu_count()}"
PARALLEL_MAKE ?= "-j ${#oe.utils.cpu_count()}"
MACHINE ??= 'imx6qsabresd'
DISTRO ?= 'poky'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks tools-sdk"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS = "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
ABORT,${TMPDIR},100M,1K \
ABORT,${DL_DIR},100M,1K \
ABORT,${SSTATE_DIR},100M,1K"
PACKAGECONFIG_pn-qemu-native = "sdl"
PACKAGECONFIG_pn-nativesdk-qemu = "sdl"
ASSUME_PROVIDED += "libsdl-native"
CONF_VERSION = "1"
BB_NUMBER_THREADS = '1'
PARALLEL_MAKE = '-j 1'
DL_DIR ?= "${BSPDIR}/downloads/"
ACCEPT_FSL_EULA = ""
CORE_IMAGE_EXTRA_INSTALL += "boost"
The right way is to extend the existing recipe. In fact, you normally never change a 3rd-party recipe directly. This means, you are creating your own "recipes-support/boost/" folder which includes a file called "boost_%.bbappend".
'%' means that the boost version is not of interest. 'bbappend' means that you extend the existing boost-recipe. This file contains only one line:
BOOST_LIBS += " log"
In order to add log library you should edit boost recipe file.
In this example you should edit boost.inc.
To add log, atomic and loace libraries, replace
BOOST_LIBS = "\
date_time \
filesystem \
graph \
iostreams \
program_options \
regex \
serialization \
signals \
system \
test \
thread \
"
with
BOOST_LIBS = "\
date_time \
filesystem \
graph \
iostreams \
program_options \
regex \
serialization \
signals \
system \
test \
thread \
log \
atomic \
locale
"

Disable all but few warnings in gcc

In gcc -w is used to disable all warnings. However in this case I can't enable specific ones (e.g. -Wreturn-type).
Is it possible to disable all warnings, but enable few specific ones?
As a workaround, is there a way to generate list of all -Wno-xxx at once? And will it help? I wouldn't want to do this manually just to find out that it is not equal to -w.
You can use the following command to get an WARN_OPTS variable suitable for injecting directly into your Makefile:
gcc --help=warnings | awk '
BEGIN { print "WARN_OPTS = \\" }
/-W[^ ]/ { print $1" \\"}
' | sed 's/^-W/ -Wno-/' >makefile.inject
This gives you output (in makefile.inject) like:
WARN_OPTS = \
-Wno- \
-Wno-abi \
-Wno-address \
-Wno-aggregate-return \
-Wno-aliasing \
-Wno-align-commons \
-Wno-all \
-Wno-ampersand \
-Wno-array-bounds \
-Wno-array-temporaries \
: : :
-Wno-variadic-macros \
-Wno-vector-operation-performance \
-Wno-vla \
-Wno-volatile-register-var \
-Wno-write-strings \
-Wno-zero-as-null-pointer-constant \
Once that's put in your actual Makefile, simply use $(WARN_OPTS) as part of your gcc command.
It may need a small amount of touch up to:
get rid of invalid options such as -Wno-;
fix certain -Wno-<key>=<value> types; and
remove the final \ character.
but that's minimal effort compared to the generation of the long list, something you can now do rather simply.
When you establish that you want one of those warnings, simply switch from the -Wno-<something> back to -W<something>.

Resources