I'am trying to run a scaffolded Yesod site with MySQL (on Ubuntu 16.04). But when I try to run it with devel the following error occurs:
app/devel.hs:2:1: error:
Failed to load interface for ‘Application’
It is not a module in the current program, or in any known package.
Unexpected: child process exited with ExitFailure 1
I have tried it using (from inside the project folder):
stack exec -- yesod devel
yesod devel
Both producing the error.
It does work running the app normaly
stack install
stack exec my-project
I had this exact error and tried deleting the project and regenerating it to no luck. However, once I upgraded stack it worked perfectly:
$ stack upgrade
Current Stack version: 1.3.2, available download version: 1.4.0
Newer version detected, downloading
...
$ stack exec -- yesod devel
...
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
Starting devel application
Devel application launched: http://localhost:3000
lucas#lucas-ms-7673:~/Data/Projecten/basicwebsite$ stack clean
lucas#lucas-ms-7673:~/Data/Projecten/basicwebsite$ yesod devel
Yesod devel server. Enter 'quit' or hit Ctrl-C to quit.
Application can be accessed at:
http://localhost:3000
https://localhost:3443
If you wish to test https capabilities, you should set the following variable:
export APPROOT=https://localhost:3443
basicwebsite-0.0.0: unregistering (local file changes: Application.hs
Foundation.hs Handler/Comment.hs Handler/Common.hs Handler/Home.hs
Handler/Profile...)
basicwebsite-0.0.0: configure (lib)
Configuring basicwebsite-0.0.0...
basicwebsite-0.0.0: build (lib)
Preprocessing library basicwebsite-0.0.0...
[ 1 of 11] Compiling Settings ( Settings.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Settings.o )
[ 2 of 11] Compiling Settings.StaticFiles ( Settings/StaticFiles.hs,.stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Settings/StaticFiles.o )
[ 3 of 11] Compiling Model ( Model.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Model.o )
[ 4 of 11] Compiling Import.NoFoundation ( Import/NoFoundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Import/NoFoundation.o )
[ 5 of 11] Compiling Foundation ( Foundation.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Foundation.o )
[ 6 of 11] Compiling Import ( Import.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Import.o )
[ 7 of 11] Compiling Handler.Comment ( Handler/Comment.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Comment.o )
[ 8 of 11] Compiling Handler.Common ( Handler/Common.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Common.o )
[ 9 of 11] Compiling Handler.Home ( Handler/Home.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Home.o )
[10 of 11] Compiling Handler.Profile ( Handler/Profile.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Handler/Profile.o )
[11 of 11] Compiling Application ( Application.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0/build/Application.o )
basicwebsite-0.0.0: copy/register
Installing library in
/home/lucas/Data/Projecten/basicwebsite/.stack-work/install/x86_64-linux/lts-8.5/8.0.2/lib/x86_64-linux-ghc-8.0.2/basicwebsite-0.0.0-TYYyVjSz8i3CoGALY18CQ
Registering basicwebsite-0.0.0...
ExitSuccess
Type help for available commands. Press enter to force a rebuild.
app/devel.hs:2:1: error:
Failed to load interface for ‘Application’
It is not a module in the current program, or in any known package.
Unexpected: child process exited with ExitFailure 1
Trying again
lucas#lucas-ms-7673:~/Data/Projecten/basicwebsite$ stack exec ghc-pkg list basicwebsite
/home/lucas/.stack/programs/x86_64-linux/ghc-8.0.2/lib/ghc-8.0.2/package.conf.d
(no packages)
/home/lucas/.stack/snapshots/x86_64-linux/lts-8.5/8.0.2/pkgdb
(no packages)
/home/lucas/Data/Bedrijf/Projecten/basicwebsite/.stack-work/install/x86_64-linux/lts-8.5/8.0.2/pkgdb
basicwebsite-0.0.0
Related
I am using msys64 with GCC11.3 on a Win 10 64 bit machine to build GDB12.1 with:
$GDB_SRCDIR/$GDB_VERSION/configure --target=$TARGET --with-expat=yes --enable-static=yes --with-python> configure.log 2>&1
make > make.log 2>&1
My host is x86_64-w64-mingw32 and my target is i686-elf
I need to deliver only GDB with Python support, without installing msys64 on the customers machine. When I start GDB, with enabled msys64 I get correct GDB:
I also have a preinstalled GDB10.1 from another package with current settings:
Notice on GDB10.1: it works without having python installed localy.
What I need is the option to build GDB12.1 with settings from GDB10.1, instead as in GDB12.1
--with-python=C:/msys64/mingw64
--with-python-libdir=C:/msys64/mingw64/lib
I need following as in GDB10.1:
--with-python=/mingw64 (relocatable)
--with-python-libdir=/mingw64/lib (relocatable)
I have an start script for starting GDB12.1 with following code:
python
import sys
import os
sys.path.insert (0, "\\Python")
sys.path.append ("\\lib")
sys.path.append ("\\share")
end
In my installation I have following folders:
bin - containing built GDB with needed DLLS
lib - containing libraries from Python 3.9.12 installation
Python - containing GDB and libstdcxx support scripts
share - containing support from GCC11.3
The folder structure is following:
->gdb-12.1
-->bin
-->lib
-->Python
-->share
When I rename msys64, and I try to start GDB12.1 I got following error:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'c:\msys64\mingw64/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'c:\\msys64\\mingw64/bin/python'
sys.base_prefix = 'D:\\a\\msys64\\mingw64'
sys.base_exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.platlibdir = 'lib'
sys.executable = 'c:\\msys64\\mingw64/bin/python'
sys.prefix = 'D:\\a\\msys64\\mingw64'
sys.exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.path = [
'D:\\a\\msys64\\mingw64\\lib\\python39.zip',
'D:\\a\\msys64\\mingw64\\lib\\python3.9',
'D:\\a\\msys64\\mingw64\\lib\\lib-dynload',
'',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000a5a0 (most recent call first):
<no Python frame>
What do I want, or need? I want to build GDB12.1 with flags as in the distributed GDB10.1:
--with-python=/mingw64 (relocatable)
--with-python-libdir=/mingw64/lib (relocatable)
How should I build GDB12.1 to get those options??
Or, is there any other way to get Python support inside GDB12.1 without installed Python?
The problem that I have is, when connecting to a target, by building GDB which is built --with-python=C:\Python39\, and disabling C:\Python39 and C:\msys64, GDB12.1 works, but I can not send CTRL+C to GDB, which is essential to the work that has to be done. Is there a way to send CTRL+C to GDB??
Any help would be nice.
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.
I am trying to build gRPC c++ from source from Build gRPC C++
I have already installed bazel.
Though when I tried to build I am seeing following error.
$ bazel build :all
Starting local Bazel server and connecting to it...
ERROR: /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl:39:25: Traceback (most recent
call last):
File "/home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl", line 37
repository_rule(<2 more arguments>)
File "/home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/io_bazel_rules_python/python/pip.bzl", line 39, in repositor
y_rule
attr.label(allow_files = True, <2 more arguments>)
'single_file' is no longer supported. use allow_single_file instead. You can use --incompatible_disable_deprecated_attr_params=false to temporarily disable th
is check.
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
ERROR: error loading package '': Extension file 'python/pip.bzl' has errors
INFO: Elapsed time: 7.505s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Could someone point what I am missing here.
When I tried to run bazel info, I am getting following error.
$ bazel info --incompatible_disable_deprecated_attr_params=false
ERROR: /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/protobuf/internal/proto_compile.bzl:771:21: name 'FileType' is not defined
ERROR: error loading package '': in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/python/rules.bzl: in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/cpp/rules.bzl: in /home/bigz/.cache/bazel/_bazel_bigz/a68d37101a3d172c639dd67a1941f719/external/org_pubref_rules_protobuf/protobuf/rules.bzl: Extension 'protobuf/internal/proto_compile.bzl' has errors
Though bazel --version shows as bazel 2.0.0.
$ bazel --version
bazel 2.0.0
The latest commit of gRPC is 9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14
$ git log -1
commit 9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14 (HEAD, tag: v1.20.0)
Merge: 1b488f8361 ae72bf76b3
Author: Lidi Zheng <scallopsky#gmail.com>
Date: Mon Apr 15 15:38:24 2019 -0700
Merge pull request #18760 from lidizheng/v1.20.x
Bump version to v1.20.0
The commit of grpc you are trying to build is not compatible with the version of bazel you have installed (2.0.0).
The commit 9dfbd34f5c0b20bd77658c73c59b9a3e4e8f4e14 is quite old (15 April 19), where the HEAD of that repo (at the time of writing this) is at eba60d8dbe4099c34b8097b2c89998d4484740ac, which now in BUILDING.md shows you need at least version 1.0.0 (there is a bazel wrapper at tools/bazel that will intercept and use 1.0.0 anyway)
For your specific commit however, trying different versions, I was able to build :all label with bazel version 0.20.0
I'd recommend trying bazelisk. You can add it to your PATH, add a .bazelversion file to the repository and bazelisk will take care of downloading the required bazel version.
I have a problem with run my c++ tensorflow app directly after reboot ubuntu.
normally I build app by bazel build
bazel build -c opt --local_resources 3072,4.0,1.0 --verbose_failures --config=monolithic //tensorflow/app/...
after build, when I execute
bazel-bin/tensorflow/app/run
everything is work perfectly but, when I reboot ubuntu and execute firstly bazel-bin I have spam of this errors.
May 11 12:29:05 tegra-ubuntu start.sh[800]: 2018-05-11 12:29:04.622723: E tensorflow/stream_executor/cuda/cuda_driver.cc:967] failed to alloc 2304 bytes on host: CUDA_ERROR_UNKNOWN
May 11 12:29:05 tegra-ubuntu start.sh[800]: 2018-05-11 12:29:04.622849: E tensorflow/stream_executor/cuda/cuda_driver.cc:967] failed to alloc 2304 bytes on host: CUDA_ERROR_UNKNOWN
I guess that is a problem in loaded packages. When bazel build is executing before bazel-run, loading packages is correct.
There is a way to only load missing packages without earlier building? I need to run app immediately after start but my building process is to long to building before run app
Solution:
SessionOptions opts;
opts.config.mutable_gpu_options()->set_allow_growth(true);
session->reset(tensorflow::NewSession(opts));
Does enabling gpu_options.allow_growth fix the problem?
https://devtalk.nvidia.com/default/topic/1029742/tensorflow-1-6-not-working-with-jetpack-3-2/
I have installed haskell stack and I'm trying to setup ghc for the same. stack version is
stack --version
Version 1.5.1, Git revision 600c1f01435a10d127938709556c1682ecfd694e (4861 commits) x86_64 hpack-0.17.1
I have updated the ~/.stack/global-project/stack.yaml as below
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project. Settings here do _not_ act as
# defaults for all projects. To change stack's default settings, edit
# '/home/rajkumar/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
flags: {}
extra-package-dbs: []
packages: []
extra-deps: []
resolver: ghc-8.2.1
Then I run stack setup command and got the below error -
> stack setup
The GHC located at /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.1/bin/ghc failed to compile a sanity check. Please see:
http://docs.haskellstack.org/en/stable/install_and_upgrade/
for more information. Exception was:
Running /home/user/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.1/bin/ghc /tmp/stack-sanity-check6389/Main.hs -no-user-package-db in directory /tmp/stack-sanity-check6389/ exited with ExitFailure 1
[1 of 1] Compiling Main ( /tmp/stack-sanity-check6389/Main.hs, /tmp/stack-sanity-check6389/Main.o )
Linking /tmp/stack-sanity-check6389/Main ...
/usr/bin/ld.bfd: cannot find -lgmp
collect2: error: ld returned 1 exit status
`gcc' failed in phase `Linker'. (Exit code: 1)
How can I resolve this issue?
I am able to resolve this error.
Verify gmp is installed already on opensuse linux using the below command.
sudo ldconfig -p | grep libgmp
libgmp.so.10 (libc6,x86-64) => /usr/lib64/libgmp.so.10
If not present install it using below command
sudo zypper install libgmp10
create link for the lib file in the same folder. Example
sudo ln /usr/lib64/libgmp.so.10 /usr/lib64/libgmp.so
Hope this helps for someone.