Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

Fix -DHUNTER_ENABLED=0 builds #3

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

ringerc
Copy link

@ringerc ringerc commented Jun 5, 2018

Fixes #1

@codecov
Copy link

codecov bot commented Jun 5, 2018

Codecov Report

Merging #3 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master       #3   +/-   ##
=======================================
  Coverage   79.54%   79.54%           
=======================================
  Files          34       34           
  Lines        3568     3568           
=======================================
  Hits         2838     2838           
  Misses        730      730

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8613dda...91b549d. Read the comment docs.

.gitignore Outdated
@@ -1 +1,4 @@
/build
DartConfiguration.tcl
/CMakeFiles
/CMakeCache.txt
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these two directories, please remove the leading slash. This pattern only matches ${SRC_ROOT}/CMakeFiles but not ${SRC_ROOT}/build/CMakeFiles. Usually I use mkdir build && cd build && cmake .. to keep the build in its own directory, so it made sense to ignore the whole build directory in the source root. However, it seems like you are building in the source tree. Might as well just ignore all of the CMake generated files no matter where they are.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can actually replace this entirely with this: https://github.com/github/gitignore/blob/master/CMake.gitignore.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add this and any generated files you can find: https://github.com/github/gitignore/blob/master/C.gitignore.

sudo dnf install jansson-devel http-parser-devel protobuf-c-devel \
protobuf-c-compiler
```

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I haven't tested HUNTER_DISABLED=ON in a while, so I should double-check this still works.

@codecov-io
Copy link

codecov-io commented Jun 7, 2018

Codecov Report

Merging #3 into master will increase coverage by 0.36%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #3      +/-   ##
==========================================
+ Coverage    79.2%   79.56%   +0.36%     
==========================================
  Files          31       34       +3     
  Lines        3635     3572      -63     
==========================================
- Hits         2879     2842      -37     
+ Misses        756      730      -26
Impacted Files Coverage Δ
src/jaegertracingc/internal/random.h 90.32% <ø> (ø)
src/jaegertracingc/span.h 66.33% <0%> (-33.67%) ⬇️
src/jaegertracingc/sampling_strategy.h 90.47% <0%> (-9.53%) ⬇️
src/jaegertracingc/log_record.h 96.42% <0%> (-3.58%) ⬇️
src/jaegertracingc/sampler.c 81.89% <0%> (-1.63%) ⬇️
src/jaegertracingc/baggage.c 0% <0%> (ø) ⬆️
src/jaegertracingc/metrics.c 100% <0%> (ø) ⬆️
src/jaegertracingc/logging.c 100% <0%> (ø) ⬆️
src/jaegertracingc/alloc.c 100% <0%> (ø) ⬆️
src/jaegertracingc/common.c
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b89ecf7...ee3c238. Read the comment docs.

@ringerc
Copy link
Author

ringerc commented Jun 7, 2018

@isaachier I've dropped the gitignore commit from the series, and I think otherwise it should be fine to merge.

@ringerc
Copy link
Author

ringerc commented Jun 7, 2018

Actually hold on this, needs more work first

There were a number of case sensitivity issues in the CMake files relating
to differing case between the Hunter files and the ones in cmake/ (isaachier#1)

Also fixes finding of the protocol buffers support when protobuf 1.2 is
present (isaachier#4)
@ringerc ringerc changed the title Case of CMake Find modules did not match CMakeLists.txt Fix -DHUNTER_ENABLED=0 builds Jun 11, 2018
@ringerc
Copy link
Author

ringerc commented Jun 11, 2018

I've removed the gitignore changes, added a fix to make it compile on protobuf-c 1.2, fixed some more issues with case in the CMake files, and rebased on top of 49513a5. It now configures fine here with cmake -DHUNTER_ENABLED=0 -DJAEGERTRACINGC_USE_PCG=0 and builds fine.

- clang-4.0
env:
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
#DISABLED to reduce the matrix a bit
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this is for your own testing. In practice, we can add an additional matrix entry (probably one will suffice) that will test HUNTER_ENABLED=0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but actually I don't see the benefit of the build matrix being so dense for all builds. Unless you're chasing a very specific compiler bug of regression it seems oddly broad. Much more useful to add an osx target at some point instead.

@@ -113,19 +113,24 @@ if(HUNTER_ENABLED)
hunter_add_package(Protobuf)
find_package(Protobuf ${hunter_config} REQUIRED)
list(APPEND package_deps Protobuf)
set(protoc_exe protobuf::protoc)
else()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So how do we generate the messages? How do we connect to backend at all?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will have seen the answer to that further down, guessing this is outdated. It's just a change in how the IDL is compiled by cmake.

message(STATUS "using protoc and protoc-gen-c")
set(protoc_exe $<TARGET_FILE:protobuf::protoc>)
set(protoc_plugin_arg --plugin=$<TARGET_FILE:protobuf-c::protoc-gen-c>)
elseif(TARGET protobuf-c::protoc-c)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fix this issue by using protoc-c directly. I found that I had issues doing this with the Hunter version of protoc-c, so I used an invocation of protoc that loaded the protoc-gen-c plugin. If Hunter is disabled, I can try using protoc-c directly instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I did in an earlier revision, but there turns out to be no point. protobuf-c 1.3 adds protobuf-gen-c and is also the oldest version that supports "proto3". So in practice there's a hard requirement on 1.3 and you can just rely on doing it this way.

It's silly that Hunter doesn't expose a protobuf-c::protoc-c target, but in this case it wouldn't help us.

Install the project library dependencies. On Debian, the following command
should work.
By default the client build will fetch all dependencies from the Hunter
build dependency system. Only cmake must be installed.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


On older Fedora releases, RHEL, and CentOS, protobuf-c-devel
protobuf-c-compiler are too old and must be installed from source, custom
packages, or a backport repository instead.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) excellent!

git submodule update --init
mkdir -p build
cd build
cmake ..
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just minor suggestion: cmake -DCMAKE_BUILD_TYPE=Release .. or Debug.

set_target_properties(Jansson::Jansson PROPERTIES
if(JANSSON_FOUND AND NOT TARGET jansson::jansson)
add_library(jansson::jansson UNKNOWN IMPORTED)
set_target_properties(jansson::jansson PROPERTIES
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! The casing can be annoying, but that seems to be the correct fix.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very. CMake could at least offer a "hint" message of some kind. "Target Jansson::Jansson not found (but there's a jansson::jansson, did you mean that?"


if [ "${USE_HUNTER:-}" == "off" ]; then
# We won't be using Hunter so we need to get opentracing's c library
# installed too.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you prefer I handle this dependency to support non-Hunter builds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure yet, thinking about that. It depends a lot on whether you think apps would expect to link to opentracing-c then load jaeger-client-c at runtime, or if you see them linking to a jaeger-client-c that implements the opentracing-c APIs exposed in opentracing-c headers.

(The build doesn't produce a shared library yet. I'll deal with that at some later stage, far from urgent.)

You've pushed opentracing-c to hunter, so I guess you see it working more like the former? The app links to opentracing-c, and it loads a tracing implementation at runtime? I haven't looked closely at this part yet, as I've just been trying to get the build to work.

No strong opinions here anyway. I anticipate I'll be treating it as a unit of opentracing-c + jaeger-client-c anyway.

make -j3
make check -j3
make install
./configure --quiet --prefix="$prefix"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

* not much benefit when we're just generating request and span IDs, etc.
*/
srand(time(NULL));
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants