SCons does not find file it should build itself - scons

I have a simple SConstruct file to build the google test library with MinGW:
env = Environment(platform='posix') # necessary to use gcc and not MS
env.Append(CPPPATH=['googletest/'])
env.Append(CCFLAGS=[('-isystem', 'googletest/include/'), '-pthread'])
obj = env.Object(source='googletest/src/gtest-all.cc')
# linking skipped due to error search
# env.Append(LINKFLAGS=['-rv'])
# bin = env.StaticLibrary(target='libgtest', source=[obj])
The script resides in the main googletest\ folder. When running it - with or without linking - the output is this:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o googletest\src\gtest-all.o -c -isystem googletest/include/ -pthread -Igoogletest googletest\src\gtest-all.cc
scons: *** [googletest\src\gtest-all.o] The system cannot find the file specified
+-.
+-googletest
| +-googletest\src
| +-googletest\src\gtest-all.cc
| +-googletest\src\gtest-all.o
| | +-googletest\src\gtest-all.cc
| | +-googletest\src\gtest-death-test.cc
| | +-googletest\src\gtest-filepath.cc
| | +-googletest\src\gtest-port.cc
| | +-googletest\src\gtest-printers.cc
| | +-googletest\src\gtest-test-part.cc
| | +-googletest\src\gtest-typed-test.cc
| | +-googletest\src\gtest.cc
| | +-googletest\src\gtest-internal-inl.h
| +-googletest\src\gtest-death-test.cc
| +-googletest\src\gtest-filepath.cc
| +-googletest\src\gtest-internal-inl.h
| +-googletest\src\gtest-port.cc
| +-googletest\src\gtest-printers.cc
| +-googletest\src\gtest-test-part.cc
| +-googletest\src\gtest-typed-test.cc
| +-googletest\src\gtest.cc
| +-googletest\src\libgtest-all.a
| +-googletest\src\gtest-all.o
| +-googletest\src\gtest-all.cc
| +-googletest\src\gtest-death-test.cc
| +-googletest\src\gtest-filepath.cc
| +-googletest\src\gtest-port.cc
| +-googletest\src\gtest-printers.cc
| +-googletest\src\gtest-test-part.cc
| +-googletest\src\gtest-typed-test.cc
| +-googletest\src\gtest.cc
| +-googletest\src\gtest-internal-inl.h
+-SConstruct
scons: building terminated because of errors.
I also tried to build the library in one line: env.StaticLibrary(source='googletest/src/gtest-all.cc') - the result is the same.
Just executing the actuall g++ call gives me the object file I want.
What confuses me is that SCons should see the object file as an artifact it creates itself. I wondering why it tries to use it before it is finished. So what am I missing here? How can I make SCons wait until the compiling is done?
BTW: I just have some experience in using SCons and and did tweak a script once a while - but I do not really have profound knowledger about it.
Versions used: SCons 3.0.1, Python 3.6.3, MinGW 7.3.0

Does this work?
env = Environment(tools=['mingw','gnulink','ar']) # You should specify the tools
env.Append(CPPPATH=['googletest/'])
env.Append(CCFLAGS=[('-isystem', 'googletest/include/'), '-pthread'])
obj = env.Object(source='googletest/src/gtest-all.cc')
# linking skipped due to error search
# env.Append(LINKFLAGS=['-rv'])
# bin = env.StaticLibrary(target='libgtest', source=[obj])

Related

Bitbucket Pipelines export into variable using jq and xq causes error

