< dhruvm>
I have been trying to set up a C++ scratchpad to try things while being able to interface with the bitcoin code. I put my code in `src/scratch.cpp` and I try to compile it with `g++ -std=c++11 -O1 -fsanitize=undefined src/scratch.cpp -o scratch` (in this case I am trying to reproduce a sanitizer bug). I'm met with a wall of errors that look like
< dhruvm>
this:
< dhruvm>
---
< dhruvm>
In file included from scratch.cpp:3:
< dhruvm>
./netaddress.h:12:10: error: 'attributes.h' file not found with <angled> include; use "quotes" instead
< dhruvm>
#include <attributes.h>
< dhruvm>
^~~~~~~~~~~~~~
< dhruvm>
"attributes.h"
< dhruvm>
---
< dhruvm>
Sample `src/scratch.cpp`:
< dhruvm>
```
< dhruvm>
#include <iostream>
< dhruvm>
#include "prevector.h"
< dhruvm>
#include "netaddress.h"
< dhruvm>
#include <arpa/inet.h>
< dhruvm>
int main() {
< dhruvm>
in_addr_t a = inet_addr("127.0.0.1");
< dhruvm>
CNetAddr addr{in_addr{a}};
< gwillen>
drbrule: all the bitcoin code is compiled with various compiler flags that are set in the Makefile, so it will be tricky to compile a single scratch file on its own like that
< gwillen>
one thing you could do is to run `make` with V=1 (I think that's the magic?) and see what command it runs to compile some other file under 'src', and copy the flags
< gwillen>
another option since you're just playing around would be to just toss stuff at the bottom of some other file
< gwillen>
(the best option if you actually wanted to add a file for real would be to go add it to the build stuff, but that can get kind of hairy)
< gwillen>
if you want to experiment with code you can actually run (rather than merely compile), you'll need linking too, and I would suggest you just find one of the files that implement RPCs (e.g. rpc/rawtransaction.cpp) and add a new RPC there that you can call
< dhruvm>
when i try `make -n` i do see the g++ commands with all the flags but those don't seem to address the errors.
< dhruvm>
i see -- so try and use the existing tooling rather than add a scratch pad. i'll try that. thank you gwillen.
< sipa>
in particular you need -Isrc here
< dhruvm>
As in `g++ -std=c++11 -O1 -lsrc -fsanitize=undefined src/scratch.cpp -o scratch`?
< sipa>
not l, I
< sipa>
capital i
< sipa>
but i'd be surprised if that's all you need
< dhruvm>
It moved me forward :)
< dhruvm>
The quotes problem went away - i'll try further with the remaining flags from `make -n`
< dhruvm>
If i am reading it correctly, i need to figure out linking next because I'm getting back: "Undefined symbols for architecture x86_64:"
< dhruvm>
Also: `clang: error: linker command failed with exit code 1 (use -v to see invocation)`
< dhruvm>
Anyway, thanks sipa! I'll be back with more after trying a bit.
< bitcoin-git>
[bitcoin] n-thumann opened pull request #19859: qa: Fixes failing functional test by changing version (master...qa-fix-wrong-version) https://github.com/bitcoin/bitcoin/pull/19859
< ryanofsky>
If I restart a failing travis or appveyor build, github changes from red to yellow. If I restart failing cirrus build, it github stays red
< ryanofsky>
Is there some lag, or is it just not even worth restarting cirrus builds because they will always stay red?
< hebasto>
cirrus will turn green after success build
< bitcoin-git>
[bitcoin] naumenkogs opened pull request #19860: Improve diversification of new connections: privacy and stability (master...2020-09-diverse-new-conn-fixes) https://github.com/bitcoin/bitcoin/pull/19860