Linking to boost_filesystem in a bjam-based project - boost

I'm trying to set up Boost.Build for my own project, which references libboost_filesystem.
When I run
bjam release avg_asp
I get the following output:
andreas#rodin:~/src/libdoas/src/tools$ bjam release avg_asp -n
/home/andreas/lib/build/boost_1_42_0/Jamroot:637: in modules.load
rule targets.create-metatarget unknown in module Jamfile</home /andreas/lib/build/boost_1_42_0>.
/usr/share/boost-build/build/project.jam:312: in load-jamfile
/usr/share/boost-build/build/project.jam:68: in project.load
/usr/share/boost-build/build/project.jam:718: in project.use
/usr/share/boost-build/build/project.jam:94: in project.load-used-projects
/usr/share/boost-build/build-system.jam:105: in load-config
/usr/share/boost-build/build-system.jam:154: in load
/usr/share/boost-build/kernel/modules.jam:261: in import
/usr/share/boost-build/kernel/bootstrap.jam:132: in boost-build
/usr/share/boost-build/boost-build.jam:1: in module scope
I'd really appreciate some help getting this fixed...
~/user-config.jam
# -----------------
# System libraries
# -----------------
project site-config ;
lib netcdf : : <name>netcdf ;
# ------------------------
# Include Boost libraries
# ------------------------
use-project /boost : /home/andreas/lib/build/boost_1_42_0 ;
~/src/libdoas/Jamroot
project
: requirements <include>/home/andreas/include/boost-1_42
: requirements <include>include
;
~/src/libdoas/src/lib/Jamfile
lib libdoas : [ glob *.cpp ] /site-config//netcdf ;
~/src/libdoas/src/tools/Jamfile
exe avg_asp : avg_asp.cpp /boost/filesystem//boost_filesystem ;
exe b3dcols_to_pgl : b3dcols_to_pgl.cpp ;
In the directory /home/andreas/lib/build/boost_1_42_0, I already did the following::
./bootstrap.sh --prefix=/home/andreas
bjam
Any ideas?

All right, I got the answer from the boost-build mailing list. The problem is that I was using the boost-build / bjam from the Ubuntu repos, which is too old to build Boost 1.42. I uninstalled the Ubuntu version, and everything works fine now :)

Related

Why do I get undeclared inclusion error when using the lib as external library?

I am trying to include an external library (glm) in my bazel build, but I get undeclared inclusion the thing is I don't understand how to fix it and why, Because if I use the same BUILD script when I extract manually the library it builds fine.
I managed to make a very small repro of this problem, both the working case and the not working.
The not working example
My folder structure
glmExtBuild
WORKSPACE
externals
glm.BUILD
This is my WORKSPACE file
new_http_archive(
name = "glmExt",
url = "https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz",
sha256 = "514dea9ac0099dc389cf293cf1ab3d97aff080abad55bf79d4ab7ff6895ee69c",
strip_prefix = "glm-0.9.9.0",
build_file = "externals/glm.BUILD",
)
This is my glm.BUILD file
package(default_visibility = ["//visibility:public"])
cc_library(
name= "glm",
defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS",
"GLM_FORCE_DEPTH_ZERO_TO_ONE"],
srcs=glob(["glm/**/*.cpp"]) + ["glm/detail/_fixes.hpp"],
hdrs=glob(["glm/**/*.hpp"])+glob(["glm/**/*.h"]),
includes = ["glm"],
textual_hdrs = glob(["glm/**/*.inl"]),
visibility = ["//visibility:public"],
)
And this is the errors that I get when I run
bazel build #glmExt//:glm --verbose_failures --sandbox_debug
ERROR: C:/users/...../external/glmExt/BUILD.bazel:121:1: undeclared inclusion(s) in rule '#glmExt//:glm':
this rule is missing dependency declarations for the following files included by 'external/glmExt/glm/detail/glm.cpp':
'external/glmext/glm/detail/_fixes.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/simd/platform.h'
'external/glmext/glm/fwd.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_int.hpp'
'external/glmext/glm/detail/setup.hpp'
'external/glmext/glm/detail/type_float.hpp'
...
The working example:
My folder structure
glmBuild2
WORKSPACE
BUILD
glmSrc
https://github.com/g-truc/glm/archive/0.9.9.0.tar.gz extracted here
My WORKSPACE file is empty
And this is my BUILD file
package(default_visibility = ["//visibility:public"])
cc_library(
name= "glm",
defines= ["GLM_ENABLE_EXPERIMENTAL", "GLM_FORCE_RADIANS", "GLM_FORCE_DEPTH_ZERO_TO_ONE"],
srcs=glob(["glmSrc/glm/**/*.cpp"]) + ["glmSrc/glm/detail/_fixes.hpp"],
hdrs=glob(["glmSrc/glm/**/*.hpp"])+glob(["glmSrc/glm/**/*.h"]),
includes = ["glmSrc"],
textual_hdrs = glob(["glmSrc/glm/**/*.inl"]),
visibility = ["//visibility:public"],
)
Then when running the build command it finished successfully.
PS D:\......\glmBuild2> bazel build :glm --verbose_failures --sandbox_debug
INFO: Analysed target //:glm (1 packages loaded).
INFO: Found 1 target...
INFO: From Compiling glmSrc/glm/detail/glm.cpp:
glmSrc/glm/detail/glm.cpp(4): warning C4005: 'GLM_ENABLE_EXPERIMENTAL': macro redefinition
glmSrc/glm/detail/glm.cpp(4): note: command-line arguments: see previous definition of 'GLM_ENABLE_EXPERIMENTAL'
Target //:glm up-to-date:
C:/users/.../execroot/__main__/bazel-out/x64_windows-fastbuild/bin/libglm.a
INFO: Elapsed time: 1.830s, Critical Path: 1.30s
INFO: 3 processes, local.
INFO: Build completed successfully, 4 total actions
Does anybody have an idea?
Thanks
Update:
bazel version
Build label: 0.14.0
Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jun 1 13:06:29 2018 (1527858389)
Build timestamp: 1527858389
Build timestamp as int: 1527858389
Bazel issue:
https://github.com/bazelbuild/bazel/issues/5485
I tried the first example on linux, with bazel 0.15.0, and all worked once I added "." into includes attribute of glm. Do you have a possibility to test it on linux? Is it windows-only issue then? Which bazel version do you use?
Thanks for clarifications.

