crash icon indicating copy to clipboard operation
crash copied to clipboard

cannot compile under ubuntu14.04

Open journey-wang opened this issue 7 years ago • 6 comments

p -lz -lm -llzma ../libiberty/libiberty.a build-gnulib/import/libgnu.a -ldl -Wl,--dynamic-list=./proc-service.list -lz -ldl -rdynamic c-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/c-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here cp-name-parser.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/cp-name-parser.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here ada-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/ada-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here f-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/f-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here p-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/p-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here go-exp.o: In function parse_string_or_char': /root/crash-7.1.9/gdb-7.6/gdb/go-exp.y:943: undefined reference to c_parse_escape' macroexp.o: In function get_character_constant': /root/crash-7.1.9/gdb-7.6/gdb/macroexp.c:364: undefined reference to c_parse_escape' macroexp.o: In function `get_string_literal':

journey-wang avatar Jul 27 '17 10:07 journey-wang

----- Original Message -----

p -lz -lm -llzma ../libiberty/libiberty.a build-gnulib/import/libgnu.a -ldl -Wl,--dynamic-list=./proc-service.list -lz -ldl -rdynamic c-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/c-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here cp-name-parser.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/cp-name-parser.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here ada-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/ada-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here f-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/f-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here p-exp.o: In function main': /root/crash-7.1.9/gdb-7.6/gdb/p-exp.c:1: multiple definition of main' ../../crashlib.a(main.o):/root/crash-7.1.9/main.c:81: first defined here go-exp.o: In function parse_string_or_char': /root/crash-7.1.9/gdb-7.6/gdb/go-exp.y:943: undefined reference to c_parse_escape' macroexp.o: In function get_character_constant': /root/crash-7.1.9/gdb-7.6/gdb/macroexp.c:364: undefined reference to c_parse_escape' macroexp.o: In function `get_string_literal':

My best guess is that your host build machine does not have /usr/bin/bison or /usr/bin/yacc installed. This blurb is from the crash-7.0.2 entry in http://people.redhat.com/anderson/crash.changelog.html:

7.0.2 - Added "bison" to the BuildRequires line of the crash.spec file. Without the patch, the build of the embedded gdb-7.6 module will fail unless either /usr/bin/bison or /usr/bin/yacc are available. The failure will result in a stream of error messages from different files that indicate:

         multiple definition of 'main'
         undefined reference to 'c_parse_escape'
         undefined reference to 'ada_parse'
         undefined reference to 'ada_error'
         undefined reference to 'c_parse'
         undefined reference to 'c_error'
         undefined reference to 'cp_demangled_name_to_comp'
         undefined reference to 'cp_demangled_name_parse_free'
         undefined reference to 'cp_comp_to_string'
         undefined reference to 'cp_new_demangle_parse_info'

       and the build fails like so:

         collect2: ld returned 1 exit status
         make[4]: *** [gdb] Error 1
         crash build failed

       If building with rpmbuild, the new BuildRequires "bison" entry will
       prevent the build from initiating unless the bison package has been
       installed.  If building with the tar.gz file, the build attempt will
       proceed and fail unless either the bison or byacc (Berkeley Yacc)
       package is installed.
       ([email protected])

Dave

crash-utility avatar Aug 07 '17 15:08 crash-utility

The build failure still exists. I am using Ubuntu 16.04 LTS, kernel version 4.10. I have tried installing bison and yacc but that did not help.

giridhaa avatar Oct 31 '17 11:10 giridhaa

Sorry, then I have no other suggestions. As far as I know, Ubuntu packages the crash utility with 16.04, and there have been no reports of Ubuntu-specific build failures on the crash-utility mailing list.

crash-utility avatar Oct 31 '17 13:10 crash-utility

Hello, I met the exact issue when building Crash 7.2.0 on Ubuntu 17.10. After I run sudo apt install bison, the issue is gone. It would be helpful to check the existance of bison before reaching the compiling error.

@giridhaa, you build failed after you've installed bison, that might because you were not making a clean build. If you've cleaned your workspace, the issue might have been gone.

rickywxg avatar Dec 22 '17 03:12 rickywxg

I have installed bison. Then I have cleaned the workspace (I have even tried to create another fresh workspace after installing bison). Still I get the same error. If it is working for you, then I have some platform issue. I will figure it out.

giridhaa avatar Dec 22 '17 06:12 giridhaa

Got the same errors when building crash 7.3.0 on Ubuntu 20.04, target=ARM, without bison. Then I found this thread, installed bison but simple make clean does not help. Then I removed the whole directory and clone the repository again and got succesful build.

I agree with rickywxg -- it would be very helpful to check the existence of bison at configure stage.

ReAlUA avatar Jul 15 '21 08:07 ReAlUA