EGui with glfw in rust - rust

Currently learning openGL in rust and decided to add e-gui, to make immediate changes.
Decided to use this crate: https://crates.io/crates/egui_glfw_gl/0.13.1
After adding it to Cargo.toml can't build or run.
PS opengl_t_2> cargo run
Compiling glfw-sys v3.3.5
error: failed to run custom build command for `glfw-sys v3.3.5`
Caused by:
process didn't exit successfully: `opengl_t_2\target\debug\build\glfw-sys-d98b92fc73a7f019\build-script-build` (exit code: 101)
--- stdout
CMAKE_TOOLCHAIN_FILE_x86_64-pc-windows-msvc = None
CMAKE_TOOLCHAIN_FILE_x86_64_pc_windows_msvc = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-pc-windows-msvc = None
CMAKE_GENERATOR_x86_64_pc_windows_msvc = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-pc-windows-msvc = None
CMAKE_PREFIX_PATH_x86_64_pc_windows_msvc = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-pc-windows-msvc = None
CMAKE_x86_64_pc_windows_msvc = None
HOST_CMAKE = None
CMAKE = Some("C:\\Program Files\\CMake\\bin\\")
running: "C:\\Program Files\\CMake\\bin\\" "C:\\Users\\Vasily\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\glfw-sys-3.3.5\\." "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DGLFW_BUILD_EXAMPLES=OFF" "-DGLFW_BUILD_TESTS=OFF" "-DGLFW_BUILD_DOCS=OFF" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_PREFIX=opengl_t_2\\target\\debug\\build\\glfw-sys-52652cf8f267b532\\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_DEBUG= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_DEBUG= -nologo -MD -Brepro"
"-DCMAKE_BUILD_TYPE=Debug"
--- stderr
thread 'main' panicked at '
failed to execute command: program path has no file name
Cargo.toml:
[dependencies]
cgmath = "0.16.1"
gl = "0.10.0"
image = "0.19.0"
tobj = "0.1.6"
num = "0.2.0"
rand = "0.5.5"
egui = "0.17.0"
egui_glfw_gl = "0.13.1"
[dependencies.glfw]
git = "https://github.com/bjz/glfw-rs.git"
default-features = false
Without egui-glfw, everything builds and I have a functional 3d scene.
File structure
I apologize, if this is a stupid question, but I have already tried everything.

CMAKE = Some("C:\\Program Files\\CMake\\bin\\")
For whatever reason, your CMAKE environmental variable is pointing to a directory rather than the cmake.exe binary.
Make sure that you have cmake installed, and edit your CMAKE envvar to point to it. Or remove it, if cmake is in your PATH.

Related

Internal Error: no cycle found in Scons Build