Failing to build Boost components locally with Bazel build

I am trying to build Boost library locally and want to use it as a local_repository in my own project. I am referring to this (https://github.com/nelhage/rules_boost) for help.
I have a directory tree like this:
boost/ // root of the boost project
|
bazel/
| |
| boost.bzl // contains "boost_library" function from https://github.com/nelhage/rules_boost/blob/master/boost/boost.bzl
| |
| BUILD // empty
boost/ // the original boost headers folder from original boost dist
|
lib/ // the original boost sources folder from original boost dist
|
BUILD
|
WORKSPACE
The BUILD file looks like this one:
https://github.com/nelhage/rules_boost/blob/master/BUILD.boost
with properly loading boost.bzl
The WORKSPACE is just:
workspace( name = "boost" )
The issue:
Now I am trying to build individual components (bazel build //:<component>).
Some of the components (Boost.Container, Boost.Test) are failing to build for a similar reason (not finding header files).
bazel build //:container 1 ↵
INFO: Found 1 target...
ERROR: /home/spyder/codebase/boost/BUILD:103:1: C++ compilation of rule '//:container' failed: Process exited with status 1 [sandboxed].
libs/container/src/global_resource.cpp:12:51: fatal error: boost/container/pmr/memory_resource.hpp: No such file or directory
compilation terminated.
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //:container failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.519s, Critical Path: 0.18s
bazel build //:test 1 ↵
INFO: Found 1 target...
ERROR: /home/spyder/codebase/boost/BUILD:581:1: C++ compilation of rule '//:test' failed: Process exited with status 1 [sandboxed].
libs/test/src/junit_log_formatter.cpp:11:51: fatal error: boost/test/impl/junit_log_formatter.ipp: No such file or directory
compilation terminated.
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //:test failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.027s, Critical Path: 0.82s
Can anyone guide me on fixing it ?
EDIT:
I also tried to query the expanded cc_library rule by bazel query --output=build //:container and got this
cc_library(
name = "container",
visibility = ["//visibility:public"],
generator_name = "container",
generator_function = "boost_library",
generator_location = "/home/spyder/codebase/boost/BUILD:103",
licenses = ["notice"],
deps = ["//:config", "//:core", "//:intrusive", "//:move"],
defines = [],
includes = ["boost/container/"],
copts = ["-Wno-unused-value"],
srcs = ["//:libs/container/src/alloc_lib.c", "//:libs/container/src/dlmalloc.cpp", "//:libs/container/src/dlmalloc_2_8_6.c", "//:libs/container/src/dlmalloc_ext_2_8_6.c", "//:libs/container/src/global_resource.cpp", "//:libs/container/src/monotonic_buffer_resource.cpp", "//:libs/container/src/pool_resource.cpp", "//:libs/container/src/synchronized_pool_resource.cpp", "//:libs/container/src/unsynchronized_pool_resource.cpp"],
hdrs = [ ....... , "//:boost/container/pmr/map.hpp", "//:boost/container/pmr/memory_resource.hpp", "//:boost/container/pmr/monotonic_buffer_resource.hpp", "//:boost/container/pmr/polymorphic_allocator.hpp", ........ ],
)
Very shockingly, the source file which is complaining (libs/container/src/global_resource.cpp) and the header that it is complaining about (boost/container/pmr/memory_resource.hpp) are both correctly included in the srcs and hdrs list.
I played with your rules a bit and the biggest problem I see is incomplete dependencies. For example I tried :algorithm component, and that needs to depend on :tuple. I guess you just needs to make sure all dependencies are set correctly.
I played more with container, and the problem I encountered was incorrect include dirs. If you run your build with -s flag, bazel will output all the command lines so you can inspect them and check that -isystem flags contain the directory that contains boost/container/... . What can also help you is the bazel flag --sandbox_debug, which will prevent the sandbox directory from being deleted so you can see which files are where and also you can reproduce the compiler invocation without running through bazel.
Last, bazel does not understand .ipp header extension yet (tbh I've never heard of it, but I also know next to nothing about boost). I have a change in flight that will introduce this.

fixup_bundle : Qt5 segfault at execution

I'm testing fixup_bundle in order to create a standalone Qt5 application. Fixup doesn't give me any error but when running my application, I got something like this :
Class RunLoopModeTracker is implemented in both
/Users/rperrot/Prog/exe/Build/src/executables/exe/exe.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
and
/Users/rperrot/Qt/5.6/clang_64/lib/QtCore.framework/Versions/5/QtCore.
One of the two will be used. Which one is undefined.
I understand the issue but I can't find how to solve it in my CMakeLists.txt
I link my exe like this :
target_link_libraries( exe Qt5::Widgets Qt5::OpenGL )
then when using install command :
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
install( CODE "
INCLUDE(BundleUtilities)
fixup_bundle( ${CMAKE_INSTALL_PREFIX}/exe.app \"\" \"\" )"
COMPONENT Runtime )
Any suggestion ?

RPM packaging RPM file is zero?

I did RPM packaging and obtained rpm file and src.rpm file by rpmbuild -ba ***.spec.
But, when i type rpm -qi ***.rpm. Computer screen displayed that size of rpm package is zero. Also, when I type rpm -qa | grep ***(name of rpm file), etc, there was no problem. What happened? There is a spec file problem?
This is my spec file------------------------------------------
Summary : Spec file for making RPM file for ****!
Name : ***
Version : 0.0.1
Release : 1
Source : ***-0.0.1.tar.gz
Prefix : /rpm
Group : Applications/Engineering
License : ******
BuildRoot : /home/users/tmdcjf9119/rpm/tmp
%description
.....
%prep
%setup
%build
%install
make -> there is a makefile in source file and when i compiled with this makefile, objective file and execute(?!) file was made.
%files

Not able to make tipc module

I am not able to build tipc module when executed Makefile using make command in the path /tipc-1.7.7-bundle/net/tipc. The errors comes as target not found. I extracted the tipc 1.7 package in root directory. My operating system is CentOs 6.3. The Makefile contents are
#
# Makefile for the Linux TIPC layer
#
obj-$(CONFIG_TIPC) := tipc.o
tipc-y += tipc_addr.o tipc_bcast.o tipc_bearer.o tipc_cfgsrv.o \
tipc_core.o tipc_handler.o tipc_link.o tipc_discover.o tipc_msg.o \
tipc_name_distr.o tipc_topsrv.o tipc_name_table.o tipc_net.o \
tipc_netlink.o tipc_node.o tipc_port.o tipc_ref.o \
tipc_socket.o tipc_user_reg.o tipc_dbg.o tipc_eth_media.o
# End of file
Please help, i am newbie to linux.

Resources