rules_cc icon indicating copy to clipboard operation
rules_cc copied to clipboard

Support cc_embed_data

Open silvasean opened this issue 6 years ago • 7 comments
trafficstars

Description of the problem / feature request:

Bazel doesn't support cc_embed_data

Feature requests: what underlying problem are you trying to solve with this feature?

I would like to embed data into C++ code.

We ended up having to hand-roll our own: https://github.com/google/iree/commit/4be1097dd2722ed0119e9b4b7784077e4970f3c3

Feel free to take code from there. I don't think we have time to upstream this properly.

silvasean avatar Oct 11 '19 19:10 silvasean

Here is the implementation (hand written): https://github.com/google/iree/tree/master/build_tools/embed_data

stellaraccident avatar Oct 11 '19 19:10 stellaraccident

FWIW, LLVM needs this as well, and it is challenging to use this implementation. (Abseil and other dependencies that we shouldn't need to pull down and put in the host build just for this...)

Is there any chance of progress here, or should we too roll our own?

chandlerc avatar Oct 27 '20 11:10 chandlerc

It shouldn't be hard to remove the abseil dep, and in hindsight I shouldn't have taken it. I don't have any plans to evolve this further unless if a need emerges for us. Feel free to grab anything we have to bootstrap rolling a new one, and if you get a dep-cleaner version, we can grab that back when it is ready.

stellaraccident avatar Oct 27 '20 17:10 stellaraccident

For now, trying to avoid the need, but will do if it ends up necessary.

chandlerc avatar Oct 27 '20 18:10 chandlerc

I'd also +1 this, as I'd like to use cc_embed_data in https://github.com/google/distributed_point_functions/.

schoppmp avatar May 11 '21 17:05 schoppmp

Xoogler here. I'm happy to take on this task of upstreaming this into Bazel as my first contribution.

@chandlerc @stellaraccident It's hard for me to unwind the threads but it seems your implementation doesn't actually have a dependency on abseil?

jiawen avatar Nov 20 '21 00:11 jiawen

Yeah, it should be dependency clean. Looks like its grown a couple of define checks in the generated code but should be easily removed. Feel free to take it if it is helpful.

stellaraccident avatar Nov 20 '21 01:11 stellaraccident