testptp.cを他の人のためにコンパイルできますか?

testptp.cを他の人のためにコンパイルできますか?

LinuxPTPをテストするのに役立つスクリプトをコンパイルしようとしています。 testptp.cファイルは、これを行うのに役立つスクリプトです。これはLinuxカーネルに組み込まれています。しかし、私はそれをコンパイルできません。私だけですか?このユーティリティスクリプトについて多くの人が話しているのを見ましたが、私が見た唯一のオンラインチュートリアルは次のとおりです。https://docs.nvidia.com/networking/display/NVIDIA5TTechnologyUserManualv10/Testptp

gcc を使用して testptp.c をコンパイルするように指示します。 testptp.cのみがあるディレクトリで、次のコマンドを使用してコンパイルしますgcc testptp.c -o testptp。また、gitからLinuxカーネルをインポートして実行tools/testing/selftests/ptpしましたmake。どちらも同じ結果を生成します。

これは私の結果です。

Makefile:10: warning: overriding recipe for target 'clean'
../lib.mk:130: warning: ignoring old recipe for target 'clean'
gcc -I../../../../usr/include/    testptp.c  -lrt -o testptp
testptp.c: In function ‘main’:
testptp.c:295:15: error: ‘struct ptp_clock_caps’ has no member named ‘adjust_phase’
  295 |           caps.adjust_phase);
      |               ^
testptp.c:429:28: error: ‘PTP_PEROUT_DUTY_CYCLE’ undeclared (first use in this function)
  429 |    perout_request.flags |= PTP_PEROUT_DUTY_CYCLE;
      |                            ^~~~~~~~~~~~~~~~~~~~~
testptp.c:429:28: note: each undeclared identifier is reported only once for each function it appears in
testptp.c:430:18: error: ‘struct ptp_perout_request’ has no member named ‘on’
  430 |    perout_request.on.sec = pulsewidth / NSEC_PER_SEC;
      |                  ^
testptp.c:431:18: error: ‘struct ptp_perout_request’ has no member named ‘on’
  431 |    perout_request.on.nsec = pulsewidth % NSEC_PER_SEC;
      |                  ^
testptp.c:434:28: error: ‘PTP_PEROUT_PHASE’ undeclared (first use in this function); did you mean ‘PTP_PEROUT_REQUEST’?
  434 |    perout_request.flags |= PTP_PEROUT_PHASE;
      |                            ^~~~~~~~~~~~~~~~
      |                            PTP_PEROUT_REQUEST
testptp.c:435:18: error: ‘struct ptp_perout_request’ has no member named ‘phase’
  435 |    perout_request.phase.sec = perout_phase / NSEC_PER_SEC;
      |                  ^
testptp.c:436:18: error: ‘struct ptp_perout_request’ has no member named ‘phase’
  436 |    perout_request.phase.nsec = perout_phase % NSEC_PER_SEC;
      |                  ^
make: *** [<builtin>: testptp] Error 1

私はUbuntu 20.04を実行しています。 Linuxカーネルバージョン:5.15.0-53-generic

これは他の誰にも役立ちますか?

ベストアンサー1

/usr/include/linux/ptp_clock.hファイルの上書きエル私のために働くようです。

おすすめ記事