Trouble installing Boost on Windows 10 - c++

I'm stuck trying to install Boost (1.55) on Windows 10 (pro)
I have been following the instructions here link
And I'm not sure what is supposed to happen at/after this stage:
C:\Users\Sak09\Downloads\boost_1_55_0\boost_1_55_0\tools\build\v2>b2 --build-dir="C:\Boost\" toolset=msvc --build-type= complete stage
warning: the --build-dir option was specified
warning: but Jamroot at '.'
warning: specified no project id
warning: the --build-dir option will be ignored
warning: No toolsets are configured.
warning: Configuring default toolset "msvc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...found 580 targets...
C:\Users\Sak09\Downloads\boost_1_55_0\boost_1_55_0\tools\build\v2>b2 toolset=msvc --build-type=complete stage
notice: could not find main target stage
notice: assuming it is a name of file to create.
don't know how to make <e>stage
...found 1 target...
...can't find 1 target...
C:\Users\Sak09\Downloads\boost_1_55_0\boost_1_55_0\tools\build\v2>b2 --build-type=complete msvc stage
warning: No toolsets are configured.
warning: Configuring default toolset "msvc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
notice: could not find main target stage
notice: assuming it is a name of file to create.
don't know how to make <e>stage
...found 1 target...
...can't find 1 target...
Any help is very much appreciated. I'm trying to setup dev stuff in Windows after a decade and I'm really struggling with this.

Tried the same instructions with Boost version 1.60 and it just worked. So yeah some compatibility issue with VS2017 and older versions of Boost. Thanks everyone for the suggestioons.

Related

Dlangui hello world program exit with non-zero code

I'm new to D and DlangUI, and I'm compiling a hello world app using DlangUI following the official wiki using vscode, I have edited the app.d file and run dub run, it shows Program exited with code -1073741701.
I have tried the following but have no luck:
dub upgrade --force-remove
dub build --force
remove dub.selections.json
Environment:
dmd: v2.100.2-dirty
dub: 1.29.2
os: Windows 10 Professional 21H1 (64bit)
Output of dub run:
bindbc-loader 1.0.1: target for configuration "noBC" is up to date.
bindbc-opengl 1.0.2: target for configuration "dynamic" is up to date.
derelict-util 3.0.0-beta.2: target for configuration "library" is up to date.
derelict-ft 2.0.0-beta.5: target for configuration "library" is up to date.
derelict-sdl2 3.0.0-beta.8: target for configuration "derelict-sdl2-dynamic" is up to date.
inilike 1.2.1: target for configuration "library" is up to date.
isfreedesktop 0.1.1: target for configuration "library" is up to date.
xdgpaths 0.2.5: target for configuration "library" is up to date.
icontheme 1.2.3: target for configuration "library" is up to date.
dlangui 0.9.187: target for configuration "default" is up to date.
helloworld ~master: building configuration "application"...
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\graphics\resources.d(104,8): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\widgets\styles.d(28,16): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\3rdparty\dimage\png.d(585,1): Deprecation: Usage of the `body` keyword is deprecated. Use `do` instead.
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Copying files for dlangui...
Running helloworld.exe
Program exited with code -1073741701
Update #1:
Seems that it's a 64 bit build, and now I try a 32 bit build using dub build --arch=x86(as the comments suggest) it shows something different:
Performing "debug" build using D:\env\dmd2\windows\bin\dmd.exe for x86, x86_mscoff.
bindbc-loader 1.0.1: building configuration "noBC"...
derelict-ft 2.0.0-beta.5: building configuration "library"...
derelict-sdl2 3.0.0-beta.8: building configuration "derelict-sdl2-dynamic"...
inilike 1.2.1: building configuration "library"...
isfreedesktop 0.1.1: building configuration "library"...
xdgpaths 0.2.5: building configuration "library"...
icontheme 1.2.3: building configuration "library"...
dlangui 0.9.187: building configuration "default"...
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\3rdparty\dimage\png.d(585,1): Deprecation: Usage of the `body` keyword is deprecated. Use `do` instead.
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\graphics\resources.d(104,8): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\widgets\styles.d(28,16): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
helloworld ~master: building configuration "application"...
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\graphics\resources.d(104,8): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\src\dlangui\widgets\styles.d(28,16): Deprecation: module `std.xml` is deprecated - Will be removed from Phobos in 2.101.0. If you still need it, go to https://github.com/DigitalMars/undeaD
C:\Users\JinReal\AppData\Local\dub\packages\dlangui-0.9.187\dlangui\3rdparty\dimage\png.d(585,1): Deprecation: Usage of the `body` keyword is deprecated. Use `do` instead.
Linking...
lld-link: error: unknown directive: EXETYPE
Error: linker exited with status 1
I've read this post and found that there's no sourceFiles-windows entry in it so it doesn't seem to be the same issue.

