Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Thrift IDL not in main repository, no build support #45

Closed
ringerc opened this issue Jan 28, 2018 · 19 comments
Closed

Thrift IDL not in main repository, no build support #45

ringerc opened this issue Jan 28, 2018 · 19 comments

Comments

@ringerc
Copy link
Contributor

ringerc commented Jan 28, 2018

In the jaeger cpp-client source dir:

$ find . -name \*.thrift
$

and a git grep emitZipkinBatch finds only generated output from Thrift + references in UDPClient.h, UDPClientTest.cpp, and MockAgent.h.

Where are the Thrift sources to re-generate what's in thrift-gen ?

It's necessary for #38 to work since the local Thrift may not be the same version as the Thrift compiler used to check in the sources. Plus it's not great to carry generated sources in git when you can avoid it.

ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 28, 2018
jaeger-cpp defaults to using Hunter to download its dependencies off the 'net,
even if they exist locally. This is convenient for development but not
practical for some production environments. It also makes life hard for clients
that want to link to jaeger-cpp since Hunter doesn't install those
dependencies. It's necessary to also use Hunter in apps that use a jaeger-cpp
built this way... and that's not always practical.

Accordingly, add support for finding jaeger-cpp's dependencies via the normal
CMake package discovery mechanism.

A sligtly unsightly hack is required for nlohmann json, because its header
moved from json.hpp to nlohmann/json.hpp in 2.1.0.

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

