I've got a C++ application in a Yocto build that requires the library file libwpa_client.so. This file is provided by wpa-supplicant. I brute forced installation of this file into my Yocto image as the wpa-supplicant recipe wasn't doing it for me. I'm now trying to figure out the proper way to pull this library file in during an autotools build.
The bb recipe for the C++ application includes:
DESCRIPTION = "My C++ Application recipe"
LICENSE = "CLOSED"
PACKAGES = "\
${PN} \
${PN}-dev \
${PN}-dbg \
"
DEPENDS = " libegt sqlite3-native libgpiod wpa-supplicant"
# Add for gpiod.h
RDEPENDS_${PN} = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dev = "libgpiod wpa-supplicant"
RDEPENDS_${PN}-dbg = "libgpiod wpa-supplicant"
....
& in the configure.ac I have:
PKG_CHECK_MODULES(LIBGPIOD, [libgpiod >= 1.0], [], [
AC_MSG_ERROR(libgpiod not found. This is required.)
])
# note libwpa_client has no version number, just libwpa_client.so
PKG_CHECK_MODULES(LIBWPA_CLIENT, [libwpa_client], [], [
AC_MSG_ERROR(libwpa_client not found. This is required.)
])
Using this produces the output:
Wno-long-long -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi
| checking if libc contains libintl... yes
| checking libintl.h usability... yes
| checking libintl.h presence... yes
| checking for libintl.h... yes
| checking for libegt >= 1.3... yes
| checking for libgpiod >= 1.0... yes
| checking for libwpa_client... no
| configure: error: libwpa_client not found. This is required.
| NOTE: The following config.log files may provide further information.
My application builds fine if I manually specify lwpa_client in Makefile.am as follows:
CUSTOM_LDADD = $(LIBEGT_LIBS) $(top_builddir)/external/libsqlite3.la $(LIBGPIOD_LIBS) $(LIBWPA_CLIENT_LIBS) -lwpa_client
But my questions is how should I properly do this?
Many thanks,
I am Trying to compile 'xplanet' R224 (latest version) on Ubuntu 18.04
MAKE fails to find ft2build.h (freetype2 header) I have 'freetype'(2.8.1) installed properly and all the files are there. I have searched stackoverflow and found many people with the same problem (ft2build.h not found) yet no consensus on why or what the solution is.
Any help is appreciated.
MAKE ERROR MESSAGE:
In file included from getTextRenderer.cpp:8:0:
TextRendererFT2.h:4:10: fatal error: ft2build.h: No such file or directory
#include <ft2build.h>
compilation terminated.
Makefile:458: recipe for target 'getTextRenderer.o' failed
make[3]: *** [getTextRenderer.o] Error 1
MY INSTALLED FREETYPE FILES:
ls /usr/include/freetype2/freetype/config
ftconfig.h ftheader.h ftmodule.h ftoption.h ftstdlib.h
ls /usr/include/freetype2/freetype
config ftautoh.h ftbzip2.h ftcid.h ftgasp.h ftimage.h ftlzw.h ftmoderr.h ftpfr.h ftstroke.h ftttdrv.h ttnameid.h
freetype.h ftbbox.h ftcache.h fterrdef.h ftglyph.h ftincrem.h ftmac.h ftotval.h ftrender.h ftsynth.h fttypes.h tttables.h
ft2build.h ftbdf.h ftcffdrv.h fterrors.h ftgxval.h ftlcdfil.h ftmm.h ftoutln.h ftsizes.h ftsystem.h ftwinfnt.h tttags.h
ftadvanc.h ftbitmap.h ftchapters.h ftfntfmt.h ftgzip.h ftlist.h ftmodapi.h ftpcfdrv.h ftsnames.h fttrigon.h t1tables.h ttunpat.h
ls /usr/include/freetype2
freetype ft2build.h
MAKEFILE INCLUDES THESE LINES:
FREETYPE2_CFLAGS = -I/usr/include/freetype2 -I/usr/include/libpng16
FREETYPE2_LIBS = -lfreetype
FREETYPE_CFLAGS =
FREETYPE_LIBS =
They have there a mix of FREETYPE and FREETYPE2 variables for some reason. I managed to make it compile with those changes:
In src/libdisplay/Makefile.am:
--- src/libdisplay/Makefile.am.old 2022-02-27 22:21:56.089575296 +0100
+++ src/libdisplay/Makefile.am 2022-02-27 22:22:13.424197851 +0100
## -26,7 +26,7 ##
EXTRA_libdisplay_a_SOURCES = DisplayMacAqua.cpp DisplayMacAqua.h DisplayMSWin.cpp DisplayMSWin.h TextRendererFT2.cpp TextRendererFT2.h TextRendererPangoFT2.cpp TextRendererPangoFT2.h DisplayX11.cpp DisplayX11.h vroot.h TimerMacAqua.cpp TimerMacAqua.h TimerX11.cpp TimerX11.h
-AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -I#top_srcdir#/src #X_CFLAGS# #FREETYPE2_CFLAGS#
if USE_AR
libdisplay_a_AR = $(AR) cru
In src/Makefile.am:
--- src/Makefile.am.old 2022-02-27 22:22:02.953029931 +0100
+++ src/Makefile.am 2022-02-27 22:22:31.438766211 +0100
## -8,7 +8,7 ##
parsegeom = ParseGeom.c ParseGeom.h
endif
-AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE_CFLAGS#
+AM_CPPFLAGS = -DDATADIR=\"$(datadir)#separator#xplanet\" #X_CFLAGS# #FREETYPE2_CFLAGS#
AM_LDFLAGS = #xplanet_LDFLAGS#
xplanet_SOURCES = \
## -72,5 +72,5 ##
libprojection/libprojection.a \
libsgp4sdp4/libsgp4sdp4.a \
#GRAPHICS_LIBS# #CSPICE_LIBS# #X_LIBS# \
- #XSS_LIBS# #FREETYPE_LIBS# #AQUA_LIBS# \
+ #XSS_LIBS# #FREETYPE2_LIBS# #AQUA_LIBS# \
#LIBICONV# #LIBCHARSET#
The solution above was completely successful. FREETYPE2 was misspelled in three places as FREETYPE in "src/Makefile.am" Installation had no further problems
Molly
Feb 27 at 22:50
I have a set of files as part of the my repository. How do I produce a zip file out of those files in bazel. I found a rules for tar.gz etc. but cannot find a way how to achive a zip archive.
Found references mentioning zipper but couldn't figure out how to load it and use it. Can someone more experienced with bazel help?
A basic pkg_zip rule was added to rules_pkg recently. Here is a basic usage example from the unit tests:
load("#rules_pkg//:pkg.bzl", "pkg_zip")
pkg_zip(
name = "test_zip_basic",
srcs = [
"testdata/hello.txt",
"testdata/loremipsum.txt",
],
)
You can specify the paths using the extra rules in mappings.bzl. Here is the example given by the Bazel team:
load("#rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mkdirs", "strip_prefix")
load("#rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
# This is the top level BUILD for a hypothetical project Foo. It has a client,
# a server, docs, and runtime directories needed by the server.
# We want to ship it for Linux, macOS, and Windows.
#
# This example shows various techniques for specifying how your source tree
# transforms into the installation tree. As such, it favors using a lot of
# distict features, at the expense of uniformity.
pkg_files(
name = "share_doc",
srcs = [
"//docs",
],
# Required, but why?: see #354
strip_prefix = strip_prefix.from_pkg(),
# Where it should be in the final package
prefix = "usr/share/doc/foo",
)
pkg_filegroup(
name = "manpages",
srcs = [
"//src/client:manpages",
"//src/server:manpages",
],
prefix = "/usr/share",
)
pkg_tar(
name = "foo_tar",
srcs = [
"README.txt",
":manpages",
":share_doc",
"//resources/l10n:all",
"//src/client:arch",
"//src/server:arch",
],
)
pkg_zip(
name = "foo_zip",
srcs = [
"README.txt",
":manpages",
":share_doc",
"//resources/l10n:all",
"//src/client:arch",
"//src/server:arch",
],
)
The zipper utility is at #bazel_tools//tools/zip:zipper, this is its usage:
Usage: zipper [vxc[fC]] x.zip [-d exdir] [[zip_path1=]file1 ... [zip_pathn=]filen]
v verbose - list all file in x.zip
x extract - extract files in x.zip to current directory, or
an optional directory relative to the current directory
specified through -d option
c create - add files to x.zip
f flatten - flatten files to use with create or extract operation
C compress - compress files when using the create operation
x and c cannot be used in the same command-line.
For every file, a path in the zip can be specified. Examples:
zipper c x.zip a/b/__init__.py= # Add an empty file at a/b/__init__.py
zipper c x.zip a/b/main.py=foo/bar/bin.py # Add file foo/bar/bin.py at a/b/main.py
If the zip path is not specified, it is assumed to be the file path.
So it can be used in a genrule like this:
$ tree
.
├── BUILD
├── dir
│ ├── a
│ ├── b
│ └── c
└── WORKSPACE
1 directory, 5 files
$ cat BUILD
genrule(
name = "gen_zip",
srcs = glob(["dir/*"]),
tools = ["#bazel_tools//tools/zip:zipper"],
outs = ["files.zip"],
cmd = "$(location #bazel_tools//tools/zip:zipper) c $# $(SRCS)",
)
$ bazel build :files.zip
INFO: Analyzed target //:files.zip (7 packages loaded, 41 targets configured).
INFO: Found 1 target...
Target //:files.zip up-to-date:
bazel-bin/files.zip
INFO: Elapsed time: 0.653s, Critical Path: 0.08s
INFO: 1 process: 1 linux-sandbox.
INFO: Build completed successfully, 2 total actions
$ unzip -l bazel-bin/files.zip
Archive: bazel-bin/files.zip
Length Date Time Name
--------- ---------- ----- ----
0 2010-01-01 00:00 dir/a
0 2010-01-01 00:00 dir/b
0 2010-01-01 00:00 dir/c
--------- -------
0 3 files
It can similarly be used in Starlark:
def _some_rule_impl(ctx):
zipper_inputs = []
zipper_args = ctx.actions.args()
zipper_args.add("c", ctx.outputs.zip.path)
....
ctx.actions.run(
inputs = zipper_inputs,
outputs = [ctx.outputs.zip],
executable = ctx.executable._zipper,
arguments = [zipper_args],
progress_message = "Creating zip...",
mnemonic = "zipper",
)
some_rule = rule(
implementation = _some_rule_impl,
attrs = {
"deps": attr.label_list(),
"$zipper": attr.label(default = Label("#bazel_tools//tools/zip:zipper"), cfg = "host", executable=True),
},
outputs = {"zip": "%{name}.zip"},
)
I've implemented a custom preprocessor which creates *.hs files form *.tpl files. It is specified in Setup.hs by using a Build-Type: Custom. Everything works fine, but I can't create tar.gz package from it (using cabal sdist).
Cabal complains, that it can not find the exposed modules which are generated by the preprocessor. The error message is
cabal: Error: Could not find module with any
suffix: ["gc","chs","hsc","x","y","ly","cpphs","hs","lhs"]
How can I make Cabal aware of the fact that the module is not missing, or maybe add tpl to the known file extensions, or something?
This is a known issue with cabal sdist. Use ./dist/setup/setup sdist instead.
Here's an example:
$ cat preprocessor-test.cabal
name: preprocessor-test
version: 0.1.0.0
build-type: Custom
cabal-version: >=1.10
extra-source-files: PreprocessorTest/*.prepro
library
exposed-modules: PreprocessorTest.PreprocessorTest
build-depends: base ==4.5.*
-- hs-source-dirs:
default-language: Haskell2010
$ cat Setup.hs
#!/usr/bin/env runhaskell
import Distribution.Simple
import Distribution.Simple.PreProcess
import Distribution.Simple.Utils
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import System.Cmd (rawSystem)
import System.FilePath ((</>))
main = let hooks = simpleUserHooks
dummy = ("prepro", dummyPreprocessor)
in defaultMainWithHooks hooks
{ hookedPreProcessors = dummy:knownSuffixHandlers }
dummyPreprocessor :: BuildInfo -> LocalBuildInfo -> PreProcessor
dummyPreprocessor build local = PreProcessor {
platformIndependent = True,
runPreProcessor =
mkSimplePreProcessor $ \inFile outFile verbosity -> do
notice verbosity (inFile ++ " is being preprocessed to " ++ outFile)
rawSystem "cp" [inFile, outFile]
return ()
}
$ cat PreprocessorTest/PreprocessorTest.prepro
module PreprocessorTest.PreprocessorTest
where
preprocessorTest :: Int
preprocessorTest = 1
$ cabal configure
Resolving dependencies...
[1 of 1] Compiling Main ( Setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring preprocessor-test-0.1.0.0...
$ cabal build
Building preprocessor-test-0.1.0.0...
Preprocessing library preprocessor-test-0.1.0.0...
PreprocessorTest/PreprocessorTest.prepro is being preprocessed to
dist/build/PreprocessorTest/PreprocessorTest.hs
[1 of 1] Compiling PreprocessorTest.PreprocessorTest ( dist/build/PreprocessorTest/PreprocessorTest.hs, dist/build/PreprocessorTest/PreprocessorTest.o )
Registering preprocessor-test-0.1.0.0...
$ ./dist/setup/setup sdist
Distribution quality errors:
No 'synopsis' or 'description' field.
The 'license' field is missing or specified as AllRightsReserved.
Distribution quality warnings:
No 'category' field.
No 'maintainer' field.
Note: the public hackage server would reject this package.
Building source dist for preprocessor-test-0.1.0.0...
Preprocessing library preprocessor-test-0.1.0.0...
PreprocessorTest/PreprocessorTest.prepro is being preprocessed to
dist/src/sdist.-6767/preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/PreprocessorTest.hs
Source tarball created: dist/preprocessor-test-0.1.0.0.tar.gz
$ tar tzf dist/preprocessor-test-0.1.0.0.tar.gz
preprocessor-test-0.1.0.0/
preprocessor-test-0.1.0.0/dist/
preprocessor-test-0.1.0.0/dist/build/
preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/
preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/PreprocessorTest.hs
preprocessor-test-0.1.0.0/Setup.hs
preprocessor-test-0.1.0.0/PreprocessorTest/
preprocessor-test-0.1.0.0/PreprocessorTest/PreprocessorTest.prepro
preprocessor-test-0.1.0.0/preprocessor-test.cabal
So I have the following on my Android.mk....
...
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include /Users/myname/Development/Android/android-ndk-r8c/platforms/android-14/arch-arm/usr/include
...
LOCAL_LDLIBS := -ldl -lGLESv1_CM -llog
However, when I try running ndk-build I get the following....
/Users/myname/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): in function GLES_CreateRenderer:jni/SDL/src/render/opengles/SDL_render_gles.c:189: error: undefined reference to 'glDisableClientState'
collect2: ld returned 1 exit status
This of course appears to be an issue linking, however, the compiler worked just fine. I am confused as to why the linking wouldn't work but the compilation would. Anyonw know how I could fix it?
From ndk-build V=1 >Build.log Output
UPDATE:
Ok so I am taking the code found here this compiles fine, however, I am trying to upgrade to PRBoom+ so I dl the code from here and tweak the Android.mk to include the new classes. Once this is done it seems to compile fine, however, it fails to properly link. There are two main errors I see...
First is involving multiple definitions, however, the original (compiled linked fine) code had the same multiple definitions....
/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/prboom_jni/w_mmap.o: multiple definition of 'W_InitCache'
The other type is the OpenGL issues...
/Users/me/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libSDL.a(SDL_render_gles.o): in function GLES_ResetState:/Users/jackiegleason/Development/Code/prboom4android-base/jni/SDL/src/render/opengles/SDL_render_gles.c:181: error: undefined reference to 'glDisable'
If I copy everything back (using the prboom4android code) everything compiles and links just fine.
Here is a diff of the 2 Android.mk files...
< LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include $(LOCAL_PATH)/MUSIC $(LOCAL_PATH)/MUSIC/include $(LOCAL_PATH)/TEXTSCREEN $(LOCAL_PATH)/TEXTSCREEN/include
---
> LOCAL_C_INCLUDES:= $(LOCAL_PATH) $(LOCAL_PATH)/include $(LOCAL_PATH)/../SDL_net/include $(LOCAL_PATH)/../SDL/include
28c28
< f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c i_capture.c \
---
> f_finale.c p_enemy.c p_spec.c r_plane.c w_mmap.c \
31,36c31,33
< m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c s_advsound.c memio.c \
< d_client.c i_video.c i_network.c i_system.c PCSOUND/pcsound.c PCSOUND/pcsound_sdl.c SDL/i_sshot.c \
< i_main.c sc_man.c SDL/i_sound.c jni_doom.c mus2mid.c pcm2wav.c e6y.c SDL/i_joy.c \
< r_screenmultiply.c hu_tracers.c i_smp.c g_overflow.c i_pcsound.c \
< MUSIC/dbopl.c MUSIC/flplayer.c MUSIC/portmidiplayer.c MUSIC/midifile.c MUSIC/opl_queue.c MUSIC/vorbisplayer.c MUSIC/dumbplayer.c MUSIC/oplplayer.c MUSIC/madplayer.c MUSIC/opl.c \
< TEXTSCREEN/txt_button.c TEXTSCREEN/txt_separator.c TEXTSCREEN/txt_gui.c TEXTSCREEN/txt_widget.c TEXTSCREEN/txt_checkbox.c TEXTSCREEN/txt_radiobutton.c TEXTSCREEN/txt_inputbox.c TEXTSCREEN/txt_spinctrl.c TEXTSCREEN/txt_window.c TEXTSCREEN/txt_desktop.c TEXTSCREEN/txt_scrollpane.c TEXTSCREEN/txt_io.c TEXTSCREEN/txt_strut.c TEXTSCREEN/txt_window_action.c TEXTSCREEN/txt_dropdown.c TEXTSCREEN/txt_sdl.c TEXTSCREEN/txt_label.c TEXTSCREEN/txt_table.c
---
> m_bbox.c p_inter.c p_tick.c r_things.c z_zone.c \
> d_client.c i_video.c i_network.c i_system.c \
> i_main.c i_sound.c jni_doom.c mmus2mid.c pcm2wav.c
Yes, I could download your Build.log.
Your build uses APP_PLATFORM = android-3, which does not have the necessary GL libraries. You can set APP_PLATFORM = android-14 in your Application.mk, or set the target platform for your Android project (Eclipse will update the project.properties file).
You should not add the android-14 includes manually in your Android.mk. When you have correct APP_PLATFORM, the include path will be adjusted accordingly.