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

Cannot build C sample program connect-command on a NVIDIA Jetson TX2 #145

Open
kwahtong opened this issue Mar 12, 2020 · 14 comments
Open

Cannot build C sample program connect-command on a NVIDIA Jetson TX2 #145

kwahtong opened this issue Mar 12, 2020 · 14 comments

Comments

@kwahtong
Copy link

Summary

I am unable to build connect-command sample program on a NVIDIA Jetson TX2. I can verify that the protobuf-c headers and c source codes were generated. GCC complained missing members so I am not sure if issue lies on sample code or protobuf generation steps. Appreciate if can help. Many Thanks.

Steps to Reproduce (for bugs)

  1. Build protobuf-c as per protobuf-C README
    ./configure output
    protobuf-c 1.3.3
    CC: gcc
    CFLAGS: -g -O2
    CXX: g++ -std=c++11
    CXXFLAGS: -g -O2
    LDFLAGS:
    LIBS:
    prefix: /usr/local
    sysconfdir: ${prefix}/etc
    libdir: ${exec_prefix}/lib
    includedir: ${prefix}/include
    pkgconfigdir: ${libdir}/pkgconfig
    bigendian: no
    protobuf version: libprotoc 3.0.0
  2. Run make to generate protobuf-c header files and build c program
    $ ../aris-integration-sdk/sample-code/connect-command/linux$ make all
  3. Snippets of compiler errors
    cp ../../../common/protobuf/*.proto .
    protoc-c --c_out=../. *.proto
    gcc -std=c99 ../connect.c ../availability.pb-c.c ../commands.pb-c.c ../frame_stream.pb-c.c -I ../../../common/protobuf -I ../../../../protobuf-c -L/usr/lib -lprotobuf-c -o connect
    ../connect.c: In function ‘find_sonar’:
    ../connect.c:214:21: error: ‘Aris__Availability {aka struct _Aris__Availability}’ has no member named ‘has_serialnumber’; did you mean ‘serialnumber’?
    if (beacon->has_serialnumber && beacon->serialnumber == serial) {
    ^~~~~~~~~~~~~~~~
    serialnumber

Your Environment

  • Development Platform : NVIDIA Jetson TX2i
  • Operating System : Ubuntu 18.04 LTS (L4T r32.2.0 – Jetpack 4.2.1)
  • Libraries:
    protobuf-c 1.3.3
    libprotoc 3.0.0
    libprotobuf-dev Version: 3.0.0-9.1ubuntu1
    libprotoc-dev Version: 3.0.0-9.1ubuntu1
    protobuf-compiler Version: 3.0.0-9.1ubuntu1
    gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
@curtnichols
Copy link
Member

Thanks, I'll take a look at this. For what it's worth, this sample was written about 3 years ago, and this sample may not have moved forward with common/protobuf/commands.proto changes, which moved to protobuf syntax v3 two years ago.

You can probably make changes locally and finish with approximately what I will have when I move this code to protobuf v3--more or less, remove the has_xxx() function, and understand that if no value was given the value you see will be zero, zeroes, or empty.

For example, this

if (beacon->has_serialnumber && beacon->serialnumber == serial) {

will likely become

    if (beacon->serialnumber == serial) {

There is no ARIS serial number 0, so if the serial number were somehow missing from the beacon, serialnumber would appear to be 0, and the condition would still fail appropriately. Previously, we had to check has_serialnumber().

@curtnichols
Copy link
Member

Unfortunately, with the protobuf v3 syntax, values for systemtype and other fields may legitimately be zero, so we have to assume those are correctly initialized.

@curtnichols
Copy link
Member

@kwahtong Also, is this academic or commercial work? If academic, is there a project page we can follow? :)

@kwahtong
Copy link
Author

Hi Curt,

Thanks for the reply. I don't have a project for you to follow. But noted on the old code has not moved on much and probably not worth to work on it.

In that case, I would focus more on vc-using-framestream sample C++ project which I just managed to build successfully on VS2019. I will look into porting to the Jetson environment once the sample code can communicate with the ARIS. Appreciate advise if any.

Regards,
Sean

@curtnichols
Copy link
Member

Sounds good. I think we wrote connect-command mostly to ensure the headers, etc. were building okay. Irony. It's not currently in our CI pipeline as our internal pipeline doesn't have a Linux branch yet.

-Curt

@kwahtong
Copy link
Author

kwahtong commented Jul 9, 2020 via email

@curtnichols
Copy link
Member

Sean, the onboard software supports UDP point-to-point and, since 2.6.8634, multicast. You can use a multicast address from your controller program and have a second program join the multicast group and listen.

This is discussed in section Multicasting ARIS Frames of the documentation. Hope this helps.

Broadcast is not supported as it causes dire behavior in the onboard software's network stack.

@slyrasa
Copy link

slyrasa commented Aug 1, 2020

Hi Curt,
I have meeted the same bug,but i don't know how to solve.Do you mean the file connect.c cannot be compiled.If I want to connect aris 3000 by TX2 and receive the data frame,what should i do ?
I need your help,because my work is urgent.
Thanks,
sincerely
Xiaolei

1 similar comment
@slyrasa
Copy link

slyrasa commented Aug 1, 2020

Hi Curt,
I have meeted the same bug,but i don't know how to solve.Do you mean the file connect.c cannot be compiled.If I want to connect aris 3000 by TX2 and receive the data frame,what should i do ?
I need your help,because my work is urgent.
Thanks,
sincerely
Xiaolei

@kwahtong
Copy link
Author

kwahtong commented Aug 4, 2020 via email

@curtnichols
Copy link
Member

curtnichols commented Aug 4, 2020

@slyrasa can you confirm what your gcc build flags are? Are you building in C or C++, and what version?

@kwahtong your original post appears to be building in C99, is that still the case?

gcc -std=c99 ../connect.c ../availability.pb-c.c ../commands.pb-c.c ../frame_stream.pb-c.c -I ../../../common/protobuf -I ../../../../protobuf-c -L/usr/lib -lprotobuf-c -o connect

Also--are you using any pre-made, readily available images for your build tools, such as virtual machines or docker images?

@kwahtong
Copy link
Author

kwahtong commented Aug 5, 2020

@slyrasa can you confirm what your gcc build flags are? Are you building in C or C++, and what version?
It is C++ and was an attempt to build the connect-command project. Since it did not have frame receive support, I dropped the approach.

@kwahtong your original post appears to be building in C99, is that still the case?
The vc-using-framestream. sample project requires C++ 17 or even later. I did not use pre-made vm/docker images in TX2.

@slyrasa
Copy link

slyrasa commented Aug 5, 2020 via email

@slyrasa
Copy link

slyrasa commented Aug 12, 2020

HI,kwahtong
I have successfully run vc-using-framestream,now i want to port over to the TX2 environment.But firstly i prefer to run it on my computer for convenience,then turn to TX2.
I write a makefile document and i put it in the end. the error about #include show it don't exist,then i replace it with #include<boost/optional.cpp>,it will show new error,like this
‘optional’ in namespace ‘std’ does not name a template type
std::optional useMulticast; i don't know how to solve ,can you help me.which file should i change?
The error "somewas not declared " " has no member" "expected primary-expression before"appears many times,i guess i couldn't solve the problem by myself.
thanks!!

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

No branches or pull requests

3 participants