asn1c icon indicating copy to clipboard operation
asn1c copied to clipboard

Unknown type "DATE" error when compiling ISO ASN.1

Open yuasabe opened this issue 3 years ago • 2 comments

Hello,

I am using asn1c to compile ASN.1 modules defined by ETSI, related to the ITS sector. I had to use the ISO standard, ISO24534-3, with it as a dependency, but this ISO24534-3 includes a DATE type.

This is the command I have used:

asn1c -fcompound-names asn/CPM.asn asn/CPM_CommonDataTypes.asn asn/FreeSpaceAddendum.asn asn/OriginatingStationdata.asn asn/PerceivedObject.asn asn/SensorInformation.asn asn/cam/CAM-PDU-Descriptions.asn asn/cdd/ITS-Container.asn asn/vam/VAM-PDU-Descriptions.asn asn/vam/VAM-Temp-Imports.asn iso/iso19091_2018.asn iso/iso24534-3_1_2015.asn iso/iso24534-3_2_2015.asn iso/ISO14816_AVIAEINumberingAndDataStructures.asn -R -D output

When compiling, I would get the following error:

FATAL: Unknown type "DateOfFirstRegistration" referenced by "dateOfFirstRegistration" at line 66 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "DateOfRegistration" referenced by "dateOfRegistration" at line 67 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "ValidThru" referenced by "validThru" at line 68 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "DATE" referenced by "DateOfFirstRegistration" at line 166 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "DATE" referenced by "DateOfRegistration" at line 167 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "DATE" referenced by "ValidThru" at line 168 in iso/iso24534-3_1_2015.asn
FATAL: Unknown type "DATE" referenced by "date" at line 333 in iso/iso24534-3_1_2015.asn

If I add a -fknown-extern-type=DATE to the command, this error would go away, but when I add a -D output to output the compiled files in a directory, the errors would come back up and it would give me a segmentation error as well:

[1]    331994 segmentation fault (core dumped)  asn1c -fcompound-names -fknown-extern-type=DATE -fincludes-quoted asn/CPM.asn

Is this because the DATE type is not supported yet, or am I missing something here? I'm quite knew to ASN1 in general, so any help would be appreciated! Thanks in advance.

yuasabe avatar Jul 15 '21 04:07 yuasabe

If you have installed asn1c using apt-get you probably have the older version. Download latest code from GitHub and compile asn1c. Older version doesn't support some of the ASN1 features

On Thu 15 Jul, 2021, 10:25 Yu Asabe, @.***> wrote:

Hello,

I am using asn1c to compile ASN.1 modules defined by ETSI, related to the ITS sector. I had to use the ISO standard, ISO24534-3, with it as a dependency, but this ISO24534-3 includes a DATE type.

This is the command I have used:

asn1c -fcompound-names asn/CPM.asn asn/CPM_CommonDataTypes.asn asn/FreeSpaceAddendum.asn asn/OriginatingStationdata.asn asn/PerceivedObject.asn asn/SensorInformation.asn asn/cam/CAM-PDU-Descriptions.asn asn/cdd/ITS-Container.asn asn/vam/VAM-PDU-Descriptions.asn asn/vam/VAM-Temp-Imports.asn iso/iso19091_2018.asn iso/iso24534-3_1_2015.asn iso/iso24534-3_2_2015.asn iso/ISO14816_AVIAEINumberingAndDataStructures.asn -R -D output

When compiling, I would get the following error:

FATAL: Unknown type "DateOfFirstRegistration" referenced by "dateOfFirstRegistration" at line 66 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "DateOfRegistration" referenced by "dateOfRegistration" at line 67 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "ValidThru" referenced by "validThru" at line 68 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "DATE" referenced by "DateOfFirstRegistration" at line 166 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "DATE" referenced by "DateOfRegistration" at line 167 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "DATE" referenced by "ValidThru" at line 168 in iso/iso24534-3_1_2015.asn FATAL: Unknown type "DATE" referenced by "date" at line 333 in iso/iso24534-3_1_2015.asn

If I add a -fknown-extern-type=DATE to the command, this error would go away, but when I add a -D output to output the compiled files in a directory, the errors would come back up and it would give me a segmentation error as well:

[1] 331994 segmentation fault (core dumped) asn1c -fcompound-names -fknown-extern-type=DATE -fincludes-quoted asn/CPM.asn

Is this because the DATE type is not supported yet, or am I missing something here? I'm quite knew to ASN1 in general, so any help would be appreciated! Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vlm/asn1c/issues/436, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2NDKFTWNONFDFKUJRMHUDTXZS4TANCNFSM5AMYFP4Q .

Ramana8055 avatar Jul 15 '21 04:07 Ramana8055

Thanks! I did try compiling the latest asn1c but couldn't get it to work with an ASN.1 file that included the DATE type. I ended up including the following bit to define it using primitives.

DATE ::= NumericString(SIZE (8))

yuasabe avatar Jul 18 '21 15:07 yuasabe