WIP:

  - nothing packages nlohmann json 2.1.0 yet, 2.0.2 is widespread.
    but jaegertracing's code doesn't appear to support 2.0.2. For now you
    should work around it by installing 2.1.x locally from source.
    (no bug opened yet)

  - will fail to compile tests if the local thrift is 0.9.1 since there are
    committed generated files from 0.9.2 (jaegertracing#45) and there's no mechanism
    to regenerate them.

This seeks to address the beginnings of jaegertracing#38.
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 28, 2018
jaeger-cpp defaults to using Hunter to download its dependencies off the 'net,
even if they exist locally. This is convenient for development but not
practical for some production environments. It also makes life hard for clients
that want to link to jaeger-cpp since Hunter doesn't install those
dependencies. It's necessary to also use Hunter in apps that use a jaeger-cpp
built this way... and that's not always practical.

Accordingly, add support for finding jaeger-cpp's dependencies via the normal
CMake package discovery mechanism.

A sligtly unsightly hack is required for nlohmann json, because its header
moved from json.hpp to nlohmann/json.hpp in 2.1.0.

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

WIP:

  - nothing packages nlohmann json 2.1.0 yet, 2.0.2 is widespread.
    but jaegertracing's code doesn't appear to support 2.0.2. For now you
    should work around it by installing 2.1.x locally from source.
    (no bug opened yet)

  - will fail to compile tests if the local thrift is 0.9.1 since there are
    committed generated files from 0.9.2 (jaegertracing#45) and there's no mechanism
    to regenerate them.

This seeks to address the beginnings of jaegertracing#38.

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
@isaachier
Copy link
Contributor

OK so the Thrift schema files are shared among many language bindings. Hence, they are actually in a submodule idl. I'm assuming git grep is skipping submodules. You can regenerate using the Makefile in that directory. I agree I am not a fan of the use of version 0.9.2, but this has more to do with Uber's internal use than anything else.

ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 28, 2018
jaeger-cpp defaults to using Hunter to download its dependencies off the 'net,
even if they exist locally. This is convenient for development but not
practical for some production environments. It also makes life hard for clients
that want to link to jaeger-cpp since Hunter doesn't install those
dependencies. It's necessary to also use Hunter in apps that use a jaeger-cpp
built this way... and that's not always practical.

Accordingly, add support for finding jaeger-cpp's dependencies via the normal
CMake package discovery mechanism.

A sligtly unsightly hack is required for nlohmann json, because its header
moved from json.hpp to nlohmann/json.hpp in 2.1.0.

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

WIP:

  - nothing packages nlohmann json 2.1.0 yet, 2.0.2 is widespread.
    but jaegertracing's code doesn't appear to support 2.0.2. For now you
    should work around it by installing 2.1.x locally from source.
    (no bug opened yet)

  - will fail to compile tests if the local thrift is 0.9.1 since there are
    committed generated files from 0.9.2 (jaegertracing#45) and there's no mechanism
    to regenerate them.

This seeks to address the beginnings of jaegertracing#38.

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 28, 2018
jaeger-cpp defaults to using Hunter to download its dependencies off the 'net,
even if they exist locally. This is convenient for development but not
practical for some production environments. It also makes life hard for clients
that want to link to jaeger-cpp since Hunter doesn't install those
dependencies. It's necessary to also use Hunter in apps that use a jaeger-cpp
built this way... and that's not always practical.

Accordingly, add support for finding jaeger-cpp's dependencies via the normal
CMake package discovery mechanism.

A sligtly unsightly hack is required for nlohmann json, because its header
moved from json.hpp to nlohmann/json.hpp in 2.1.0.

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

WIP:

  - nothing packages nlohmann json 2.1.0 yet, 2.0.2 is widespread.
    but jaegertracing's code doesn't appear to support 2.0.2. For now you
    should work around it by installing 2.1.x locally from source.
    (jaegertracing#47)

  - will fail to compile tests if the local thrift is 0.9.1 since there are
    committed generated files from 0.9.2 (jaegertracing#45) and there's no mechanism
    to regenerate them.

This seeks to address the beginnings of jaegertracing#38.

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
@ringerc
Copy link
Contributor Author

ringerc commented Jan 28, 2018

@isaachier Aah, that's git's lovely default of silently ignoring submodules biting me. Thanks for the pointer. I'll look. Guess I'll need to glue that into the CMake build.

@ringerc
Copy link
Contributor Author

ringerc commented Jan 28, 2018

For other readers that means

git submodule init
git submodule update

then you'll find that idl/ is populated with origin https://github.com/uber/jaeger-idl.git.

Surprising it's in /uber/, but whatever.

Will look at plugging it into the cmake build later, out of time now.

@isaachier
Copy link
Contributor

I don't think you need to plug in to build at all (I didn't for a reason). Just regenerate a move to your thrift-gen directory.

@ringerc
Copy link
Contributor Author

ringerc commented Jan 29, 2018 via email

@isaachier
Copy link
Contributor

Regarding the Thrift sources, the idl directory should never have to be used. The fact that we use Thrift 0.9.2 does force users of more recent versions to manually generate the idl files. If they had the "right" version, they wouldn't need to know about it.

The target audience is a good question and followed up there

@ringerc ringerc changed the title Missing Thrift sources Thrift IDL not in main repository, no build support Jan 29, 2018
@ringerc
Copy link
Contributor Author

ringerc commented Jan 29, 2018

I just tried to build with the latest Thrift in Rawhide

$ thrift --version
Thrift version 0.10.0

and it fails too:

/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/Agent.cpp: In member function ‘uint32_t jaegertracing::agent::thrift::Agent_emitZipkinBatch_args::write(apache::thrift::protocol::TProtocol*) const’:
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/Agent.cpp:70:10: error: ‘class apache::thrift::protocol::TProtocol’ has no member named ‘incrementRecursionDepth’; did you mean ‘incrementInputRecursionDepth’?
   oprot->incrementRecursionDepth();
          ^~~~~~~~~~~~~~~~~~~~~~~

since it looks like the Thrift folks renamed the member.

So it appears that jaeger cpp-client probably currently works with thrift [0.9.2,0.9.3] only.

I strongly argue that committing generated files from IDL is bad practice, especially where the result of code-generation from the IDL doesn't follow a strong specification and isn't guaranteed to be compatible across versions. It doesn't look to me like Thrift generated code is meant to be used with a different library version.

It'd be better to generate the code from the IDL, per something like https://github.com/snikulov/cmake-modules/blob/master/FindThrift.cmake / https://github.com/apache/parquet-cpp/blob/master/cmake_modules/FindThrift.cmake where a THRIFT_COMPILER is exposed.

@ringerc
Copy link
Contributor Author

ringerc commented Jan 29, 2018

Ok, Thrift installed with

git clone //git-wip-us.apache.org/repos/asf/thrift.git
cd thrift
git checkout 0.9.2
./bootstrap.sh
./configure --with-cpp --with-java=no --with-python=no --with-lua=no --with-perl=no --enable-shared=yes --enable-static=no --enable-tutorial=no --with-qt4=no
make -s

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

@isaachier I did a manual rebuild of the IDL with the existing Thrift 0.9.2, to see if I could reproduce the current sources. I'm then going to go on to make sure it works with any suitable Thrift.

But the generated sources do not match what's in the Jaeger cpp-client tree. It looks like the tracetest_types and zipkincore_constants sources have produced different sources. I have no way to tell if these are local changes made manually to the generated code or if they're a generation issue since they're in the first commit.

The diff can be seen in ringerc@819eff4 ; I pushed a branch with it for convenient viewing.

Were these changes made locally by hand?

I'm using the same Thrift version as the IDL scripts use, and the Makefile in idl/ doesn't pass extra arguments. Looking at the diff I'm inclined to think "local changes" ?

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

Causes build failures:

$ make
[  2%] Built target testutils
[  2%] Building CXX object CMakeFiles/jaegertracing.dir/src/jaegertracing/thrift-gen/TracedService.cpp.o
In file included from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.h:11:0,
                 from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.cpp:7:
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:64:14: error: field ‘downstream’ has incomplete type ‘jaegertracing::crossdock::thrift::Downstream’
   Downstream downstream;
              ^~~~~~~~~~
In file included from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.h:11:0,
                 from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.cpp:7:
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:47:7: note: definition of ‘class jaegertracing::crossdock::thrift::Downstream’ is not complete until the closing brace
 class Downstream {
       ^~~~~~~~~~
In file included from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.h:11:0,
                 from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.cpp:7:
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:280:17: error: field ‘downstream’ has incomplete type ‘jaegertracing::crossdock::thrift::TraceResponse’
   TraceResponse downstream;
                 ^~~~~~~~~~
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:267:7: note: definition of ‘class jaegertracing::crossdock::thrift::TraceResponse’ is not complete until the closing brace
 class TraceResponse {
       ^~~~~~~~~~~~~
CMakeFiles/jaegertracing.dir/build.make:1694: recipe for target 'CMakeFiles/jaegertracing.dir/src/jaegertracing/thrift-gen/TracedService.cpp.o' failed

which looks to be down to

@@ -56,7 +61,9 @@ class Downstream {
   std::string host;
   std::string port;
   Transport::type transport;
-  boost::shared_ptr<Downstream> downstream;
+  Downstream downstream;

If I try building with Thrift 0.9.1, thrift generation fails with

[ERROR:/home/craig/projects/2Q/opentracing-jaeger-cpp-client/idl/thrift/crossdock/tracetest.thrift:28] (last token was 'Downstream')
Type "Downstream" has not been defined.

so it looks like Thrift is having issues with a self-reference of some sort.

If the IDL cannot be regenerated it'll be hard to keep up with changes to the protocol.

BTW, shouldn't the IDL be part of the opentracing project? Or am I missing how all this works?

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

Same issue if I use Thrift 0.10.0

In file included from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.h:12:0,
                 from /home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/TracedService.cpp:7:
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:62:14: error: field ‘downstream’ has incomplete type ‘jaegertracing::crossdock::thrift::Downstream’
   Downstream downstream;
              ^~~~~~~~~~
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:48:7: note: definition of ‘class jaegertracing::crossdock::thrift::Downstream’ is not complete until the closing brace
 class Downstream : public virtual ::apache::thrift::TBase {
       ^~~~~~~~~~
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:290:17: error: field ‘downstream’ has incomplete type ‘jaegertracing::crossdock::thrift::TraceResponse’
   TraceResponse downstream;
                 ^~~~~~~~~~
/home/craig/projects/2Q/opentracing-jaeger-cpp-client/src/jaegertracing/thrift-gen/tracetest_types.h:280:7: note: definition of ‘class jaegertracing::crossdock::thrift::TraceResponse’ is not complete until the closing brace
 class TraceResponse : public virtual ::apache::thrift::TBase {
       ^~~~~~~~~~~~~
CMakeFiles/jaegertracing.dir/build.make:1694: recipe for target 'CMakeFiles/jaegertracing.dir/src/jaegertracing/thrift-gen/TracedService.cpp.o' failed

@isaachier
Copy link
Contributor

Zipkin isn't used in C++ client. The tracetest changes are indeed a real issue and one reason I cannot foresee making the Thrift generation part of the standard build. See this issue and ensuing discussion: jaegertracing/jaeger-idl#35. I had to painstakingly fix the generated code by hand to avoid a serious issue in the schema definition.

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

@isaachier Thanks for the reference, I never would've found that.

Seems like a horrible decision in Thrift about how to translate the IDL to C++. __isset? Ew.

std::optional in C++17 would help but .. well, c++17. Pity they didn't just import one of the older implementations of that concept as a thrift::optional instead of their separate member __isset hack.

The tests they added in apache/thrift#84 cover various self-referential forms other than optional self-inclusion.

Looking for a Thrift bug.

Seems like it'd be hard to fix this without changing the opentracing IDL. But maybe that's what should happen.

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

Didn't find a Thrift bug so created https://issues.apache.org/jira/browse/THRIFT-4484

@ringerc
Copy link
Contributor Author

ringerc commented Jan 31, 2018

"one of" the reasons? Other known issues?

ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 31, 2018
Add support for finding jaeger-cpp's dependencies via the normal local
CMake package discovery mechanism of Find modules.

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 31, 2018
Add support for finding jaeger-cpp's dependencies via the normal local
CMake package discovery mechanism of Find modules.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 31, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 31, 2018
Add support for finding jaeger-cpp's dependencies via the normal local
CMake package discovery mechanism of Find modules.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Jan 31, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-idl that referenced this issue Feb 1, 2018
This IDL is fine for languages where everything is by-reference. But for C++, it tries to embed a class by-value into its self, which cannot succeed, and results in compilation failure. See jaegertracing#35

This has been worked around by patching the IDL-generated code; see jaegertracing/jaeger-client-cpp#45 .

It turns out we can just tell Thrift to include the optional member by-reference. See the comment in https://issues.apache.org/jira/browse/THRIFT-4484  about `cpp.ref`. Apparently that's now spelled `&` in Thrift IDL. I don't know what effect it has for other languages, the documentation is sparse at best, and doesn't mention this at all.

If this doesn't break other languages I think it's the correct fix for the IDL.
@ringerc
Copy link
Contributor Author

ringerc commented Feb 1, 2018

@isaachier I think I found a fix for the IDL issue; ringerc/jaeger-idl#1 .

ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 1, 2018
@ringerc
Copy link
Contributor Author

ringerc commented Feb 2, 2018

I'm abandoning making it work on different Thrift versions for now. Thrift 0.11.0 and newwer build with std::shared_ptr instead of boost::shared_ptr unless you define -DFORCE_BOOST_SMART_PTR. So we'd have to detect if it's a newer Thrift and (if even possible) how it was built, and switch to std::shared_ptr using a namespace hack like Thrift does in its lib/cpp/src/thrift/stdcxx.h.

This goes in the too-hard basket at this point, given that the IDL is also busted per jaegertracing/jaeger-idl#35 and even Thrift 0.11.0 generates bad code for the fix using by-reference inclusion. I'll push a branch with my WIP, but unless someone has more time/care than me, it looks like the dependency on 0.9.2-0.9.3 stays.

ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 2, 2018
This is a C++11 codebase so it can rely on std::shared_ptr. std::shared_ptr
handles incomplete types correctly, unlike boost::shared_ptr. This helps when
building against newer versions of Thrift.

FIXME: This only works for, and is required for, Thrift 0.11.0 and newer built
without -DFORCE_BOOST_SMART_PTR. Older Thrift requires boost::shared_ptr. So
we have to use namespace hacks like Thrift's lib/cpp/src/thrift/stdcxx.h does
to support both.

This is WIP for jaegertracing#45

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 2, 2018
Build Crossdock support into the UnitTest executable not the library, and
only build it when JAEGERTRACING_BUILD_CROSSDOCK is set.

In addition to shrinking the library this lets us drop the exact Thrift 0.9.2
or 0.9.3 requirement when not building with Crossdock. The IDL bug / Thrift bug
discussed in jaegertracing#45 only affects the IDL used with Crossdock testing.

Or at least, it would let us drop the Thrift requirement if not for the problems
with std::shared_ptr vs boost::shared_ptr.

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 2, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 2, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 13, 2018
Restructure the build system to follow CMake conventions: use import
libraries consistently, separate CMakeLists.txt for targets, etc.

Add Find packages to discover local dependencies not already supported
by CMake natively. These are used when Hunter is disabled to allow
jaeger cpp-client to use locally installed libraries.

This is a preliminary step in splitting the test sources out of the
library.

Improves jaegertracing#38 Offline builds

This introduces support for building with

   cmake -DHUNTER_ENABLED=0

Limitations for local dependency builds:

  - Requires a locally installed Thrift 0.9.2 or 0.9.3 EXACTLY,
    not newer or older. These versions are not widely packaged
    so a local install is necessary.  (jaegertracing#45)

  - Requires nlohmann json 2.1.0 or newer, which is not widely
    packaged in Linux distros. Install a local copy. (jaegertracing#47)

Signed-off-by: Craig Ringer <craig@2ndquadrant.com>
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 13, 2018
ringerc added a commit to ringerc/jaeger-cpp-client that referenced this issue Feb 16, 2018
We need a newer Thrift to support hosts with openssl 1.1. Since Jaeger its
self requires a c++11 compiler and nlohmann-json requires at least g++ 4.9,
supporting newer dependencies makes sense. But Thrift 0.9.2 didn't support
openssl 1.1.

This is some pretty brutal surgery:

- Remove crossdock and zipkin support entirely. The IDL is broken for C++ /
  Thrift generates bad code for it. See
  jaegertracing/jaeger-idl#35,
  https://issues.apache.org/jira/browse/THRIFT-4484
  jaegertracing#45

- Adapt Thrift's namespace-aliasing approach to support Thrift built with
  use of std::smart_ptr or boost::smart_ptr; Thrift switched to std::smart_ptr
  in later versions but retains boost::smart_ptr for BC.

- Regenerate IDL with Thrift 0.11.0 and commit in-tree.

Unsure if Hunter still works; may need to package Thrift 0.11.0

Haven't tested with a Thrift configured with Boost smart pointers. Don't do
that.

The wholesale removal of zipkin and crossdock support means this is unlikely to
be committable to mainline. Hopefully Thrift will fix their codegen. If not,
well, we're probably going to throw Thrift out entirely soon.
@isaachier
Copy link
Contributor

Resolved in latest release with #94.

@ringerc
Copy link
Contributor Author

ringerc commented Aug 15, 2019

This still requires a patch file to be applied by the build on top of the generated Thrift IDL right? A patch that's probably specific to the Thrift version used?

Not a complaint in any way, just for clarity in terms of how it's resolved.

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

No branches or pull requests

2 participants