who can please explain what it is? I use adb
W/IMGMapper(21885): set:488 set: Unset optional value from type CTA861_3 W/IMGMapper(21885): set:488 set: Unset optional value from type SMPTE2094_40
Related
I'm trying to build a GNU Make Canned Recipe, like so:
define this-will-fail
my_var=1
$(info your variable is $(my_var))
endef
$(this-will-fail)
This causes an error *** missing separator. Stop.
However, the following works as expected:
define why-does-this-work
$(eval my_var=1)
$(info your variable is $(my_var))
endef
$(why-does-this-work)
by printing your variable is 1.
I'm looking at AOSP's build system and frequently see usage of eval paired with define. What's the relationship between these two items, and why can I not create variables "normally" when using define?
The answer stems from a simple point with big ramifications - a makefile has two dialects, 1) the make language itself and 2) the shell language you use for stuff like invoking gcc.
A reminder of the normal make "rule" syntax:
targets : prerequisites
recipe
While the make target and prerequisites is in make
syntax, the stuff in the recipe is in the shell syntax, not make syntax.
This explains why you cannot do stuff like assign make variables as part of a recipe, as so:
all: the_dependencies_of_all
this_will_not_work := because_the_shell_does_not_know_what_this_line_means
In the shell syntax bits, make does three special text manipulations, and then the remaining string is passed verbatim to the shell. The three steps are
deal with escaped newlines (e.g. backslash followed by newline)
run any make functions (like $(filter ....) and $(eval ..)
expand any make target variables (like $#)
In the normal case, this 3-steps-then-shell processs happens once per recipe line, so each line of your makefile recipe is run in a different shell (hence why some calls to make will spawns many /bin/sh sub-processes).
Manipulation #2 above explains why you can use eval inside a recipe to add some make syntax to your recipe. Eval will turn into an empty string, which will cause no problems with the shell, but make will have evaluated the string inside your statement, so stuff like variable definitions is possible.
The precise moment this evaluation happens is a bit tricky to pin down - it seems to happen when the variable is first expanded, which itself depends upon where you reference that variable in your makefile. Perhaps someone can clarify this a bit more, since when this happens has been ramifications for invocations of make that use the -j flag to run multiple recipe lines in parallel
More Info:
https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction
https://www.gnu.org/software/make/manual/html_node/Recipe-Syntax.html#Recipe-Syntax
https://www.gnu.org/software/make/manual/html_node/Splitting-Recipe-Lines.html#Splitting-Recipe-Lines
How can you check if a property is unset in init.rc:
In the following example test.b is not yet set
on property:test.a=1 && test.b=<unset>
# do something
Reading queue_property_triggers1 it seems that you can't. You'll probably need to change your code logic.
I am running some unit tests using GTest/GMock on Android. I have noticed that it ignores my argument of --gtest_filter=MyTestCase.MyTest - all of my tests run no matter what I put in the filter. I've made sure that it gets passed in to InitGoogleMock.
Has anyone managed to use --gtest_filter when running their tests on Android?
Mystery solved, --gtest_filter was my first argument, but GTest parses arguments from index 1 rather than 0, as argument 0 is expected to be the executable name in unix land :).
How to diagnose log log function error, that is when negative value is returned:
/*
* Send a formatted string to the log, used like printf(fmt,...)
*/
int __android_log_print(int prio, const char *tag, const char *fmt, ...);
Thank you!
Short answer: check errno.
Long answer: There appear two reasons __android_log_print can return a negative value. The first is if it's unable to open any of the log files for writing (/dev/log/main, /dev/log/radio, or /dev/log/events). The second is if the write() system call returns a negative number.
After __android_log_print returns a negative value, is errno set? If so, its value should give you some information about what went wrong. If errno is zero, your log call probably wound up in __write_to_log_null and you should investigate your program's ability to open those /dev/log files.
If errno is set, it's possible that it was set when trying to open the log files. You should be able to isolate this case by setting errno = 0, then calling __android_log_bug_write with a bad log_id (first argument). For this to be useful, it'll need to be the first call to any of the logging functions - otherwise the file opening stage will have been and gone. Obviously this is only necessary if errno is set to something that could have been at write time or at open time.
This answer comes to you courtesy of system/core/liblog/logd_write.c.
I would like to use self defined Environment variables in my source code. I use System.getenv() to do this and the code line looks like this. Log.d("MyTest","== MyEnv " + System.getenv("AP") + " ANDROID_ASSETS:" + System.getenv("ANDROID_ASSETS"));
before I execute my code I define my AP variable with export: export AP="12345" and the this is my output of set command
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=9,32768
ANDROID_ROOT=/system
AP=12345
...
Then I execute my code and I get this line from logcat
D/MyTest( 5363): == MyEnv null ANDROID_ASSETS:/system/app
The value for my defined Environment variable is null. Any suggestions on why it didn't work?
Export command works for one session only, not for a whole system. You can't set environment variables that way. getprop/setprop doesn't work neither.
I had similar problem and found that easiest way to pass some arguments from console is to do something like:
echo "12345" > /sdcard/myapp/args/AP
Then read this file from Java.