iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.57k stars 3.88k forks source link

0.3.0: static cpp examples compiled/installed #1048

Open troyengel opened 7 years ago

troyengel commented 7 years ago

Hi gang, friendly neighborhood packager here. I went to upgrade our package to the new 0.3.0 and ran into the new C++ examples; the CMakeLists.txt compiles and installs them using a static library for BCC, causing... 7 extra 42meg executables to get dragged in by cmake.

A small snippet as I was testing the resulting package:

-rwxr-xr-x  0 root   root 42227368 Mar 13 18:17 usr/share/bcc/examples/cpp/TCPSendStack
-rwxr-xr-x  0 root   root 42223272 Mar 13 18:17 usr/share/bcc/examples/cpp/FollyRequestContextSwitch
-rwxr-xr-x  0 root   root 42223272 Mar 13 18:17 usr/share/bcc/examples/cpp/LLCStat
-rwxr-xr-x  0 root   root 42219176 Mar 13 18:17 usr/share/bcc/examples/cpp/RandomRead
-rwxr-xr-x  0 root   root 42219176 Mar 13 18:17 usr/share/bcc/examples/cpp/CPUDistribution
-rwxr-xr-x  0 root   root 42239656 Mar 13 18:17 usr/share/bcc/examples/cpp/RecordMySQLQuery
-rwxr-xr-x  0 root   root 42219176 Mar 13 18:17 usr/share/bcc/examples/cpp/HelloWorld
-rwxr-xr-x  0 root   root 41549144 Mar 13 18:17 usr/lib/libbcc.so.0.3.0

This is of course undesirable as a packager, we went from a ~12m compressed package to almost 100m with these files. I'm not sure what the project wants to do, but it's undesirable as a packager, there's no interface to not have this happen. Drives up compile and compression time during the build to handle these examples.

I used a very simple patch file to rewrite examples/cpp/CmakeLists.txt to look like the LUA one (just file glob and install *.cc) which is what I personally think should be happening, I don't want to step on anyone's toes but you know...

drzaeus77 commented 7 years ago

I'm not happy about those either. I'm not personally using the cpp examples and would wait a couple of days to hear if anybody has a better solution, otherwise I would vote to keep these binaries out of the shipped artifacts.

4ast commented 7 years ago

yeah. remove them.

On Mon, Mar 13, 2017 at 6:10 PM, Brenden Blanco notifications@github.com wrote:

I'm not happy about those either. I'm not personally using the cpp examples and would wait a couple of days to hear if anybody has a better solution, otherwise I would vote to keep these binaries out of the shipped artifacts.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/iovisor/bcc/issues/1048#issuecomment-286291802, or mute the thread https://github.com/notifications/unsubscribe-auth/ALo9tQwmvhGIHWOI-XEvtJhMi8-znO7Cks5rlej6gaJpZM4Mb-jF .

troyengel commented 7 years ago

Sorry was just checking in and see we merged a PR, didn't know it was out. Shouldn't we be just shipping the raw .cc files themselves in the examples/ directory? (or maybe a combination of both) The very simple way I handled it initially was like so:

file(GLOB CC_FILES *.cc)
install(FILES ${CC_FILES} DESTINATION share/bcc/examples/cpp)

(ignoring all the diff/patch stuff here) - is there any value in shipping the actual code files as examples? To me, that's what an end user is after, not a compiled version but a "how do I do this?" example with code to read. I pretty much learn things by just reading the code of others who have done it and doing what they do... :)

goldshtn commented 7 years ago

@4ast @palmtenor I think it would make sense to ship the .cc files as examples, rather than the compiled binaries.