adrian-thurston / colm

The Colm Programming Language
MIT License
164 stars 31 forks source link

Error executing on CentOS 7.6 #122

Closed bzhaoopenstack closed 3 years ago

bzhaoopenstack commented 4 years ago

ENV

ARCH: x86 and aarch64

centos 7.6

uname -a Linux test-hyperscan 4.18.0-80.7.2.el7.aarch64 #1 SMP Thu Sep 12 16:13:20 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

gcc --version gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Repo

a.out -- a simple c execuatable file test_empty.txt -- empty file

yum update -y yum install libtool gcc g++ autoconf automake -y yum install asciidoc fig2dev -y

git clone https://github.com/adrian-thurston/colm cd colm/ git branch ---- master branch ./autogen.sh ./configure make make install which colm /usr/local/bin/colm

/usr/local/bin/colm -m a.out test_empty.txt /tmp/ccKv7d9j.o:(.data+0xc48): undefined reference to colm_object_commit_reduce_forward' /tmp/ccKv7d9j.o:(.data+0xc50): undefined reference tocolm_object_commit_union_sz' /tmp/ccKv7d9j.o:(.data+0xc58): undefined reference to colm_object_init_need' /tmp/ccKv7d9j.o:(.data+0xc60): undefined reference tocolm_object_reducer_need_tok' /tmp/ccKv7d9j.o:(.data+0xc68): undefined reference to colm_object_reducer_need_ign' /tmp/ccKv7d9j.o:(.data+0xc70): undefined reference tocolm_object_read_reduce' collect2: error: ld returned 1 exit status error: colm: there was a problem compiling the output

Team, I tried on tags 0.13.0.4 0.13.0.5 0.13.0.6 0.14.1 tags and master branch.. All hit the same issue. Any idea about how to fix it? Thanks

bzhaoopenstack commented 4 years ago

@adrian-thurston Hi, could you guys please take a look? Thanks

adrian-thurston commented 3 years ago

Hi @bzhaoopenstack, I'll make a VM to investigate this. Shoot me a message if you have one already I can use.

adrian-thurston commented 3 years ago

Can't seem to find 7.6. I'll try with 7.8

adrian-thurston commented 3 years ago

Just realized I don't need centos for this. I had thought it was related to problems with the linking command. But I see now you're using -m a.out. Do you mean to pass -o a.out?

The -m arg is for generating C++ code that later gets linked into the target. Doing this requires writing some boilerplate yourself and preventing colm from compiling and linking the generated code. Normally I use -m with -c to say "please just compile the Colm code, I can compile and link the C code myself."

bzhaoopenstack commented 3 years ago

@adrian-thurston Thank you very much. I can repro on the Ubuntu 1804 too, for centos is just an example for this issue. ;-), sorry for making you inconvinent. a.out is a 'helloworld' sample exec file which compile by gcc.

So you suggest that we should use -m with -c in most cases, right?

bzhaoopenstack commented 3 years ago

And yes, I use -m with -c. It looks good from my side.

hushiyuan commented 3 years ago

And yes, I use -m with -c. It looks good from my side.

without -m, generating c code,compile and link sucessfull,the result is: image

with -m generating for c++ code can not be link

image

with -m and -c,and than compile and link also occur the same error

adrian-thurston commented 3 years ago

You'll also have to use -p to generate the parser state tables and other boilerplate. Have a look at one of the src/host-* directories in the ragel repository. They link in two colm parsers into the same executable, rlparse and rlhc*. The rlparse parsers have reduction code associated with them. The rlhc parsers don't, just pure colm transform.

adrian-thurston commented 3 years ago

Closing as this appears to be wrong usage of arguments.