Announcement

Collapse
No announcement yet.

Strange gcc 6.2.0 output problem

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strange gcc 6.2.0 output problem

    Hi, I’m new here so please excuse me if I’ve posted in the wrong section.
    I have recently updated from Kubuntu 16.04 to Kubuntu 16.10 which comes with gcc 6.2.0.
    If I try to launch an application compiled with gcc 6.2.0 from Dolphin (or Krusader) it doesn’t work.

    Instead I get the “Choose application” window. By right-clicking on the file, file properties, file type options, it looks like the file is seen as a shared lib (although it isn’t, it’s an executable). If launched from the console, app works as expected.
    The problem doesn’t appear if the application is complied with clang.
    I’ve added a few screenshots to illustrate the problem.
    [IMG][/IMG]
    [IMG][/IMG]
    [IMG][/IMG]

    #2
    Is the file you are trying to run set as executable ?

    Comment


      #3
      Yes, it is.
      gcc -o hwc hwc.c does not work.
      clang -o hwc hwc.c works.
      Executables compiled with older versions of gcc also work.

      Comment


        #4
        What happens if you try and run it in a terminal?

        (I'm still on Xenial but have gcc 6.2.0 from the ubuntu-toolchain-r/test ppa, and have no trouble.)
        Regards, John Little

        Comment


          #5
          As I said in my original post, launching it from the terminal works as expected.

          Comment


            #6
            Strange. If I compress with UPX an executable compiled with gcc 6.2.0, I get a segmentation fault. This does not happen to executables compiled with clang or older versions of gcc.
            UPX 3.91

            Comment


              #7
              Originally posted by Nokturnis View Post
              As I said in my original post, launching it from the terminal works as expected.
              Sorry, I missed that.

              Dolphin sees my 6.2 binaries as "application/x-executable", but yours are showing as "application/x-sharedlib". This is appropriate for .so files (I presume, because on my system they do.) What does the file command say? I expect it will say
              Code:
              hwc: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=[i]whatever in hex[/i], not stripped
              I wonder if you have an alias, environment variable, or rc file influencing gcc. If I add -fPIC -shared to the gcc command, I get an application/sharelib, but the executable crashes instantly. There are also "specs" files, but if you wouldn't have changed something there without understanding it.
              Regards, John Little

              Comment


                #8
                file command for exe compiled with gcc:
                Code:
                hwc: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=hex number, not stripped
                compiled with clang:
                Code:
                hwc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, not stripped
                I have not touched the "specs" files and the env command doesn't show any strange environment variable.
                Could something have happened during the update from 16.04 to 16.10?

                Comment


                  #9
                  Problem still exists. I did a "gcc -dumpspecs" but I don't know where or what to look.
                  dumpedspecs.txt.zip

                  Comment


                    #10
                    Try building with the "-no-pie" option for gcc.
                    https://wiki.ubuntu.com/SecurityTeam/PIE

                    Comment


                      #11
                      YES!!! Now it works! Thank you!
                      Any idea how to make this default?

                      Comment

                      Working...
                      X