Build and run a Qt application on macOS via Bazel

I tried to build and run a Qt5 (5.15.2) application on macOS (10.15.7) using Bazel 5.0.0.
Unfortunately, I run into some problems.
The building part seems to work, but not the run part.
I installed Qt5 on my machine using Homebrew:
brew install qt#5
brew link qt#5
I adapted https://github.com/justbuchanan/bazel_rules_qt/ to my needs. See this PR. When I try to run:
bazel run --cxxopt=-std=c++17 //tests/qt_resource:main
I receive the runtime error:
dyld: Symbol not found: __ZN10QByteArray6_emptyE
Steps to reproduce the issue:
# brew install bazel # Install Bazel
# brew install qt#5 # Install Qt5
git clone https://github.com/Vertexwahn/bazel_rules_qt.git
cd bazel_rules_qt
git checkout add-macos-support
bazel build --cxxopt=-std=c++17 //... # should work
bazel run --cxxopt=-std=c++17 //tests/qt_resource:main # should give you the error message
Nevertheless, building everything using bazel build --cxxopt=-std=c++17 //... seems to work.
I am not 100% sure if the link options -F/usr/local/opt/qt5/Frameworks and -framework QtCore, etc. are correct.
Maybe someone can confirm this.
Did I use the correct link options?
For me, it is a bit unclear what dependencies the main binary expects. I tried to copy QtCore.framework to the location of the main binary manually but this does not change the error message.
What files does the main binary expect?
If I try to run macdeployqt on my main binary I get also some errors. I do within my workspace root dir a cd bazel-bin/tests/qt_resource and run then /usr/local/opt/qt5/bin/macdeployqt main:
ERROR: Could not find bundle binary for "main"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't open file: (No such file or directory)\n"
WARNING:
WARNING: Could not find any external Qt frameworks to deploy in "main"
WARNING: Perhaps macdeployqt was already used on "main" ?
WARNING: If so, you will need to rebuild "main" before trying again.
ERROR: Could not find bundle binary for "main"
ERROR: "error: /Library/Developer/CommandLineTools/usr/bin/strip: can't open file: (No such file or directory)\n"
ERROR: ""
My hope was that macdeployqt would collect all needed resources for me. Any idea why this is not working?
How can macdeployqt be used to collect all needed dependencies for the main binary?
If I convert my main to an app via lipo -create -output universall_app main and do then a /usr/local/opt/qt5/bin/macdeployqt universall_app I get the same error message.
The CMake approach
To make sure that there is no general problem with my system setup I tried to use CMake to build a Qt5 application:
git clone https://github.com/euler0/mini-cmake-qt.git
cmake -DCMAKE_PREFIX_PATH=/usr/local/opt/qt5 .
make -j
This produces an example.app.
With a double click on this application bundle,
the application can be started.
This worked on my system.
Future directions
It seems that rules_apple can be used to create an application bundle.
I am not sure if I need to transform my Qt application binary to an app bundle to be able to execute it.
One could use --sandbox_debugto identify what Bazel is doing and dtruss for the CMake version to compare the differences.
I am currently not sure what trying to do next and hope for an easy solution. I am also fine with a Qt6 solution.
Update: Alternative Answer
It would also be helpful if someone can point out how to build a minimal Qt application using make only on macOS and a brew installed Qt5 or tell me what the linker and compiler options must look like.
I followed your steps with Mac OSX 10.15.7, Qt (installed by homebrew) 5.15.1 and both bazel 4.2.2-homebrew and 5.0.0-homebrew and initially I could not build the project from git:
* 3fe5f6c - (4 weeks ago) Add macOS support — Vertexwahn (HEAD -> add-macos-support, origin/add-macos-support)
This is the result that I get when building:
% bazel build --cxxopt=-std=c++17 //...
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed 14 targets (0 packages loaded, 0 targets configured).
INFO: Found 14 targets...
ERROR: /Users/home/Git/my_repo/bazel_rules_qt/tests/qt_qml/BUILD:4:10: Compiling tests/qt_qml/main.cc failed: (Aborted): wrapped_clang failed: error executing command external/local_config_cc/wrapped_clang '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' ... (remaining 38 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
tests/qt_qml/main.cc:1:10: fatal error: 'QtQml/QQmlApplicationEngine' file not found
#include <QtQml/QQmlApplicationEngine>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
INFO: Elapsed time: 0,594s, Critical Path: 0,32s
INFO: 3 processes: 3 internal.
FAILED: Build did NOT complete successfully
After playing around with headers and include paths in qt.BUILD:
diff --git a/qt.BUILD b/qt.BUILD
index 517c8db..8f110b5 100644
--- a/qt.BUILD
+++ b/qt.BUILD
## -28,11 +28,12 ## QT_LIBRARIES = [
cc_library(
name = "qt_%s_osx" % name,
# When being on Windows this glob will be empty
- hdrs = glob(["%s/**" % include_folder], allow_empty = True),
+ hdrs = glob(["include/%s/**" % include_folder], allow_empty = True),
includes = ["."],
linkopts = ["-F/usr/local/opt/qt5/lib"] + [
"-framework %s" % library_name.replace("5", "") # macOS qt libs do not contain a 5 - e.g. instead of Qt5Core the lib is called QtCore
],
+ strip_include_prefix= "include"
# Available from Bazel 4.0.0
# target_compatible_with = ["#platforms//os:osx"],
)
I could build and run the project:
% bazel build --cxxopt=-std=c++17 //...
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed 14 targets (1 packages loaded, 7422 targets configured).
INFO: Found 14 targets...
INFO: Elapsed time: 11,761s, Critical Path: 7,23s
INFO: 3 processes: 1 internal, 2 darwin-sandbox.
INFO: Build completed successfully, 3 total actions
% bazel run --cxxopt=-std=c++17 //tests/qt_resource:main
DEBUG: /private/var/tmp/_bazel_home/761aafaa2237a9607dd915f1f52bca3e/external/com_justbuchanan_rules_qt/qt_configure.bzl:43:14: Installation available on the default path: /usr/local/opt/qt5
INFO: Analyzed target //tests/qt_resource:main (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //tests/qt_resource:main up-to-date:
bazel-bin/tests/qt_resource/main
INFO: Elapsed time: 3,657s, Critical Path: 0,00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
opened resource file
file1
Related to your question whether the linker options are correct
-F/usr/local/opt/qt5/Frameworks -framework QtCore
Yes they are correct, you could alternatively use -F/usr/local/opt/qt5/lib (as you are already using in qt.BUILD) as all the files under the Frameworks folder are links to the lib folder.
With macdeployqt and lipo I get the same results as in the OP even after the test is running successfully.

Boost build fails after upgrade to 1.72.0 - same target twice

Hello great minds of stackoverflow. My project builds Boost via a CMake ExternalProject_Add command. The b2 build command is as follows:
b2 -j${num_processors} -d 0 --layout=versioned threading=multi architecture=x86 address-model=64 link=shared --with-system --with-thread --with-date_time --with-chrono --with-atomic variant=${config_type} --prefix=${UNRELEVANT_PATH} --stagedir=${UNRELEVANT_PATH} install stage
num_processors, config_type, and UNRELEVANT_PATH are CMake variables for the number of cores on the build machine, build variant type, and paths for installation. This command works for Boost 1.62 using gcc 4.8.1 and Visual Studio 2015. We're now upgrading to Boost 1.72.0 and it is failing with this error on both compilers:
Performing configuration checks
- default address-model : 64-bit
- default architecture : x86
- lockfree boost::atomic_flag : yes
error: Name clash for '<p/my/path/to/boost/lib/cmake/boost_atomic-1.72.0>boost_atomic-config.cmake'
error:
error: Tried to build the target twice, with property sets having
error: these incompatible properties:
error:
error: - none
error: - none
error:
error: Please make sure to have consistent requirements for these
error: properties everywhere in your project, especially for install
error: targets.
I've done nothing but replace the source files for boost from 1.62 to 1.72.0. I couldn't find any relevant differences in the b2 documentation between those versions. Did I miss something?
I've tried removing the --with-atomic flag and it just fails on the next library with the same error. I've tried different options for --layout, threading, and architecture with no luck. Any suggestions on what I should investigate further to resolve this?
Apparently I've been doing it wrong this whole time. You shouldn't set --prefix and --stagedir to the same location. Previous iterations of boost don't seem to care about this issue. One of the later versions started caring which caused my problem.

Rstudio, configure: error: GDALAllRegister not found in libgdal

I am a newbie and tried various methods already. I ran into problems from this one problem. please help. I think there are two problems here. 1) my c++ is not uptodate. 2) my GDALAllRegister not found in libgdal.
I am using mac 2017.
> install.packages("sf")
Installing package into ‘/Users/haoluo/Library/R/3.4/library’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is later:
binary source needs_compilation
sf 0.6-1 0.6-3 TRUE
Do you want to install from sources the package which needs compilation?
y/n: y
installing the source package ‘sf’
...
In file included from /usr/local/Cellar/gdal/HEAD-41888/include/gdal.h:42:
/usr/local/Cellar/gdal/HEAD-41888/include/cpl_port.h:187:6: error: Must have C++11 or newer.
# error Must have C++11 or newer.
^
1 error generated.
In file included from gdal_test.cpp:1:
In file included from /usr/local/Cellar/gdal/HEAD-41888/include/gdal.h:42:
/usr/local/Cellar/gdal/HEAD-41888/include/cpl_port.h:187:6: error: Must have C++11 or newer.
# error Must have C++11 or newer.
^
1 error generated.
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘sf’
* removing ‘/Users/haoluo/Library/R/3.4/library/sf’
Warning in install.packages :
installation of package ‘sf’ had non-zero exit status
I failed to read the prompt in the first place. Now the problem has been solved by simply answering n to the question Do you want to install from sources the package which needs compilation?
I want to thank #nicola again for the help!
enter image description here

