mouse07410 / asn1c

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

Problem compiling. #165

Closed JSKim-Ranix closed 7 months ago

JSKim-Ranix commented 7 months ago

I get an error when compiling. Could you please tell me what I am doing wrong? I think there might be another reason other than modifying #define with the same name.

make  all-recursive
make[1]: 디렉터리 '/media/jskim/ext4/work/asn1c' 들어감
Making all in libasn1common
make[2]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1common' 들어감
  CC       asn1_ref.lo
  CC       asn1_buffer.lo
  CC       asn1_namespace.lo
  CC       genhash.lo
  CCLD     libasn1common.la
make[2]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1common' 나감
Making all in libasn1parser
make[2]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1parser' 들어감
make  all-am
make[3]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1parser' 들어감
  CC       asn1parser.lo
  CC       asn1p_y.lo
asn1p_y.y: In function ‘asn1p_parse’:
asn1p_y.c:309:16: error: expected identifier before numeric constant
  309 | #define number 268
      |                ^~~
asn1p_y.y:508:33: note: in expansion of macro ‘number’
  508 |                 $$.number = -1;
      |                                 ^     
asn1p_y.c:309:16: error: expected identifier before numeric constant
  309 | #define number 268
      |                ^~~
asn1p_y.y:512:33: note: in expansion of macro ‘number’
  512 |                 $$.number = $3;
      |                                 ^     
asn1p_y.c:309:16: error: expected identifier before numeric constant
  309 | #define number 268
      |                ^~~
asn1p_y.y:516:33: note: in expansion of macro ‘number’
  516 |                 $$.number = $1;
      |                                 ^     
asn1p_y.c:307:20: error: expected identifier before numeric constant
  307 | #define identifier 266
      |                    ^~~
asn1p_y.y:729:33: note: in expansion of macro ‘identifier’
  729 |                 $$->identifier = $4;
      |                                 ^~~~      
asn1p_y.c:307:20: error: expected identifier before numeric constant
  307 | #define identifier 266
      |                    ^~~
asn1p_y.y:732:45: note: in expansion of macro ‘identifier’
  732 |                 saved_aid = $$->identifier.oid ? 0 : &($$->identifier);
      |                                             ^~~~~~~~~~
At top level:
asn1p_y.y:23:1: warning: ‘prefixed_fprintf’ defined but not used [-Wunused-function]
   23 | prefixed_fprintf(FILE *f, const char *fmt, ...) {
      | ^~~~~~~~~~~~~~~~
make[3]: *** [Makefile:695: asn1p_y.lo] 오류 1
make[3]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1parser' 나감
make[2]: *** [Makefile:590: all] 오류 2
make[2]: 디렉터리 '/media/jskim/ext4/work/asn1c/libasn1parser' 나감
make[1]: *** [Makefile:494: all-recursive] 오류 1
make[1]: 디렉터리 '/media/jskim/ext4/work/asn1c' 나감
make: *** [Makefile:405: all] 오류 2
mouse07410 commented 7 months ago

I've no idea what you've done, or what your environment is. In normal circumstances the errors like you showed do not occur. So, without me details I can't help you.

JSKim-Ranix commented 7 months ago

I've no idea what you've done, or what your environment is. In normal circumstances the errors like you showed do not occur. So, without me details I can't help you.

I build in Ubuntu 22.04.3 LTS environment. Also, I see a message asking me to install Flex during the build, and I am not sure which files should be copied where after building Flex.

mouse07410 commented 7 months ago

I've no idea what you're building, with what tools, or how. I'm sorry, but I don't have time to dig through it. This repo builds fine on Linux and MacOS - I've tested that myself. Others successfully built on Windows.

So...

  1. Make sure your have a working C toolchain installed, including autotools, autoconf, autogen, automake.
  2. Make sure Flex and Yacc are installed.
  3. Clone this repo, and cd asn1c.
  4. Do the following:
$ autoreconf -fi
$ ./configure
$ make all
$ make check && sudo make install
JSKim-Ranix commented 7 months ago

I've no idea what you're building, with what tools, or how. I'm sorry, but I don't have time to dig through it. This repo builds fine on Linux and MacOS - I've tested that myself. Others successfully built on Windows.

So...

  1. Make sure your have a working C toolchain installed, including autotools, autoconf, autogen, automake.
  2. Make sure Flex and Yacc are installed.
  3. Clone this repo, and cd asn1c.
  4. Do the following:
$ autoreconf -fi
$ ./configure
$ make all
$ make check && sudo make install

When I followed your advice, the error occurred in the "vlm_master" branch, but the error did not occur in the "master" branch. Thank you for your help.