Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Sample code fails to build when IOT_CORE_ENABLE_CREDENTIALS is enabled. #1879

Closed
2 tasks done
narutaro opened this issue Dec 8, 2023 · 5 comments
Closed
2 tasks done
Labels
bug Something isn't working needs-triage

Comments

@narutaro
Copy link

narutaro commented Dec 8, 2023

Please confirm you have already done the following

  • I have searched the repository for related/existing bug reports
  • I have all the details the issue requires

Describe the bug

Sample code fails to build when IOT_CORE_ENABLE_CREDENTIALS is enabled. See the error in the sections below.

Expected Behavior

The build succeeds.

Current Behavior

Error:

Admin:~/amazon-kinesis-video-streams-webrtc-sdk-c/build (master) $ vi ../samples/Samples.h 
Admin:~/amazon-kinesis-video-streams-webrtc-sdk-c/build (master) $ make
[ 13%] Built target kvsWebrtcSignalingClient
[ 84%] Built target kvsWebrtcClient
Scanning dependencies of target kvsWebrtcClientViewer
[ 86%] Building C object samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c: In function ‘respondWithAnswer’:
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:305:65: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘UINT64 {aka long unsigned int}’ [-Wformat=]
     SNPRINTF(message.correlationId, MAX_CORRELATION_ID_LEN, "%llu_%llu", GETTIME(), ATOMIC_INCREMENT(&pSampleStreamingSession->correlationIdPostFix));
                                                              ~~~^
                                                              %lu
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:305:70: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘SIZE_T {aka long unsigned int}’ [-Wformat=]
     SNPRINTF(message.correlationId, MAX_CORRELATION_ID_LEN, "%llu_%llu", GETTIME(), ATOMIC_INCREMENT(&pSampleStreamingSession->correlationIdPostFix));
                                                                   ~~~^
                                                                   %lu
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c: In function ‘createSampleConfiguration’:
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:825:10: error: ‘pIotCoreCertificateId’ undeclared (first use in this function); did you mean ‘pIotCorePrivateKey’?
     if ((pIotCoreCertificateId = getenv(IOT_CORE_CERTIFICATE_ID)) != NULL) {
          ^~~~~~~~~~~~~~~~~~~~~
          pIotCorePrivateKey
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:825:10: note: each undeclared identifier is reported only once for each function it appears in
samples/CMakeFiles/kvsWebrtcClientViewer.dir/build.make:62: recipe for target 'samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o' failed
make[2]: *** [samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o] Error 1
CMakeFiles/Makefile2:164: recipe for target 'samples/CMakeFiles/kvsWebrtcClientViewer.dir/all' failed
make[1]: *** [samples/CMakeFiles/kvsWebrtcClientViewer.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Defining pIotCoreCertificateId in createSampleConfiguration function in common.c fixes the error.

Reproduction Steps

Enable #define IOT_CORE_ENABLE_CREDENTIALS 1 in the amazon-kinesis-video-streams-webrtc-sdk-c/samples/Samples.h

cd ~/amazon-kinesis-video-streams-webrtc-sdk-c/build
make

WebRTC C SDK version being used

1.9.0

Compiler and Version used

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Operating System and version

Ubuntu 7.5.0-3ubuntu1~18.04

Platform being used

Cloud9

@narutaro narutaro added bug Something isn't working needs-triage labels Dec 8, 2023
@narutaro
Copy link
Author

narutaro commented Dec 8, 2023

Hi @disa6302, thank you for your reply.

Please provide verbose log file.

Is this OK?

Admin:~/amazon-kinesis-video-streams-webrtc-sdk-c/build (master) $ make VERBOSE=1
/usr/bin/cmake -H/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c -B/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make -f CMakeFiles/kvsWebrtcSignalingClient.dir/build.make CMakeFiles/kvsWebrtcSignalingClient.dir/depend
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
cd /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles/kvsWebrtcSignalingClient.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make -f CMakeFiles/kvsWebrtcSignalingClient.dir/build.make CMakeFiles/kvsWebrtcSignalingClient.dir/build
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make[2]: Nothing to be done for 'CMakeFiles/kvsWebrtcSignalingClient.dir/build'.
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
[ 13%] Built target kvsWebrtcSignalingClient
make -f CMakeFiles/kvsWebrtcClient.dir/build.make CMakeFiles/kvsWebrtcClient.dir/depend
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
cd /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/CMakeFiles/kvsWebrtcClient.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make -f CMakeFiles/kvsWebrtcClient.dir/build.make CMakeFiles/kvsWebrtcClient.dir/build
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make[2]: Nothing to be done for 'CMakeFiles/kvsWebrtcClient.dir/build'.
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
[ 84%] Built target kvsWebrtcClient
make -f samples/CMakeFiles/kvsWebrtcClientViewer.dir/build.make samples/CMakeFiles/kvsWebrtcClientViewer.dir/depend
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
cd /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/samples /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/samples/CMakeFiles/kvsWebrtcClientViewer.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
make -f samples/CMakeFiles/kvsWebrtcClientViewer.dir/build.make samples/CMakeFiles/kvsWebrtcClientViewer.dir/build
make[2]: Entering directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
[ 86%] Building C object samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o
cd /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build/samples && /usr/bin/cc -DCMAKE_DETECTED_CACERT_PATH -DDETECTED_GIT_HASH -DENABLE_AWS_SDK_IN_TESTS -DENABLE_DATA_CHANNEL -DKVS_CA_CERT_PATH=\"/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/certs/cert.pem\" -DKVS_USE_OPENSSL -DSDK_VERSION=\"0ae9ec6b80deff9df724555927fb6595a23054f1\" -DVERSION_STRING=\"1.8.1\" -I/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/include -I/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/src/include -I/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/src/ice  -fPIC   -o CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o   -c /home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c: In function ‘respondWithAnswer’:
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:305:65: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘UINT64 {aka long unsigned int}’ [-Wformat=]
     SNPRINTF(message.correlationId, MAX_CORRELATION_ID_LEN, "%llu_%llu", GETTIME(), ATOMIC_INCREMENT(&pSampleStreamingSession->correlationIdPostFix));
                                                              ~~~^
                                                              %lu
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:305:70: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘SIZE_T {aka long unsigned int}’ [-Wformat=]
     SNPRINTF(message.correlationId, MAX_CORRELATION_ID_LEN, "%llu_%llu", GETTIME(), ATOMIC_INCREMENT(&pSampleStreamingSession->correlationIdPostFix));
                                                                   ~~~^
                                                                   %lu
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c: In function ‘createSampleConfiguration’:
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:828:10: error: ‘pIotCoreCertificateId’ undeclared (first use in this function); did you mean ‘pIotCorePrivateKey’?
     if ((pIotCoreCertificateId = getenv(IOT_CORE_CERTIFICATE_ID)) != NULL) {
          ^~~~~~~~~~~~~~~~~~~~~
          pIotCorePrivateKey
/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/samples/Common.c:828:10: note: each undeclared identifier is reported only once for each function it appears in
samples/CMakeFiles/kvsWebrtcClientViewer.dir/build.make:62: recipe for target 'samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o' failed
make[2]: *** [samples/CMakeFiles/kvsWebrtcClientViewer.dir/Common.c.o] Error 1
make[2]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
CMakeFiles/Makefile2:164: recipe for target 'samples/CMakeFiles/kvsWebrtcClientViewer.dir/all' failed
make[1]: *** [samples/CMakeFiles/kvsWebrtcClientViewer.dir/all] Error 2
make[1]: Leaving directory '/home/ubuntu/amazon-kinesis-video-streams-webrtc-sdk-c/build'
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

please confirm how you set up the IoT credential provider and the channel name you are using

I was following this steps but do you mean that the cloud configuration affects the client build process?

@disa6302
Copy link
Contributor

disa6302 commented Dec 8, 2023

@narutaro ,

Thank you for your PR. I misread the description and thought it was a runtime issue. Apologies.

@noorjabermd
Copy link

Having the same issue @narutaro. What did you define pIotCoreCertificateId to exactly? Thanks in advance.

@sirknightj
Copy link
Contributor

@noorjabermd see #1880

@sirknightj
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage
Projects
None yet
Development

No branches or pull requests

4 participants