vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.05k stars 559 forks source link

FATAL error: component xxx at line xxx has the same tag as component xxx at line xxx #291

Closed luyoutao closed 6 years ago

luyoutao commented 6 years ago

Dear developer,

Thanks for developing the software.

While trying this package on this specification (ftp://ftp.ncbi.nlm.nih.gov/pubchem/specifications/pubchem.asn), I got lots of such errors but don't know exactly what they mean.

FATAL error: component xxx at line xxx has the same tag as component xxx at line xxx
FATAL: Consider adding xxx after module xxx DEFINITIONS, or manually tag components in xxx

Command line of invocation: asn1c pubchem.asn System version: MacOS 10.12.6 asn1c version: 0.9.28

velichkov commented 6 years ago

Hi @foehnwind,

FATAL: Processing Date-std at line 70: component "month" at line 71 has the same tag as component "day" at line 72 in pubchem.orig.asn FATAL: Consider adding AUTOMATIC TAGS after module NCBI-General DEFINITIONS, or manually tag components in pubchem.orig.asn

Add the AUTOMATIC TAGS as suggested by the error message and compile with -fcompound-names and -pdu=all options

asn1c -fcompound-names -pdu=all pubchem.new.asn
make -f converter-example.mk 
./converter-example -p list
./converter-example -p Pub-set -iber -otext example.ber
--- pubchem.orig.asn    2018-08-07 10:46:15.067998516 +0300
+++ pubchem.new.asn 2018-08-07 10:46:56.700024344 +0300
@@ -18,7 +18,7 @@
 --
 --**********************************************************************

-NCBI-General DEFINITIONS ::=
+NCBI-General DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS Date, Person-id, Object-id, Dbtag, Int-fuzz, User-object, User-field;
@@ -177,7 +177,7 @@
 --
 --****************************************************************

-NCBI-Biblio DEFINITIONS ::=
+NCBI-Biblio DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS Cit-art, Cit-jour, Cit-book, Cit-pat, Cit-let, Id-pat, Cit-gen,
@@ -422,7 +422,7 @@
 --
 --**********************************************************************

-NCBI-Medline DEFINITIONS ::=
+NCBI-Medline DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS Medline-entry, Medline-si;
@@ -512,7 +512,7 @@
 --  support for PubMedId added in 1996
 --********************************************************************

-NCBI-Pub DEFINITIONS ::=
+NCBI-Pub DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS Pub, Pub-set, Pub-equiv;
@@ -557,7 +557,7 @@
 --
 --**********************************************************************

-NCBI-Organism DEFINITIONS ::=
+NCBI-Organism DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS Org-ref;
@@ -665,7 +665,7 @@
 --
 --**********************************************************************

-NCBI-BioSource DEFINITIONS ::=
+NCBI-BioSource DEFINITIONS AUTOMATIC TAGS ::=
 BEGIN

 EXPORTS BioSource;
@@ -792,7 +792,7 @@
 --
 -- ===========================================================================

-NCBI-PCSubstance DEFINITIONS ::= BEGIN
+NCBI-PCSubstance DEFINITIONS AUTOMATIC TAGS ::= BEGIN

 EXPORTS PC-Substance, PC-Compound, PC-Substances, PC-Compounds,
         PC-Source, PC-ID, PC-InfoData, PC-XRefData;
@@ -1468,7 +1468,7 @@
 --
 -- ===========================================================================

-NCBI-PCAssay DEFINITIONS ::= BEGIN
+NCBI-PCAssay DEFINITIONS AUTOMATIC TAGS ::= BEGIN

 IMPORTS Pub                              FROM NCBI-Pub
         BioSource                        FROM NCBI-BioSource 
luyoutao commented 6 years ago

Hi @velichkov, thanks to the detailed instructions. I added AUTOMATIC TAGS, ran asn1c with -fcompound-names -pdu=all and it worked. But later I got some compiling error.

export CC=gcc-8
make -f Makefile.am.sample
gcc-8 -DASN_PDU_COLLECTION -I. -o Date.o -c Date.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Date-std.o -c Date-std.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Dbtag.o -c Dbtag.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Object-id.o -c Object-id.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Person-id.o -c Person-id.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Name-std.o -c Name-std.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Int-fuzz.o -c Int-fuzz.c
gcc-8 -DASN_PDU_COLLECTION -I. -o User-object.o -c User-object.c
gcc-8 -DASN_PDU_COLLECTION -I. -o User-field.o -c User-field.c
gcc-8 -DASN_PDU_COLLECTION -I. -o ArticleId.o -c ArticleId.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PubMedId.o -c PubMedId.c
gcc-8 -DASN_PDU_COLLECTION -I. -o MedlineUID.o -c MedlineUID.c
gcc-8 -DASN_PDU_COLLECTION -I. -o DOI.o -c DOI.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PII.o -c PII.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PmcID.o -c PmcID.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PmcPid.o -c PmcPid.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PmPid.o -c PmPid.c
gcc-8 -DASN_PDU_COLLECTION -I. -o ArticleIdSet.o -c ArticleIdSet.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PubStatus.o -c PubStatus.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PubStatusDate.o -c PubStatusDate.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PubStatusDateSet.o -c PubStatusDateSet.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-art.o -c Cit-art.c
In file included from Title.h:15,
                 from Cit-jour.h:15,
                 from Cit-art.h:15,
                 from Cit-art.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-jour.o -c Cit-jour.c
In file included from Title.h:15,
                 from Cit-jour.h:15,
                 from Cit-jour.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-book.o -c Cit-book.c
In file included from Title.h:15,
                 from Cit-book.h:15,
                 from Cit-book.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-proc.o -c Cit-proc.c
In file included from Title.h:15,
                 from Cit-book.h:15,
                 from Cit-proc.h:15,
                 from Cit-proc.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-pat.o -c Cit-pat.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Patent-priority.o -c Patent-priority.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Id-pat.o -c Id-pat.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-let.o -c Cit-let.c
In file included from Title.h:15,
                 from Cit-book.h:15,
                 from Cit-let.h:15,
                 from Cit-let.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-sub.o -c Cit-sub.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Cit-gen.o -c Cit-gen.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Cit-gen.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Auth-list.o -c Auth-list.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Author.o -c Author.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Affil.o -c Affil.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Title.o -c Title.c
In file included from Title.h:15,
                 from Title.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Imprint.o -c Imprint.c
gcc-8 -DASN_PDU_COLLECTION -I. -o CitRetract.o -c CitRetract.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Meeting.o -c Meeting.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-entry.o -c Medline-entry.c
In file included from Title.h:15,
                 from Cit-jour.h:15,
                 from Cit-art.h:15,
                 from Medline-entry.h:17,
                 from Medline-entry.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-mesh.o -c Medline-mesh.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-qual.o -c Medline-qual.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-rn.o -c Medline-rn.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-si.o -c Medline-si.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Medline-field.o -c Medline-field.c
gcc-8 -DASN_PDU_COLLECTION -I. -o DocRef.o -c DocRef.c
gcc-8 -DASN_PDU_COLLECTION -I. -o Pub.o -c Pub.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Pub.h:15,
                 from Pub.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Pub-equiv.o -c Pub-equiv.c
In file included from Pub-equiv.h:15,
                 from Pub-equiv.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Pub-set.o -c Pub-set.c
In file included from Pub-set.h:15,
                 from Pub-set.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o Org-ref.o -c Org-ref.c
gcc-8 -DASN_PDU_COLLECTION -I. -o OrgName.o -c OrgName.c
gcc-8 -DASN_PDU_COLLECTION -I. -o OrgMod.o -c OrgMod.c
gcc-8 -DASN_PDU_COLLECTION -I. -o BinomialOrgName.o -c BinomialOrgName.c
gcc-8 -DASN_PDU_COLLECTION -I. -o MultiOrgName.o -c MultiOrgName.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PartialOrgName.o -c PartialOrgName.c
gcc-8 -DASN_PDU_COLLECTION -I. -o TaxElement.o -c TaxElement.c
gcc-8 -DASN_PDU_COLLECTION -I. -o BioSource.o -c BioSource.c
gcc-8 -DASN_PDU_COLLECTION -I. -o SubSource.o -c SubSource.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Substance.o -c PC-Substance.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Pub.h:15,
                 from PC-Source.h:15,
                 from PC-Substance.h:16,
                 from PC-Substance.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Substances.o -c PC-Substances.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from PC-Substances.h:15,
                 from PC-Substances.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-ID.o -c PC-ID.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Source.o -c PC-Source.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Pub.h:15,
                 from PC-Source.h:15,
                 from PC-Source.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-DBTracking.o -c PC-DBTracking.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Pub.h:15,
                 from PC-DBTracking.h:48,
                 from PC-DBTracking.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-MMDBSource.o -c PC-MMDBSource.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-XRefData.o -c PC-XRefData.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Compound.o -c PC-Compound.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Compounds.o -c PC-Compounds.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-CompoundType.o -c PC-CompoundType.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Count.o -c PC-Count.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoGroup.o -c PC-StereoGroup.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-InfoData.o -c PC-InfoData.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Urn.o -c PC-Urn.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-UrnDataType.o -c PC-UrnDataType.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Coordinates.o -c PC-Coordinates.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Conformer.o -c PC-Conformer.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Conformers.o -c PC-Conformers.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-CoordinateType.o -c PC-CoordinateType.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-DrawAnnotations.o -c PC-DrawAnnotations.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-BondAnnotation.o -c PC-BondAnnotation.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Atoms.o -c PC-Atoms.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AtomSource.o -c PC-AtomSource.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AtomInt.o -c PC-AtomInt.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AtomString.o -c PC-AtomString.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AtomRadical.o -c PC-AtomRadical.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Element.o -c PC-Element.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-Bonds.o -c PC-Bonds.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-BondType.o -c PC-BondType.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoCenter.o -c PC-StereoCenter.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoTetrahedral.o -c PC-StereoTetrahedral.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoPlanar.o -c PC-StereoPlanar.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoSquarePlanar.o -c PC-StereoSquarePlanar.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoOctahedral.o -c PC-StereoOctahedral.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoTrigonalBiPyramid.o -c PC-StereoTrigonalBiPyramid.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoTShape.o -c PC-StereoTShape.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-StereoPentagonalBiPyramid.o -c PC-StereoPentagonalBiPyramid.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayContainer.o -c PC-AssayContainer.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from PC-AssayContainer.h:15,
                 from PC-AssayContainer.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssaySubmit.o -c PC-AssaySubmit.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from Auth-list.h:15,
                 from Cit-gen.h:55,
                 from Pub.h:15,
                 from PC-Source.h:15,
                 from PC-AssaySubmit.h:16,
                 from PC-AssaySubmit.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayResults.o -c PC-AssayResults.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from PC-AssayResults.h:17,
                 from PC-AssayResults.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayData.o -c PC-AssayData.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayDescription.o -c PC-AssayDescription.c
In file included from ./asn_SEQUENCE_OF.h:8,
                 from PC-AssayDescription.h:19,
                 from PC-AssayDescription.c:8:
Title.h:43:9: warning: 'union Title__Member_u' declared inside parameter list will not be visible outside of this definition or declaration
   union Title__Member_u {
         ^~~~~~~~~~~~~~~
Title.h:41:18: warning: 'struct Title__Member' declared inside parameter list will not be visible outside of this definition or declaration
  A_SET_OF(struct Title__Member {
                  ^~~~~~~~~~~~~
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayPanel.o -c PC-AssayPanel.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayPanelMember.o -c PC-AssayPanelMember.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-CategorizedComment.o -c PC-CategorizedComment.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayDRAttr.o -c PC-AssayDRAttr.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayTargetInfo.o -c PC-AssayTargetInfo.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AnnotatedXRef.o -c PC-AnnotatedXRef.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-ResultType.o -c PC-ResultType.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-AssayPanelTestResult.o -c PC-AssayPanelTestResult.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-ConcentrationAttr.o -c PC-ConcentrationAttr.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-IntegerMinMax.o -c PC-IntegerMinMax.c
gcc-8 -DASN_PDU_COLLECTION -I. -o PC-RealMinMax.o -c PC-RealMinMax.c
gcc-8 -DASN_PDU_COLLECTION -I. -o BOOLEAN.o -c BOOLEAN.c
gcc-8 -DASN_PDU_COLLECTION -I. -o INTEGER.o -c INTEGER.c
gcc-8 -DASN_PDU_COLLECTION -I. -o NULL.o -c NULL.c
gcc-8 -DASN_PDU_COLLECTION -I. -o NativeEnumerated.o -c NativeEnumerated.c
gcc-8 -DASN_PDU_COLLECTION -I. -o NativeInteger.o -c NativeInteger.c
gcc-8 -DASN_PDU_COLLECTION -I. -o NativeReal.o -c NativeReal.c
gcc-8 -DASN_PDU_COLLECTION -I. -o REAL.o -c REAL.c
gcc-8 -DASN_PDU_COLLECTION -I. -o VisibleString.o -c VisibleString.c
gcc-8 -DASN_PDU_COLLECTION -I. -o asn_SEQUENCE_OF.o -c asn_SEQUENCE_OF.c
gcc-8 -DASN_PDU_COLLECTION -I. -o asn_SET_OF.o -c asn_SET_OF.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constr_CHOICE.o -c constr_CHOICE.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constr_SEQUENCE.o -c constr_SEQUENCE.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constr_SEQUENCE_OF.o -c constr_SEQUENCE_OF.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constr_SET_OF.o -c constr_SET_OF.c
gcc-8 -DASN_PDU_COLLECTION -I. -o OCTET_STRING.o -c OCTET_STRING.c
gcc-8 -DASN_PDU_COLLECTION -I. -o BIT_STRING.o -c BIT_STRING.c
gcc-8 -DASN_PDU_COLLECTION -I. -o asn_codecs_prim.o -c asn_codecs_prim.c
gcc-8 -DASN_PDU_COLLECTION -I. -o ber_tlv_length.o -c ber_tlv_length.c
gcc-8 -DASN_PDU_COLLECTION -I. -o ber_tlv_tag.o -c ber_tlv_tag.c
gcc-8 -DASN_PDU_COLLECTION -I. -o ber_decoder.o -c ber_decoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o der_encoder.o -c der_encoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constr_TYPE.o -c constr_TYPE.c
gcc-8 -DASN_PDU_COLLECTION -I. -o constraints.o -c constraints.c
gcc-8 -DASN_PDU_COLLECTION -I. -o xer_support.o -c xer_support.c
gcc-8 -DASN_PDU_COLLECTION -I. -o xer_decoder.o -c xer_decoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o xer_encoder.o -c xer_encoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o per_support.o -c per_support.c
gcc-8 -DASN_PDU_COLLECTION -I. -o per_decoder.o -c per_decoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o per_encoder.o -c per_encoder.c
gcc-8 -DASN_PDU_COLLECTION -I. -o per_opentype.o -c per_opentype.c
gcc-8 -DASN_PDU_COLLECTION -I. -o converter-sample.o -c converter-sample.c
gcc-8 -DASN_PDU_COLLECTION -I. -o pdu_collection.o -c pdu_collection.c
gcc-8 -DASN_PDU_COLLECTION -I. -o progname Date.o Date-std.o Dbtag.o Object-id.o Person-id.o Name-std.o Int-fuzz.o User-object.o User-field.o ArticleId.o PubMedId.o MedlineUID.o DOI.o PII.o PmcID.o PmcPid.o PmPid.o ArticleIdSet.o PubStatus.o PubStatusDate.o PubStatusDateSet.o Cit-art.o Cit-jour.o Cit-book.o Cit-proc.o Cit-pat.o Patent-priority.o Id-pat.o Cit-let.o Cit-sub.o Cit-gen.o Auth-list.o Author.o Affil.o Title.o Imprint.o CitRetract.o Meeting.o Medline-entry.o Medline-mesh.o Medline-qual.o Medline-rn.o Medline-si.o Medline-field.o DocRef.o Pub.o Pub-equiv.o Pub-set.o Org-ref.o OrgName.o OrgMod.o BinomialOrgName.o MultiOrgName.o PartialOrgName.o TaxElement.o BioSource.o SubSource.o PC-Substance.o PC-Substances.o PC-ID.o PC-Source.o PC-DBTracking.o PC-MMDBSource.o PC-XRefData.o PC-Compound.o PC-Compounds.o PC-CompoundType.o PC-Count.o PC-StereoGroup.o PC-InfoData.o PC-Urn.o PC-UrnDataType.o PC-Coordinates.o PC-Conformer.o PC-Conformers.o PC-CoordinateType.o PC-DrawAnnotations.o PC-BondAnnotation.o PC-Atoms.o PC-AtomSource.o PC-AtomInt.o PC-AtomString.o PC-AtomRadical.o PC-Element.o PC-Bonds.o PC-BondType.o PC-StereoCenter.o PC-StereoTetrahedral.o PC-StereoPlanar.o PC-StereoSquarePlanar.o PC-StereoOctahedral.o PC-StereoTrigonalBiPyramid.o PC-StereoTShape.o PC-StereoPentagonalBiPyramid.o PC-AssayContainer.o PC-AssaySubmit.o PC-AssayResults.o PC-AssayData.o PC-AssayDescription.o PC-AssayPanel.o PC-AssayPanelMember.o PC-CategorizedComment.o PC-AssayDRAttr.o PC-AssayTargetInfo.o PC-AnnotatedXRef.o PC-ResultType.o PC-AssayPanelTestResult.o PC-ConcentrationAttr.o PC-IntegerMinMax.o PC-RealMinMax.o BOOLEAN.o INTEGER.o NULL.o NativeEnumerated.o NativeInteger.o NativeReal.o REAL.o VisibleString.o asn_SEQUENCE_OF.o asn_SET_OF.o constr_CHOICE.o constr_SEQUENCE.o constr_SEQUENCE_OF.o constr_SET_OF.o OCTET_STRING.o BIT_STRING.o asn_codecs_prim.o ber_tlv_length.o ber_tlv_tag.o ber_decoder.o der_encoder.o constr_TYPE.o constraints.o xer_support.o xer_decoder.o xer_encoder.o per_support.o per_decoder.o per_encoder.o per_opentype.o converter-sample.o pdu_collection.o  
Undefined symbols for architecture x86_64:
  "_asn_DEF_PDU", referenced from:
      _pduType.4981 in converter-sample.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [progname] Error 1

It seems related to https://sourceforge.net/p/asn1c/discussion/357921/thread/545d91b0/ and http://lionet.info/asn1c/faq.html.

I tried to add a CC option to converter-sample.c by

gcc-8 -DASN_PDU_COLLECTION -I. -DPDU=BioSource -o converter-sample.o -c converter-sample.c

and link again

gcc-8 -DASN_PDU_COLLECTION -I. -o progname Date.o Date-std.o Dbtag.o Object-id.o Person-id.o Name-std.o Int-fuzz.o User-object.o User-field.o ArticleId.o PubMedId.o MedlineUID.o DOI.o PII.o PmcID.o PmcPid.o PmPid.o ArticleIdSet.o PubStatus.o PubStatusDate.o PubStatusDateSet.o Cit-art.o Cit-jour.o Cit-book.o Cit-proc.o Cit-pat.o Patent-priority.o Id-pat.o Cit-let.o Cit-sub.o Cit-gen.o Auth-list.o Author.o Affil.o Title.o Imprint.o CitRetract.o Meeting.o Medline-entry.o Medline-mesh.o Medline-qual.o Medline-rn.o Medline-si.o Medline-field.o DocRef.o Pub.o Pub-equiv.o Pub-set.o Org-ref.o OrgName.o OrgMod.o BinomialOrgName.o MultiOrgName.o PartialOrgName.o TaxElement.o BioSource.o SubSource.o PC-Substance.o PC-Substances.o PC-ID.o PC-Source.o PC-DBTracking.o PC-MMDBSource.o PC-XRefData.o PC-Compound.o PC-Compounds.o PC-CompoundType.o PC-Count.o PC-StereoGroup.o PC-InfoData.o PC-Urn.o PC-UrnDataType.o PC-Coordinates.o PC-Conformer.o PC-Conformers.o PC-CoordinateType.o PC-DrawAnnotations.o PC-BondAnnotation.o PC-Atoms.o PC-AtomSource.o PC-AtomInt.o PC-AtomString.o PC-AtomRadical.o PC-Element.o PC-Bonds.o PC-BondType.o PC-StereoCenter.o PC-StereoTetrahedral.o PC-StereoPlanar.o PC-StereoSquarePlanar.o PC-StereoOctahedral.o PC-StereoTrigonalBiPyramid.o PC-StereoTShape.o PC-StereoPentagonalBiPyramid.o PC-AssayContainer.o PC-AssaySubmit.o PC-AssayResults.o PC-AssayData.o PC-AssayDescription.o PC-AssayPanel.o PC-AssayPanelMember.o PC-CategorizedComment.o PC-AssayDRAttr.o PC-AssayTargetInfo.o PC-AnnotatedXRef.o PC-ResultType.o PC-AssayPanelTestResult.o PC-ConcentrationAttr.o PC-IntegerMinMax.o PC-RealMinMax.o BOOLEAN.o INTEGER.o NULL.o NativeEnumerated.o NativeInteger.o NativeReal.o REAL.o VisibleString.o asn_SEQUENCE_OF.o asn_SET_OF.o constr_CHOICE.o constr_SEQUENCE.o constr_SEQUENCE_OF.o constr_SET_OF.o OCTET_STRING.o BIT_STRING.o asn_codecs_prim.o ber_tlv_length.o ber_tlv_tag.o ber_decoder.o der_encoder.o constr_TYPE.o constraints.o xer_support.o xer_decoder.o xer_encoder.o per_support.o per_decoder.o per_encoder.o per_opentype.o converter-sample.o pdu_collection.o

This time no error happened, but not sure if it's the correct way. Also, what if I want to all PDU types, should I add -DPDU=<pduType> for all of them?

velichkov commented 6 years ago

Which asn1c version do you use?

I tried to add a CC option to converter-sample.c by

With the latest master branch (4cc779fd9bd7f556699b5863cf111b359da10b66) it works without additional options. See how the ASN_DEF_PDU is defined in converter-example.c

https://github.com/vlm/asn1c/blob/4cc779fd9bd7f556699b5863cf111b359da10b66/skeletons/converter-example.c#L25-L34

So when PDU is not defined the ASN_DEF_PDU is NULL and the linker should not complains.

Also, what if I want to all PDU types, should I add -DPDU= for all of them?

The -DPDU= specify the default PDU and it could be only one. When the -p options is not specified the default will be used. To specify the default PDU compile with

asn1c -fcompound-names -pdu=BioSource -pdu=all pubchem.new.asn

and later when you need a different PDU just specify it when invoking converter-example

./converter-example -p Pub-set  ....
luyoutao commented 6 years ago

Which asn1c version do you use?

asn1c version: 0.9.28 gcc version: 8.1.0

With the latest master branch (4cc779f) it works without additional options.

I will try out the latest version. Thanks again.