DataDog / dd-trace-php

Datadog PHP Clients
https://docs.datadoghq.com/tracing/setup/php
Other
486 stars 151 forks source link

[BUG] Cannot build OFFLINE #2103

Closed remicollet closed 1 year ago

remicollet commented 1 year ago

Since version 0.88.0 which uses rust :(

Possible workaround used for some other ext (ex skywalking_agent) is to vendor the dependencies (using cargo vendor ...)

Sadly it doesn't work for this project

    Updating git repository `https://github.com/pawelchcki/tarpc.git`
warning: spurious network error (3 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Temporary failure in name resolution; class=Net (12)
error: failed to get `tarpc` as a dependency of package `datadog-ipc v0.1.0 (/builddir/build/BUILD/php-pecl-datadog-trace-0.88.0/NTS/libdatadog/ipc)`

Other common issues with rust

For now, this is a blocker for me packaging RPM Will stay with 0.87.2 until some hack is found.

bwoebi commented 1 year ago

Looks like github.com couldn't be resolved for you? I never had the issue I need an offline build.

The extension shouldn't be that big, we're stripping the rust debug information within config.m4, so it should be a reasonable ~6MB (before was ~2MB).

The cargo build indeed does not inherit the -j flag, that's something we can fix.

vendoring the dependencies would be possible for the pecl build, if that would help you?

remicollet commented 1 year ago

Looks like github.com couldn't be resolved for you? I never had that issue...

Yes, this issue is about OFFLINE build (so without internet access)

bwoebi commented 1 year ago

Sorry, misread the title, we'll investigate whether we can vendor in pecl archive.

remicollet commented 1 year ago

For your information, here is how I create the vendor directory https://git.remirepo.net/cgit/rpms/php/pecl/php-pecl-datadog-trace.git/diff/makedeps.sh?id=8e686507c7db25dd54dbb5c4ce7cd4d46dde6af1

And how I configure cargo to use vendored dep. https://git.remirepo.net/cgit/rpms/php/pecl/php-pecl-datadog-trace.git/tree/php-pecl-datadog-trace.spec#n116

Only issue is with "tarpc" which is from github, not from crates.io Need to find (if possible) the proper source name(s) to replace-with = "vendored-sources"

bwoebi commented 1 year ago

Hey @remicollet,

we've just released 0.88.1, which includes tarpc directly vendored in the libdatadog folder. With you setup using crates.io, it now should properly compile.

Please let me know if there are still issues. Thanks for all the work you are doing packaging our tracer :-)

remicollet commented 1 year ago

I confirm version 0.88.1 build fine offline using the vendored solution.

BTW

bilhackmac commented 1 year ago

Yes ext is now really, really huge and not suitable for my docker images.

On the same based docker image : debian 12 - ddtrace 0.87.2

ls -sh $(php-config --extension-dir)/ddtrace.so
412K /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ddtrace.so

debian 12 - ddtrace 0.88.1

ls -sh $(php-config --extension-dir)/ddtrace.so
140M /usr/local/lib/php/extensions/no-debug-non-zts-20220829/ddtrace.so

That's 440 times more space !

bwoebi commented 1 year ago

Something went wrong and we accidentally enabled rust debug builds by default when installing manually. Pass to ./configure: --disable-ddtrace-rust-debug to build in release mode, and --disable-ddtrace-rust-symbols to strip debug symbols from rust (only).

It should always use rust release builds from the next version on, when targeting non-debug php builds.

bilhackmac commented 1 year ago

It's a lot better, it drop to 6.5M.

Thx