When I build my Sconstruct file, I am getting the below error.
scons: *** Found dependency cycle(s):
build/sselser/sselConfigArgs.h -> build/sselser/sselConfigArgs.h
Internal Error: no cycle found for node build/sselser/sselMain (<SCons.Node.FS.File instance at 0x9f61e8>) in state pending
Internal Error: no cycle found for node build/sselser/sselMain.o (<SCons.Node.FS.File instance at 0x9f2e68>) in state pending
File "/nfs/scons/scons-1.3.0/lib/scons-1.3.0/SCons/Taskmaster.py", line 1026, in cleanup
I guess this is due to dependency of sselMain in sselTransorm as the error occurs during the build of sselTransform directory.
Makefile in sselTransform:
UNIT_SUPPORT_FILES += ../sselser/sselMain intest ../../../make/Makenv
MDE_SUPPORT_FILES += ../sselser/sselMain intest ../../../make/Makenv
I need to add the same in Sconscript of sselTransform directory to resolve this issue.
How to resolve this issue?
Sconscript:
#Set CPPPATH, RPATH, DEFINES and CCFLAGS
env = Environment(CPPPATH =['.','../sselTransform','../sselSm','../sselSRC'],
RPATH = ['/l-n/app/colr/lib/infra/SunOS5.10/WS12.0'],CPPDEFINES = ['THREADSAFE','_RWSTD_SOLARIS_THREADS','_SVID_GETTO
D','DEBUG','sun5'],CCFLAGS = ['library=rwtools7_std','features=no%tmplife','-pta','-mt','-xdebugformat=stabs','-g0','-xildoff'])
env['CXX']=CXX
Src = Split('sselManager.C PromoNotifyMgr.C ')
env.StaticLibrary('libSselser-g0.a',Src)
Src1 = Split('sselMain.C sselManager.o PromoNotifyMgr.o ')
env.Program('sselMain',Src1)
configfile = 'sselConfigArgs.h'
CONFIG_PATH = '../../build/include/'
CONFIG=CONFIG_PATH+configfile
env.Command(CONFIG,configfile,
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', 0444)])
Sconstruct:
SConscript('src/ssel/sselser/SConscript',variant_dir='build/sselser',duplicate=0,exports='env')
Try this?
Notes:
I'm saving the build objects for your two source files and using those in both the program and static library.
I've added the target dir you're copying the header file to earlier in the CPPPATH.
You could have skipped the variables configfile, CONFIG_PATH, CONFIG and just used the strings in your Command.
You are using a VERY old version of SCons. If you're limited to python 2.7 please try using SCons 3.0.1? If you're not and can use Python 3.6, then try using SCons 4.3.0.
#Set CPPPATH, RPATH, DEFINES and CCFLAGS
env = Environment(
CPPPATH =['.','../include','../sselTransform','../sselSm','../sselSRC'],
RPATH = ['/l-n/app/colr/lib/infra/SunOS5.10/WS12.0'],
CPPDEFINES = ['THREADSAFE','_RWSTD_SOLARIS_THREADS','_SVID_GETTOD','DEBUG','sun5'],
CCFLAGS = ['library=rwtools7_std','features=no%tmplife','-pta','-mt','-xdebugformat=stabs','-g0','-xildoff'])
env['CXX']=CXX
Src = ['sselManager.C','PromoNotifyMgr.C']
objects = []
for s in Src:
objects.extend(env.StaticObject(s))
env.StaticLibrary('Sselser-g0',objects)
Src1 = ['sselMain.C'] + objects
env.Program('sselMain', Src1)
configfile = 'sselConfigArgs.h'
CONFIG_PATH = '../include/'
CONFIG=CONFIG_PATH+configfile
env.Command(CONFIG, configfile,
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', 0444)])

Solana Rust smart contract build error: build failed

I am a beginner Solana/Rust developer.
As my first Solana project, I built the mint NFT contract.
And then I want to deploy the contract.
So to get the compiled output .so file, I did run like: cargo build,
but getting this error:
warning: cc: warning: src/main.rs: linker input file unused because linking not done
warning: ar: /home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/src/main.o: No such file or directory
error: failed to run custom build command for `solana-nft v0.1.0 (/home/rango/my_tasks/mintdropz/solana-nft-contract)`
Caused by:
process didn't exit successfully: `/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-cbb36a23539fa380/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/main.rs
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/src/main.o" "-c" "src/main.rs"
cargo:warning=cc: warning: src/main.rs: linker input file unused because linking not done
exit status: 0
AR_x86_64-unknown-linux-gnu = None
AR_x86_64_unknown_linux_gnu = None
HOST_AR = None
AR = None
running: "ar" "cq" "/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/libhello.a" "/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/src/main.o"
cargo:warning=ar: /home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/src/main.o: No such file or directory
exit status: 1
--- stderr
error occurred: Command "ar" "cq" "/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/libhello.a" "/home/rango/my_tasks/mintdropz/solana-nft-contract/target/debug/build/solana-nft-7f2fc6a536921641/out/src/main.o" with args "ar" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
error: build failed
this is build.rs file:
// Example custom build script.
fn main() {
// Tell Cargo that if the given file changes, to rerun this build script.
println!("cargo:rerun-if-changed=src/main.rs");
// Use the `cc` crate to build a C file and statically link it.
cc::Build::new()
.file("src/main.rs")
.compile("hello");
}
this is Cargo.toml file:
[package]
name = "solana-nft"
version = "0.1.0"
edition = "2018"
[dependencies]
solana-client = "1.7.8"
solana-sdk = "1.7.8"
spl-token = { version = "3.2.0", features = [ "no-entrypoint" ] }
rand = "0.8.4"
solana-program = "1.7.11"
spl-token-metadata = "0.0.1"
openssl = { version = "0.10", features = ["vendored"] }
[build-dependencies]
cc = "1.0"
bindgen = "0.53.1"
I am using ubuntu 18.04, cargo 1.56.0 .
What am I doing wrong?
If you are trying to build a Rust Solana Program (i.e. Smart Contract) you only need to cargo build-bpf as Programs get compiled to BPF through LLVM and that is what is deployed on Solana
This seems to be a compatible issue. install the latest version of rustc
Also when u install the solana toolkit:
sh -c "$(curl -sSfL https://release.solana.com/v1.9.5/install)"
Make sure you update your PATH environment variable to include the solana programs:
I think Solana stable version solves your problem.
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

How to use android ndk to compile glib 2.66 with meson?

Enviroment:
Compiler: android-ndk-r21b, api 24
Ubuntu 20.04
Glib 2.66
I have built iconv, and have built glib 2.56 with make successfully, now i try to build glib 2.66 with meson, i build i run this script:
OUTDIR=$HOME/work/ndk/builddir/out
CC=arm-linux-androideabi-gcc CFLAGS="-L$OUTDIR/lib -I$OUTDIR/include" LDFLAGS="-L$OUTDIR/lib" LIBS="-liconv" CXXFLAGS="-L$OUTDIR/lib" meson release/ \
--cross-file cross_file.txt \
--prefix=$OUTDIR \
but compile error:
Header <iconv.h> has symbol "iconv_open" : YES
meson.build:1930:4: ERROR: C shared or static library 'iconv' not found
A full log can be found at /home/git/work/ndk/builddir/glib-2.66.4/reconfigure/meson-logs/meson-log.txt
cross_file.txt:
[host_machine]
system = 'android'
cpu_family = 'arm'
cpu = 'arm'
endian = 'little'
[constants]
android_ndk = '/home/git/work/ndk/toolchain/bin/'
toolchain = '/home/git/work/ndk/toolchain/bin/arm-linux-androideabi-'
outdir = '/home/git/work/ndk/builddir/out/'
[binaries]
c = android_ndk + 'arm-linux-androideabi-gcc'
cpp = android_ndk + 'arm-linux-androideabi-g++'
ar = android_ndk + 'arm-linux-androideabi-ar'
ld = android_ndk + 'arm-linux-androideabi-ld'
c_ld = android_ndk + 'arm-linux-androideabi-ld'
objcopy = android_ndk + 'arm-linux-androideabi-objcopy'
strip = android_ndk + 'arm-linux-androideabi-strip'
pkgconfig = '/usr/bin/pkg-config'
[built-in options]
c_std = 'c11'
libdir = '/home/git/work/ndk/builddir/out/lib'
prefix = '/home/git/work/ndk/builddir/out/'
c_args = ['-L/home/git/work/ndk/builddir/out/lib', '-I/home/git/work/ndk/builddir/out/include']
cpp_args = ['-L/home/git/work/ndk/builddir/out/lib', '-I/home/git/work/ndk/builddir/out/include']
c_link_args = ['-I/home/git/work/ndk/builddir/out/include', '-L/home/git/work/ndk/builddir/out/lib']
pkg_config_path = '/home/git/work/ndk/builddir/out/lib/pkgconfig'
I've got it. I shouldn't set the c_ld variable. And there is a bug in meson scripts of gio, so i must apt remove libelf-dev on ubuntu(or modify gio/meson.build).
Visit my github to get config file:
https://github.com/edaplayer/android-ndk-harfbuzz/blob/main/glib-2.66.4/build_glib_meson.sh
https://github.com/edaplayer/android-ndk-harfbuzz/blob/main/glib-2.66.4/cross_file.txt

New Yocto Recipe Builds but Work Directory is Deleted after Compilation

I am trying to update the recipe for zbar from 0.10.0 to 0.20.1. Here is the original recipe:
https://github.com/openembedded/meta-openembedded/blob/master/meta-oe/recipes-support/zbar/zbar_0.10.bb
My modified recipe is at the bottom of this question. The package does compile, but the problem is that something happens during the "packaging" step and the "work" directory is wiped out except for the "temp" directory inside the "work" directory. During compilation, if I list the files in the work directory, everything I expect is present, but after compilation succeeds, something cleans the files up. What am I doing wrong?
During compilation:
user#ubuntu:~/rpi/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/zbar/0.20.1-r0$ cd ../0.20.1-r0/ ; ls
build image pkgdata sysroot-destdir
configure.sstate license-destdir pseudo temp
debugsources.list package recipe-sysroot
git packages-split recipe-sysroot-native
After Compilation:
user#ubuntu:~/rpi/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/zbar/0.20.1-r0$ cd ../0.20.1-r0/ ; ls
temp
Yocto Recipe:
DESRIPTION = "2D barcode scanner toolkit."
SECTION = "graphics"
LICENSE = "LGPL-2.1"
DEPENDS = "pkgconfig intltool-native libpng jpeg"
LIC_FILES_CHKSUM = "file://LICENSE;md5=243b725d71bb5df4a1e5920b344b86ad"
S = "${WORKDIR}/git"
SRCREV = "edcf08b49e0a5fe71c18fa9d4b8ed83ed8fc9082"
SRC_URI = "git://github.com/mchehab/zbar.git"
inherit autotools pkgconfig
EXTRA_OECONF = " --without-x --without-imagemagick --without-qt --without-python2 --disable-video --without-gtk"
FILES_${PN} += "${bindir}"
FILES_${PN} += "${libdir}"
do_install_append() {
echo "done..."
}
This is because of the rm_work class. You can remove,
INHERIT += "rm_work"
this from local.conf or in according image recipe file. Or you can disable the rm_work only for your recipe using,
RM_WORK_EXCLUDE += "zbar"
in conf/local.conf.

Scons compiler path contains spaces

I have a toolchain, not on the path, installed at a location containing spaces (C:\Program Files\Some Compiler\). I've tried:
env = Environment(
MY_TOOLCHAIN_ROOT = R'C:\Program Files\Some Compiler\',
MY_TOOLCHAIN_BIN = R'$MY_TOOLCHAIN_ROOT\bin',
)
env.Replace(
CC = "$MY_TOOLCHAIN_BIN/gcc",
CXX = "$MY_TOOLCHAIN_BIN/g++",
OBJCOPY = "$MY_TOOLCHAIN_BIN/objcopy"
)
env.Program('main.cpp')
But I get the error
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
How can I get scons to quote the spaces?
Seems I need to mark them as Files:
env.Replace(
CC = env.File("$MY_TOOLCHAIN_BIN/gcc"),
CXX = env.File("$MY_TOOLCHAIN_BIN/g++"),
OBJCOPY = env.File("$MY_TOOLCHAIN_BIN/objcopy")
)
I think the problem is with the os style variables you are using with the $. Instead of specifying them with the env.File() (Im surprised it handled the variables), you could consider some simple python code as follows:
import os
env = Environment(
MY_TOOLCHAIN_ROOT = R'C:\Program Files\Some Compiler\',
MY_TOOLCHAIN_BIN = R'$MY_TOOLCHAIN_ROOT\bin',
)
env.Replace(
CC = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "gcc"),
CXX = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "g++"),
OBJCOPY = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "objcopy")
)

Resources