When i running a pipeline in bitbucket i want to export into variable using
export APEX_CLASSES=$(xq . < package/package.xml | jq '.Package.types | [.] | flatten | map(select(.name=="ApexClass")) | .[] | .members | [.] | flatten | map(select(. | index("*") | not)) | unique | join(",")' -r)
but i got error in pipeline
parse error: Invalid numeric literal at line 1, column 5
i tried to identify a error but i always get same error :(
When i add a escape \ before " i got this error
jq: error: syntax error, unexpected INVALID_CHARACTER (Unix shell quoting issues?) at <top-level>, line 1:
.Package.types | [.] | flatten | map(select(.name==\"ApexClass\")) | .[] | .members | [.] | flatten | map(select(. | index(\"*\") | not)) | unique | join(\",\")
jq: 1 compile error
This is package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>AccountHelper</members>
<members>BoatHelper</members>
<members>CaseHelper</members>
<name>ApexClass</name>
</types>
<version>57.0</version>
</Package>

Rust compilation errors on installaton of libcst on alpine python

trying to install python modules on alpine linux using 3.7.9 image of alpine-python
Not able to find any solution on how to get the below issues resolved, any assistance would help a lot.
error[E0658]: or-patterns syntax is experimental
6908 --> libcst/src/tokenizer/core/mod.rs:944:25
6909 |
6910 944 | / '\n'
6911 945 | | | '\\'
6912 946 | | | '\''
6913 947 | | | '"'
6914 ... |
6915 958 | | | 'u'
6916 959 | | | 'U',
6917 | |_____________________________^
6918 |
6919 = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
6920
6921 error[E0658]: or-patterns syntax is experimental
6922 --> libcst/src/tokenizer/core/mod.rs:976:33
6923 |
6924 976 | if let Some('"' | '\'') = self.text_pos.peek() {
6925 | ^^^^^^^^^^
6926 |
6927 = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
6928
6929 error[E0658]: or-patterns syntax is experimental
6930 --> libcst/src/parser/grammar.rs:3203:14
6931 |
6932 3203 | e # (Expression::Integer(_) | Expression::Float(_)) => Ok(e),
6933 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6934 |
6935 = note: see issue #54883 <https://github.com/rust-lang/rust/issues/54883> for more information
6936
6937 error[E0658]: use of unstable library feature 'split_inclusive'
6938 --> libcst/src/tokenizer/whitespace_parser.rs:84:26
6939 |
6940 84 | lines: input.split_inclusive(default_newline).collect(),
6941 | ^^^^^^^^^^^^^^^
6942 |
6943 = note: see issue #72360 <https://github.com/rust-lang/rust/issues/72360> for more information
6944
6945 error: aborting due to 4 previous errors
6946
6947 For more information about this error, try `rustc --explain E0658`.
6948 error: could not compile `libcst`.
6949
6950 Caused by:
6953 error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path native/libcst/Cargo.toml --release -v --features pyo3/extension-module -- --crate-type cdylib` failed with code 101
6954 [end of output]
6955
6956 note: This error originates from a subprocess, and is likely not a problem with pip.
6957 ERROR: Failed building wheel for libcst
“use of unstable library feature” and “syntax is experimental” indicate you are using a version of the Rust compiler older than that required for this program.
or_patterns was stabilized in Rust 1.53. split_inclusive was stabilized in Rust 1.51 (look at the version number on the right side of the method entry).
You will need to install Rust 1.53 or newer. Right now, you are using a version that is more than a year old.

Scons custom dependency scanner not called for .cpp files

I have a scons project directory containing following files:
dep.txt
main.cpp
SConstruct
content of SConstruct:
env = Environment()
def f_scan(node, env, path):
print("[.] Scanner invoked. -> %s" % str(node))
return env.File(["dep.txt"])
fscan = Scanner(function = f_scan, skeys = ['.o', '.cpp'])
env.Append(SCANNERS = fscan)
env.Program('main', ['main.cpp'])
content of main.cpp:
#include <iostream>
using namespace std;
int main(){
cout << 1 << endl;
return 0;
}
content in dep.txt does not have any specific meaning.
scons -Q output(if dep.txt was changed after last build):
[.] Scanner invoked. -> main.o
g++ -o main main.o
scons -Q output(if dep.txt was not changed after last build):
[.] Scanner invoked. -> main.o
scons: `.' is up to date.
I am trying to implement a custom scanner for .cpp files. I want to add extra dependencies for all .cpp files on top of one that is detected by inbuilt Scanner. But I notice that scanner never called on .cpp files. However, it gets called correctly for .o files.
From the manpage: https://scons.org/doc/production/HTML/scons-man.html#scanner_objects
Note that scons has a global SourceFileScanner object that is used by
the Object, SharedObject and StaticObject builders to decide which
scanner should be used for different file extensions. You can use the
SourceFileScanner.add_scanner() method to add your own Scanner object
to the SCons infrastructure that builds target programs or libraries
from a list of source files of different types:
So if you change to:
env = Environment(CPPPATH=['.'])
def f_scan(node, env, path):
print("[.] Scanner invoked. -> %s" % str(node))
return env.File(["dep.txt"])
fscan = Scanner(f_scan)
SourceFileScanner.add_scanner('.cpp', fscan)
SourceFileScanner.add_scanner('.o', fscan)
env.Program('main', ['main.cpp'])
Note that you are not adding to the scanners applied to .cpp and .o, you are replacing them.
So if I create an x.h and change main.cpp to:
#include <iostream>
#include "x.h"
using namespace std;
int main(){
cout << 1 << endl;
return 0;
}
You will see this:
% python ~/devel/scons/git/as_scons/scripts/scons.py --tree=prune
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[.] Scanner invoked. -> main.o
[.] Scanner invoked. -> main.cpp
g++ -o main.o -c -I. main.cpp
[.] Scanner invoked. -> main.o
g++ -o main main.o
+-.
+-SConstruct
+-dep.txt
+-main
| +-main.o
| | +-main.cpp
| | +-dep.txt
| | +-/usr/bin/g++
| +-dep.txt
| +-/usr/bin/g++
+-main.cpp
+-[main.o]
scons: done building targets.
Whereas without your custom scanner:
% python ~/devel/scons/git/as_scons/scripts/scons.py --tree=prune
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o main main.o
+-.
+-SConstruct
+-main
| +-main.o
| | +-main.cpp
| | +-x.h
| | +-/usr/bin/g++
| +-/usr/bin/g++
+-main.cpp
+-[main.o]
+-x.h
scons: done building targets.
So what you likely want is to still call the existing scanner and add your file to it:
env = Environment(CPPPATH=['.'])
# get existing .cpp scanner
origin_cpp_scanner = SourceFileScanner.function['.cpp']
def f_scan(node, env, path):
filename = str(node)
print("[.] Scanner invoked. -> %s" % filename)
if filename.endswith('.cpp'):
current_files = origin_cpp_scanner(node, env, path)
else:
current_files = []
print("Files:%s"%[str(f) for f in current_files])
return current_files + env.File(["dep.txt"])
fscan = Scanner(f_scan)
SourceFileScanner.add_scanner('.cpp', fscan)
SourceFileScanner.add_scanner('.o', fscan)
env.Program('main', ['main.cpp'])
Which then yields:
% python ~/devel/scons/git/as_scons/scripts/scons.py --tree=prune
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
[.] Scanner invoked. -> main.o
Files:[]
[.] Scanner invoked. -> main.cpp
Files:['x.h']
g++ -o main.o -c -I. main.cpp
[.] Scanner invoked. -> main.o
Files:[]
g++ -o main main.o
+-.
+-SConstruct
+-dep.txt
+-main
| +-main.o
| | +-main.cpp
| | +-x.h
| | +-dep.txt
| | +-/usr/bin/g++
| +-dep.txt
| +-/usr/bin/g++
+-main.cpp
+-[main.o]
+-x.h
scons: done building targets.

get error when getting beta version with fastlane

When I release beta with fastlane in React native project build_app, I have this problem.
platform :ios do
desc "Push a new beta build to TestFlight"
lane :beta do
increment_build_number(xcodeproj: "TestApp.xcodeproj")
build_app(
workspace: "TestApp.xcworkspace",
scheme: "TestApp",
include_bitcode: true)
end
end
[14:13:21]: Error packaging up the application
------+------------------------+-------------+
| fastlane summary |
+------+------------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | increment_build_number | 1 |
| 💥 | build_app | 366 |
+------+------------------------+-------------+
[14:13:21]: fastlane finished with errors
[!] Error packaging up the application
Could someone help me with this one.
In my case, I added a new distribution certificate which was in my keychain in first place. I removed the distribution certificate and it worked. It may not be the solution but can check

Linux man command about [OPTIONS]

Let's say git add command.When I input man git add,I get its page.
SYNOPSIS
git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]
[--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]]
[--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing]
[--] [<pathspec>...]
I have two quesions:
git add --verbose is same as git add -v?
for other command such as git,python , --fullNameA is same as -A? (fullNameA is abbreviated to A)
Each option in [--xxx | -x] characters are the same, so [--verbose | -v] means that --verbose will do the same as -v. This is true for all the man pages.

Resources