westes / flex

The Fast Lexical Analyzer - scanner generator for lexing in C and C++
Other
3.52k stars 529 forks source link

stage1scan.c: Segmentation fault (core dumped) #442

Closed noloader closed 4 years ago

noloader commented 4 years ago

Hi Everyone,

I'm working on NetBSD 8.1, x86_64, fully patched. I'm building flex-2.6.4.tar.gz from the release tarball.

Configure is OK, but I'm having trouble with stage1flex:

libtool: link: gcc -g2 -O2 -fPIC -pthread -Wl,-R -Wl,\$ORIGIN/../lib -Wl,-R -Wl,
/opt/local/lib -Wl,--enable-new-dtags -o stage1flex stage1flex-scan.o stage1flex
-buf.o stage1flex-ccl.o stage1flex-dfa.o stage1flex-ecs.o stage1flex-filter.o st
age1flex-gen.o stage1flex-main.o stage1flex-misc.o stage1flex-nfa.o stage1flex-o
ptions.o stage1flex-parse.o stage1flex-regex.o stage1flex-scanflags.o stage1flex
-scanopt.o stage1flex-skel.o stage1flex-sym.o stage1flex-tables.o stage1flex-tab
les_shared.o stage1flex-tblcmp.o stage1flex-yylex.o /opt/local/lib/libintl.so -W
l,-rpath -Wl,/opt/local/lib  -L/opt/local/lib -lm -lpthread -pthread
./stage1flex   -o stage1scan.c ./scan.l
gmake[2]: *** [Makefile:1696: stage1scan.c] Segmentation fault (core dumped)
gmake[2]: Leaving directory '/home/jwalton/Build-Scripts/flex-2.6.4/src'

All Flex dependencies are installed in /opt/local. Here are the configuration parameters for Flex:

   PREFIX: /opt/local
   LIBDIR: /opt/local/lib
    RPATH: '$$ORIGIN/../lib'
    BUILD: x86_64-unknown-netbsd8.1

PKG_CONFIG_PATH: /opt/local/lib/pkgconfig
       CPPFLAGS: -I/opt/local/include -DNDEBUG
         CFLAGS: -g2 -O2 -fPIC -pthread
       CXXFLAGS: -g2 -O2 -fPIC -pthread
        LDFLAGS: -L/opt/local/lib -Wl,-R,'$$ORIGIN/../lib' -Wl,-R,/opt/local/lib -Wl,--enable-new-dtags
         LDLIBS: -lpthread
moqingyan commented 4 years ago

Exact same issue here. :( Any idea on how to solve it?

My environment is: Ubuntu 18.04.3 LTS gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

Explorer09 commented 4 years ago

@noloader Please attach the full build log in order for us to see where the real error is.

@moqingyan Build error in Ubuntu 18.04 is known already. (#428 and #241 and PR #262) (already fixed in master). Workaround: ./configure CFLAGS='-g -O2 -D_GNU_SOURCE'

noloader commented 4 years ago

@Explorer09,

I hit this crash again today. Today it occurred on Ubuntu 18.04 x86_64, fully patched.

Please attach the full build log in order for us to see where the real error is.

Ack. Here is config.log.zip from the Ubuntu machine.

Here are the configuration parameters for all programs and libraries when I build them from sources.

 AUTOCONF_BUILD: x86_64-pc-linux-gnu
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig
       CPPFLAGS: -I/usr/local/include -DNDEBUG
         CFLAGS: -g2 -O2 -march=native -fPIC -pthread
       CXXFLAGS: -g2 -O2 -march=native -fPIC -pthread
        LDFLAGS: -L/usr/local/lib -Wl,-R,'$$ORIGIN/../lib' -Wl,-R,/usr/local/lib -Wl,--enable-new-dtags
         LDLIBS: -ldl -lpthread
Explorer09 commented 4 years ago

@noloader What exact crash do you see? It seems that this log is irrelevant to your original NetBSD report above.

noloader commented 4 years ago

Hi @Explorer09,

It seems that this log is irrelevant to your original NetBSD report above.

The NetBSD 8.1 virtual machine was deleted.

The config.log is for the [same] crash on Ubuntu 18.04 machine.

noloader commented 4 years ago

@Explorer09,

I see you provided a work around. I'll just use it.

Thanks for the help.

demhademha commented 3 years ago

This issue still persists on ubuntu 20.04, I've attached the relevant log:

libtool: link: rm -fr .libs/libfl.2.dylib .libs/libfl.a .libs/libfl.dylib .libs/libfl.la .libs/libfl.lai libtool: link: aarch64-apple-darwin-clang -dynamiclib -Wl,-flat_namespace -Wl,-undefined -Wl,suppress -o .libs/libfl.2.dylib .libs/libmain.o .libs/ libyywrap.o -L/home/ahmed/Downloads/Procursus/build_base/iphoneos-arm64/1600/usr/lib -L/home/ahmed/Downloads/Procursus/build_base/iphoneos-arm64/1 600/usr/local/lib -lm -O2 -arch arm64 -isysroot /home/ahmed/cctools/SDK/iPhoneOS13.2.sdk -miphoneos-version-min=13.0 -F/home/ahmed/Downloads/Procur sus/build_base/iphoneos-arm64/1600/System/Library/Frameworks -install_name /usr/lib/libfl.2.dylib -compatibility_version 3 -current_version 3.0 - Wl,-single_module make[3]: [Makefile:1696: stage1scan.c] Segmentation fault (core dumped) make[3]: Waiting for unfinished jobs....