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] kvs_gstreamer_sample.cpp.o: undefined reference to symbol 'strtoi32' #930

Closed
thomas-roos opened this issue Dec 21, 2022 · 13 comments · Fixed by #997
Closed

[BUG] kvs_gstreamer_sample.cpp.o: undefined reference to symbol 'strtoi32' #930

thomas-roos opened this issue Dec 21, 2022 · 13 comments · Fixed by #997
Labels

Comments

@thomas-roos
Copy link
Contributor

mentioned here: aws4embeddedlinux/meta-aws#1701

aarch64-poky-linux/11.3.0/ld: CMakeFiles/kvs_gstreamer_sample.dir/samples/kvs_gstreamer_sample.cpp.o: undefined reference to symbol 'strtoi32'

error_kvs_gstreamer_sample.log

@hassanctech
Copy link
Contributor

@thomas-roos can this be closed? I see the related issue: aws4embeddedlinux/meta-aws#1701 has been closed.

It does not appear to be an issue in the SDK if you follow this chain in kvs_gstreamer_sample we see that STRTOI32 macro (which is defined in CommonDefs.h) is in fact included:

https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/blob/70f74f14cf27b09f71dc1889f36eb6e04cdd90a8/src/KinesisVideoProducer.h

#include "com/amazonaws/kinesis/video/client/Include.h"

^ That above file is in PIC and includes the file we're looking for: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/client/include/com/amazonaws/kinesis/video/client/Include.h#L13

Could it be that some of the includes are not being found in the way the build is set up above?

@thomas-roos
Copy link
Contributor Author

the bug is not gone - as mentioned here: aws4embeddedlinux/meta-aws#1701 (comment)
I was just disabling this ONE test - the others just build fine.
Did dive deep a few hours and found the root of the problem.
Firstly, I build shared (as any Linux user).
When building static (pic only works) - the problem is magically gone.
Therefor I was looking at the produced libs (where this strtoi32 symbol is in)
And found that when building static this is in the libcproducer.so
When building shared, this is not - it's in a shared lib, but this lib is not linked against the kvs_gstreamer_sample.cpp
So I all what's finally necessary is editing the CMakeLists.txt to link the sample to kvspic as well (strtoi32 is in there)

  • target_link_libraries(kvs_gstreamer_sample ${GST_APP_LIBRARIES} KinesisVideoProducer)
  • target_link_libraries(kvs_gstreamer_sample ${GST_APP_LIBRARIES} KinesisVideoProducer kvspic)

thomas-roos added a commit to thomas-roos/amazon-kinesis-video-streams-producer-sdk-cpp that referenced this issue Jan 4, 2023
when building shared the kvs_gstreamer_sample.cpp example fails LINKING
fix awslabs#930
@sirknightj
Copy link
Contributor

Hi @thomas-roos, unfortunately I was unable to replicate the issue you ran into.

I just built latest/master on an Ubuntu 22.04.1 LTS machine using the following arguments:

cmake .. -DBUILD_DEPENDENCIES=OFF -DBUILD_GSTREAMER_PLUGIN=ON
make

I was able to run the sample applications just fine, after setting GST_PLUGIN_PATH to the build directory:

./kvs_gstreamer_sample test-stream ~/test.mp4
./kvs_gstreamer_file_uploader_sample test-stream-2 ~/test.mp4 0

Here's the output of nm -D on the libcproducer:

$ nm -D dependency/libkvscproducer/kvscproducer-src/libcproducer.so | grep "strtoi32"
000000000006020f T strtoi32

@thomas-roos Could you please share the CMake command used to build the SDK?

@thomas-roos
Copy link
Contributor Author

thomas-roos commented Feb 14, 2023

Hi sirknightj,
as said, the error occurs ONLY when builiding SHARED.
Therefore, you have to set
-DBUILD_STATIC=OFF
see other used options here: https://github.com/aws4embeddedlinux/meta-aws/blob/edfc1aa8aadbbdb095cedbec705f4b2f45ced440/recipes-sdk/amazon-kvs-producer-sdk/amazon-kvs-producer-sdk-cpp_3.3.1.bb#L53
did you build shared?

@niyatim23
Copy link
Contributor

Hi @thomas-roos, what do mean by "SHARED" here? We have a working linux static build here. That's why, we do not think there is any issue with the SDKs builds. Please follow the steps here to fix your build using the latest release of the SDK and let us know if the issue persists

@thomas-roos
Copy link
Contributor Author

Hi @niyatim23
I mean SHARED linking - shared libraries as it's the Linux default.
When you build it to use shared libraries, it needs a CMake define -DBUILD_STATIC=OFF
I use version 3.3.1 (should be the latest) and this is the fix: #932
And yes, still persists - may try to define -DBUILD_STATIC=OFF in your example and then try my fix?

@niyatim23
Copy link
Contributor

Hi @thomas-roos, we also have a -DBUILD_STATIC=OFF build here (it is off by default). It works fine without making any changes to CMakeLists. Can you try retracing those steps and let us know if it works for you?

@thomas-roos
Copy link
Contributor Author

Hi,
think I found the understanding problem - you tell me building shared is default for this project - cool, I would do the same.
But here: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/c8325887faa3a4a296c4367b281c778be69875b6/CMakeLists.txt#L22 static is default - when you build it shared you will have my problem.
I do build all libs separate and set -DBUILD_DEPENDENCIES=OFF and -DBUILD_STATIC=OFF (you never know what is default;)
Agree?

benwkim pushed a commit that referenced this issue Mar 17, 2023
when building shared the kvs_gstreamer_sample.cpp example fails LINKING
fix #930
benwkim pushed a commit that referenced this issue Mar 17, 2023
when building shared the kvs_gstreamer_sample.cpp example fails LINKING
fix #930
@rpcme
Copy link

rpcme commented Apr 5, 2023

@benwkim what is the timeline for folding the fix into mainline and resolving this issue? We are waiting on the fix in order to resolve an issue in the meta-aws project.

@jdelapla
Copy link
Contributor

jdelapla commented Apr 6, 2023

@rpcme We're currently testing a release candidate that includes this change, we hope to release before the end of the month.

benwkim pushed a commit that referenced this issue Apr 11, 2023
when building shared the kvs_gstreamer_sample.cpp example fails LINKING
fix #930
disa6302 pushed a commit that referenced this issue Apr 11, 2023
* Update CMakeLists.txt

when building shared the kvs_gstreamer_sample.cpp example fails LINKING
fix #930

* Additional CI Build

---------

Co-authored-by: tro <throos@amazon.de>
@sirknightj sirknightj linked a pull request Apr 11, 2023 that will close this issue
@sirknightj sirknightj linked a pull request Apr 24, 2023 that will close this issue
@thomas-roos
Copy link
Contributor Author

Which month will this release candidate released?

@sirknightj
Copy link
Contributor

@thomas-roos we are aiming for before the end of this month

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment