Closed maefromm closed 7 years ago
hi, @maefromm, I git-cloned the latest commit of this repository : acdca4184712a92b9318f3d0fbf9d70e581361aa
and followed the instructions in INSTALL.md
.
By using the Makefile
under examples/sample.source.J2735
, I invoke make regen
to force generate these C and H files even they already exist.
The corresponding command line is :
../../asn1c/asn1c -S ../../skeletons -pdu=MessageFrame -fcompound-names -gen-PER ../J2735_201603.asn1
I can build j2735-dump successfully.
As for the generated struct MapData
in MapData.h
, I got the
/* MapData */
typedef struct MapData {
MinuteOfTheYear_t *timeStamp /* OPTIONAL */;
DSRC_MsgCount_t msgIssueRevision;
LayerType_t *layerType /* OPTIONAL */;
LayerID_t *layerID /* OPTIONAL */;
struct IntersectionGeometryList *intersections /* OPTIONAL */;
struct RoadSegmentList *roadSegments /* OPTIONAL */;
struct DataParameters *dataParameters /* OPTIONAL */;
struct RestrictionClassList *restrictionList /* OPTIONAL */;
struct MapData__regional {
A_SEQUENCE_OF(struct RegionalExtension) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} *regional;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} MapData_t;
Inner type struct region
has been prefixed with MapData__
so there is no conflict occurred.
I don't know what happen in your trial ?
Perhaps you can add -fcompound-names
in your command for generating C/H files ?
maefromm: As a rough guess, the lines like these...
In file included from MessageFrame.h:19:0,
from MessageFrame.c:8:
MapData.h:44:9: error: redefinition of ‘struct regional’
struct regional {
^
In file included from MessageFrame.h:18:0,
from MessageFrame.c:8:
BasicSafetyMessage.h:37:9: note: originally defined here
struct regional {
Are probably just name / scope issues. It is not clear to me that ASN1c tool has correctly disambiguated them.
In the DSRC J2735 standard we use the term "regional" to imply a place that a local deployment can add additional data content in that part. Each maps to a formal type def with the defined content (if any) the local deployment wanted to add. So the term is used many dozens of times. In the above, the "master" message frame (the PDU of the J2735 work) has both a MAP and a BSM message within it. Both of these in turn define a regional entry (as do other entries) using a common pattern:
regional SEQUENCE (SIZE(1..4)) OF
RegionalExtension {{REGION.Reg-BasicSafetyMessage}} OPTIONAL,
and
regional SEQUENCE (SIZE(1..4)) OF
RegionalExtension {{REGION.Reg-MapData}} OPTIONAL,
Aside: Note the use of module names in the above as well. All the regional content is placed into REGION. For a deployments not using regional content, the standard ships with a pile of dummy stub values to use. If you are in the EU and you want to us the "GroupB" region, you rename it REGION. If you have developed a region of your own called "bob" you rename that REGION as well. While up to four of these are allowed, we (or I anyway) have never seen more than one at a time,
I defer to Lev on how to overcome this, but in this body of work the same instance name is often reused in different structures found within a common containing structure. My memory wants to tell me there was an ASN1c option you could invoke to disambiguate things, similar to what you have to do with enumerated name conflicts.
Just saw the comment from brchiu after I posted - do as he suggest with...
Perhaps you can add -fcompound-names in your command for generating C/H files ?
Hey maefromm, did you manage to compile the code?
I am trying to compile and generate code for TCI and seem like the make -f Makefile-am.sample keep running into error like "CHOICE_decode_oer" undeclare here...(not in function). I tried different commit and it still complaints the same thing. Help needed here!
@maefromm I am able to generate J2735 code and build and run the sample code without any error using the master branch. That said, partIIcontent is not being decoded completely. partII-Id is decoded but partII-value is being produced as hex encoding. That's despite that it does handle the IoC construct within a MessageFrame PDU but not the partIIcontent within the partII section of a BSM embedded in a MessageFrame. I believe this is a known parameterization issue that @vlm is working to resolve.
However, this only works with the sample.source.J2735. If I create a new directory and put the ASN.1 files in it and generate the code using the following:
asn1c -pdu=MessageFrame -gen-PER *.asn1
I get the same errors about redefinition of 'struct regional'
:
In file included from MessageFrame.h:19:0,
from MessageFrame.c:8:
MapData.h:44:9: error: redefinition of 'struct regional'
struct regional {
^
In file included from MessageFrame.h:18:0,
from MessageFrame.c:8:
BasicSafetyMessage.h:37:9: note: originally defined here
struct regional {
^
In file included from IntersectionGeometry.h:18:0,
from IntersectionGeometryList.h:44,
from MapData.h:69,
from MessageFrame.h:19,
from MessageFrame.c:8:
...
Thank you all for your comments.
Just wanted to clarify that the files I have were purchased from SAE earlier this year/late last year. The file was named "J2735_201603_ASN.asn", along with a separate PDF file. This text file contains all the J2735_201603 DSRC definitions. I didn't update the file extension to ".asn1", since it didn't seem to make a difference. Please let me know if I needed to do anything else with this file before processing.
@brchiu not sure if you read my text file and the steps I took. So, based on your last comment, I went ahead and replaced the command "sudo asn1c -gen-PER J2735_201603_ASN.asn" to "sudo asn1c -gen-PER -fcompound-names J2735_201603_ASN.asn". The -fcompound-names did help resolve the re-definition and re-declaration type errors. Before: "struct regional" After: : "struct MapData__regional" and got me further.
However, it hit another ERROR below while it was generating the *.o files. Could you let me know how I could resolve this issue?
"(truncated)... constr_TYPE.o constraints.o xer_support.o xer_decoder.o xer_encoder.o oer_decoder.o oer_encoder.o oer_support.o per_support.o per_decoder.o per_encoder.o per_opentype.o converter-sample.o converter-sample.o:(.data+0x0): undefined reference to `asn_DEF_PDU' collect2: error: ld returned 1 exit status Makefile.am.sample:1059: recipe for target 'progname' failed make: *** [progname] Error 1"
Thank you for your assistance!
Thanks @maefromm . Adding -fcompound-names -fwide-types did get rid of redefinition of 'struct regional'
errors. I'm not getting any errors building J2735 now.
@hmusavi that's great to hear. Did you use the full text file of J2735_201603_ASN.asn, or are you using just a sample file?
@maefromm I used the full official J2735 ASN file plus an extension to J2735 used in our application.
@hmusavi Thank you for the response. I am not sure why mine is not compiling fully and receiving the error I reported above. I checked master and there hasn't been any updates since 9 days ago so my 08/18 pull from master should still be good. Questions below to figure out what may be different between our setup:
Do you have the same "J2735_201603_ASN.asn" file extension, and did you do anything special to the text file before generating the code?
Could you kindly review the text file that I attached on the first post. The only difference was I updated the 2nd to the last command to "sudo asn1c -gen-PER -fcompound-names J2735_201603_ASN.asn". Could you send me the command(s)/steps that you used or is different?
Thanks again!
@maefromm,
If you use command line sudo asn1c -gen-PER -fcompound-names J2735_201603_ASN.asn
, you are using system-wide asn1c in system's search path, but not newly built asn1c from master repository.
There might several old versions asn1c in your system's executable search path.
Especially if you installed asn1c through sudo apt-get install asn1c
before.
If you are using Ubuntu, you can check it by locate asn1c
.
The quickest and un-ambiguious way is to specify the absolute path of this newest
/<path to your newly retrieved and built asn1c repository>'/asn1c/asn1c -S /<path to your newly retrieved and built asn1c repository>'/skeletons -pdu=MessageFrame -fcompound-names -gen-PER J2735_201603.asn1
For example, if I retrieve vlm's repository to /home/brchiu/asn1c_vlm and built asn1c :
/home/brchiu/asn1c_vlm/asn1c/asn1c -S /home/brchiu/asn1c_vlm/skeletons -pdu=MessageFrame -fcompound-names -gen-PER J2735_201603.asn1
Folks, I am now working to resolve the partII binary encoding issue. Please be patient.
@maefromm, sorry for I overlook your post that you mention a undefined asn_DEF_PDU
symbole problem.
As I know you need to specify the 'outmost' message name (not an accurate description but I don't know to describe it formally) by adding `-pdu=
You can have a look at Makefiles under various sample.source.XXXX directories.
For example, examples/sample.source.RRC/Makefile
specifis -pdu=DL-DCCH-Message
in its command line. And examples/sample.source.J2735/Makefile
specifies -pdu=MessageFrame
.
@maefromm I did not do anything to the J2735 ASN file. I used it exactly as it was provided by SAE.
I installed asn1c exactly as instructed in the INSTALL.md but I don't think I did the --enable-Werror --enable-ASN_DEBUG options. Then generated code and built it using the following commands:
asn1c -pdu=MessageFrame -pdu=BasicSafetyMessage -fcompound-names -fwide-types -gen-PER *.asn
make -f Makefile.am.sample
I was getting the redefinition errors that you were getting without -fcompound-names -fwide-types
options which were promptly resolved by including the options.
@hmusavi Thank you for your response! Is there any reason why you're using -fwide-types. I did look it up but wondering on your usage/preference.
@brchiu Thank you so much! Yes it was the -pdu that was missing. It wasn't apparent to me that this parameter and the -fcompound-names were required for J2735_201603. So, thanks for pointing that out. The specific message types that I was particularly interested did not produce any errors when compiling the generated code. However, it did error out on the last attempt (#5) to build all types instead of individual ones, do you have any suggestions on these errors? Thank you!
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=BasicSafetyMessage -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=MapData -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=TravelerInformation -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=SPAT -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=all -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
ERROR when -pdu=all
r_decoder.o per_encoder.o per_opentype.o converter-sample.o pdu_collection.o
converter-sample.o:(.data+0x0): undefined reference to asn_DEF_PDU' pdu_collection.o:(.data+0x8): undefined reference to
asn_DEF_RegionalExtension'
pdu_collection.o:(.data+0x18): undefined reference to `asn_DEF_PartIIcontent'
collect2: error: ld returned 1 exit status
Makefile.am.sample:1060: recipe for target 'progname' failed
make: *** [progname] Error 1
@maefromm ,
As I see, vlm already crate a example/sample.source.J2735
directory and there is a usable Makefile
there, why don't you reference it directly or indirectly rather than by trail and error ?
@brchiu Thank you! I'm new to this and was trying to understand the options/parameters as well used against the file. Just saw that MessageFrame in J2735 contains all the message types and that's why it's used in the MakeFile. I guess "-pdu=all" is not applicable to J2735. When I updated to "-pdu=MessageFrame", it compiled the generated code without any errors. Thank you very for your help! Next step would be test it :)
/home/mfromm/asn1c-master/asn1c/asn1c/asn1c -pdu=MessageFrame -fcompound-names -gen-PER J2735_201603_ASN.asn make -f Makefile.am.sample
@maefromm No particular reason for -fwide-types, really. I think that was suggested by one of the posters. It'll build without it.
Good morning, I downloaded the latest master files from this morning and on the 14th and I wasn't able to compile the generated code. Attached are the steps that I took and errors encountered. Please let me know if there's any steps that I may have missed/misunderstood. Thank you and have a great day!
asn1c_errors_2017_0818_0945.txt