Missing Jam file in fresh download of boost

I religiously follow http://www.boost.org/doc/libs/1_61_0/more/getting_started/windows.html.
After downloading and unpacking the 1.61 version of boost, I tried to build it from source with the instruction from section 5.1 in this guide.
So
bootstrap
.\b2
But then I get the error:
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory 'libs/config/checks/architecture'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile. [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
Exactly the same as Trac issue #12173 of boost.
What is going wrong? How can I make bjam find the jam files?
Bit out of date, but I was able to get this working by getting the config submodule:
git submodule update --init libs/config
It seems like the config module is an unlisted prerequisite for some of the other modules.
This error might happen when "bootstrap.jam" is trying to load the modules of the build system from a wrong path.
Make sure that BOOST_BUILD_PATH is set to "boost*/tools/build" and that BOOST_ROOT is unset.
Example of a WRONG config:
libtorrent-rasterbar-1.2.0>set BOOST_BUILD_PATH=..\boost_1_68_0
libtorrent-rasterbar-1.2.0>set BOOST_ROOT=..\boost_1_68_0
libtorrent-rasterbar-1.2.0>b2
Jamroot.jam:1: syntax error at EOF
CXXFLAGS =
LDFLAGS =
OS = NT
building boost from source directory: ..\boost_1_68_0
boost_1_68_0/tools/build/src/build\project.jam:262: in find-jamfile from module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory '../boost_1_68_0/libs/config/checks/architecture'.
error: Attempted to find it with pattern '[Bb]uild.jam [Jj]amfile.v2 [Jj]amfile [Jj]amfile. [Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
boost_1_68_0/tools/build/src/build\project.jam:325: in load-jamfile from module project
boost_1_68_0/tools/build/src/build\project.jam:64: in load from module project
boost_1_68_0/tools/build/src/build\project.jam:89: in load-used-projects from module project
boost_1_68_0/tools/build/src/build\project.jam:75: in load from module project
boost_1_68_0/tools/build/src/build\project.jam:89: in load-used-projects from module project
boost_1_68_0/tools/build/src/build\project.jam:75: in load from module project
boost_1_68_0/tools/build/src/build\project.jam:145: in project.find from module project
boost_1_68_0/tools/build/src\build-system.jam:618: in load from module build-system
..\boost_1_68_0\tools\build\src/kernel\modules.jam:295: in import from module modules
..\boost_1_68_0\tools\build\src/kernel/bootstrap.jam:139: in boost-build from module
..\boost_1_68_0\boost-build.jam:17: in module scope from module
Example of a FIXED config:
libtorrent-rasterbar-1.2.0>set BOOST_BUILD_PATH=..\boost_1_68_0\tools\build
libtorrent-rasterbar-1.2.0>set BOOST_ROOT=
libtorrent-rasterbar-1.2.0>b2
Jamroot.jam:1: syntax error at EOF
CXXFLAGS =
LDFLAGS =
OS = NT
warning: No toolsets are configured.
warning: Configuring default toolset "msvc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html
...patience...
...found 1058 targets...
...updating 163 targets...
msvc.write-setup-script bin\standalone\msvc\msvc-14.1\msvc-setup.bat
compile-c-c++ bin\msvc-14.1\debug\threading-multi\src\alert.obj
alert.cpp
...