Closed enh-google closed 2 years ago
(you can't really tell from the context in the diff, but the Android build file doesn't actually -D all of the things --- i think it's just "what was necessary when we first imported" + "this one now". so if you do want everything defined all the time and want to protect against user error, you might want to add some #ifndef ... #error
verbiage somewhere, so me and anyone else with their own build system knows when you've added something, and knows they need to make a conscious decision?)
This is a hard one.
So it is really WAI, even though I don't like it. The reason is because the user-visible header for the library, include/bcl.h
, needs to define some things that are not used in the library, but if the library is not enabled, the library-only stuff needs to be skipped. So there are #if BC_ENABLE_LIBRARY
/#endif
guards in include/bcl.h
.
However, that causes problems because if the user is building a project using bcl
, they are not going to be defining BC_ENABLE_LIBRARY
, so right before the #if BC_ENABLE_LIBRARY
/#endif
guards in include/bcl.h
, there is this:
#ifndef BC_ENABLE_LIBRARY
#define BC_ENABLE_LIBRARY (1)
#endif // BC_ENABLE_LIBRARY
This is to ensure that users who build projects with bcl
as a dependency don't have to do anything special with their builds.
Unfortunately, both of those things together caused the problem you see.
However, I think I found a solution: 7e218161a9. Since include/status.h
includes include/bcl.h
after that point, I can use it to disable building the library by default when BC_ENABLE_LIBRARY
is not defined.
Can you test that 7e218161a9 fixes your problem? If so, I will make another release, though I may wait on any problems FreeBSD has with updating their in-tree version.
I may wait on any problems FreeBSD has with updating their in-tree version.
just to confirm: you don't know of any problems they've had, you're just waiting to see if they have any? i ask because i'm having trouble with Running bc script multiply.bc...
taking forever. seems like it's actually the diff that takes forever. using toybox diff on a clean git clone
of your upstream on the host, make test
passes fine in a reasonable time, so it's not that.
oh, yeah, pulling the files-to-be-diffed off the device, they're pretty different:
enh-p920.mtv:~/aosp$ wc -l multiply*
3238615 multiply_script_results.txt
2786743 multiply.txt
6025358 total
enh-p920.mtv:~/aosp$ diff -u multiply.txt multiply_script_results.txt | wc -l
3128717
enh-p920.mtv:~/aosp$
seems like after a certain point i have a line missing every 5 lines?
--- multiply.txt 2021-08-11 17:09:34.017797251 -0700
+++ multiply_script_results.txt 2021-08-11 17:10:41.998168038 -0700
@@ -38,8 +38,7 @@
617283945000000000000000000000000000000000000.00000000000000000000
6172839450000000000000000000000000000000000000.00000000000000000000
61728394500000000000000000000000000000000000000.00000000000000000000
-617283945000000000000000000000000000000000000000.0000000000000000000\
-0
+617283945000000000000000000000000000000000000000.00000000000000000000
6172839450000000000000000000000000000000000000000.000000000000000000\
00
61728394500000000000000000000000000000000000000000.00000000000000000\
@@ -59,143 +58,175 @@
617283945000000000000000000000000000000000000000000000000.0000000000\
0000000000
3810394687547630.25000000000000000000
+38103946875476302.50000000000000000000
3810394687547630.25000000000000000000
3810394687547630.25000000000000000000
3810394687547630.25000000000000000000
38103946875476302.50000000000000000000
+381039468754763025.00000000000000000000
38103946875476302.50000000000000000000
38103946875476302.50000000000000000000
38103946875476302.50000000000000000000
381039468754763025.00000000000000000000
+3810394687547630250.00000000000000000000
381039468754763025.00000000000000000000
381039468754763025.00000000000000000000
381039468754763025.00000000000000000000
3810394687547630250.00000000000000000000
i don't suppose that looks at all familiar?
i have already tried the obvious thing of adding all the extra -Ds from your build to mine:
+"-DBC_NUM_KARATSUBA_LEN=32",
+"-DBC_ENABLE_MEMCHECK=0",
+"-DBC_ENABLE_AFL=0",
+"-DBC_DEFAULT_BANNER=0",
+"-DBC_DEFAULT_SIGINT_RESET=1",
+"-DBC_DEFAULT_TTY_MODE",
+"-DBC_DEFAULT_PROMPT=1",
just to confirm: you don't know of any problems they've had, you're just waiting to see if they have any?
They definitely have problems, but they are trying to figure out if they need to fix it or if I need to.
With the multiply script, I know what's happening. You don't need all of the extra -Ds.
In 5.0.0
, I made a change where if there is one more digit to print, and space for only one more digit on the line, it prints the digit instead of a backslash+newline+digit combo. I did this because OpenBSD does, and after more carefully reading the bc
spec, I felt like that was the correct behavior.
This, however, introduced a problem for the generated tests because GNU bc
does not do that. So as part of generating tests, I needed some way of fixing GNU bc
's output.
I did this with tests/script.sed
and piping the generated test through sed
before printing it to a file. (See https://github.com/gavinhoward/bc/blob/master/tests/script.sh#L155-L161 and https://github.com/gavinhoward/bc/blob/master/manuals/development.md#script-tests .)
To fix the problem on your end, I would reimport all of the tests/
directory, especially since I added some new tests for the new functions in gen/lib2.bc
. Oh, and on that note, I would import the gen/
directory too.
Other than that, the multiply script does take a longer time now because I expanded the tests to catch some cases it didn't before because I thought that my bc
might have a bug there. (It didn't, thank goodness.)
If I were you, though, I would actually turn off generated tests. However, it also looks like you do? run-bc-tests-on-android.sh
appears to turn off generated tests, which should mean that the multiply script test is not run, so I am confused...
With all of that said, what would you like me to do?
Side note: you can also take -DBC_ENABLE_LONG_OPTIONS
and -DBC_ENABLE_SIGNALS
out of Android.bp
; they haven't been used for a while.
so I am confused
yeah, me too, but you gave me enough clues for the lightbulb to come on :-)
i didn't know what you meant by "reimport", since i'd already taken everything ... which made me check your .gitignore file ... a little editing of which led to this in git status
:
Untracked files:
(use "git add <file>..." to include in what will be committed)
multiply_script_results.txt
tests/bc/scripts/add.txt
tests/bc/scripts/divide.txt
tests/bc/scripts/multiply.txt
tests/bc/scripts/subtract.txt
tests/bc_outputs/
so i think what happened here was that i probably ran your make test
in my AOSP tree at some point. so when i run locally i have those (now outdated) files lying around, but everyone else (and the build servers) don't. anyway, a bit of local rm
ing later (and removing the unnecessary -D
s, including the couple of already checked-in ones you pointed out), and...
...
Running bc stdin tests...pass
Skipping bc script multiply.bc
Skipping bc script divide.bc
Skipping bc script subtract.bc
Skipping bc script add.bc
Running bc script print.bc...pass
...
Running bc limits tests...pass
All bc tests passed.
***********************************************************************
so i think that mystery's solved. i would definitely benefit by always doing every new bit of work in a completely fresh AOSP checkout, but it takes far too long to do that that even with the odd wasted day here and there i'm probably still coming out ahead with all these weird surprises!
With all of that said, what would you like me to do?
for the -D stuff? let me check in the fix needed in run-bc-tests-on-android.sh
and then i'll try your new patch and get back to you...
on the other hand if you meant "to help debug your upgrade issue", you already did that, thanks! :-)
However, I think I found a solution: 7e21816. Since
include/status.h
includesinclude/bcl.h
after that point, I can use it to disable building the library by default whenBC_ENABLE_LIBRARY
is not defined.Can you test that 7e21816 fixes your problem? If so, I will make another release, though I may wait on any problems FreeBSD has with updating their in-tree version.
yeah, that works great. i'll remove the Android.bp hack in the next update. (i'll add a TODO right now so i don't forget, and remove the other bits i don't need at the same time too!)
Good to know! Closing....
heh, you got 5.0.1 out so fast i've skipped the TODO stage and just fixed it directly in the update!
thanks again for the help! pleasure working with you as always :-)
this might be WAI as an unsupported configuration, but i accidentally ran into this because i have to maintain a parallel build for Android's build system...
with Android's existing Android.bp file:
i needed to manually fix this:
the default Makefile hides this because of the
CPPFLAGS8
line that ensuresBC_ENABLE_LIBRARY
is always set.like i said, maybe WAI and fixed by making my build a bit more like yours, but i thought i'd mention it anyway in case you considered this an accident...