[Bug 20400] New: ubuntu 12.04 x86_64 failing to find architecture for native binaries

Bug ID 20400
Summary ubuntu 12.04 x86_64 failing to find architecture for native binaries
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter tfiala@google.com
Classification Unclassified

Reported by Keno Fischer.

See thread here:
[http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-July/004578.html](http://lists.cs.uiuc.edu/pipermail/lldb-dev/2014-July/004578.html)

Todd Fiala changed bug 20400

What | Removed | Added |

  • | - | - |
    Status | NEW | ASSIGNED |
    Assignee | lldb-dev@cs.uiuc.edu | tfiala@google.com |

Comment # 1 on bug 20400 from Todd Fiala

I'm looking into this now.  Setting up an Ubuntu 12.04 VM.

Todd Fiala changed bug 20400

What | Removed | Added |

  • | - | - |
    CC | | lldb-dev@cs.uiuc.edu |

Comment # 2 on bug 20400 from Todd Fiala

I just set up a clean Ubuntu 12.04 x86_64 vm.

I have not been able to reproduce this.

Steps:
1. Install Ubuntu 12.04 x86_64 VM.

2. Install these packages:
sudo apt-get install build-essential gcc-multilib git libedit-dev ncurses-dev
libmpc-dev libmpfr-dev python-dev swig

3. Install gcc 4.9.1 source, build and install locally.

4. Do a git clone on the latest ninja source, build and install on path
somewhere.

5. Grab the latest cmake 3.0.0 source, build and install locally.

6. Make sure ninja, cmake, and gcc/g++ 4.9.1 show up on path.  gcc/g++ must
come on path before system gcc.

7. Grab latest llvm/clang/lldb code.  I'm synched to this revision on all 3:
r213671

8. create a directory alongside llvm for building:
mkdir build
cd build

9. configure with cmake
cmake -GNinja -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc
-DCMAKE_BUILD_TYPE=Debug ../llvm

10. Build
time ninja

11. Run the reported failure case
tfiala@ubuntu:~/lldb/git/build$ bin/lldb /bin/ls
Current executable set to '/bin/ls' (x86_64).
(lldb) run
Process 2282 launching
Process 2282 launched: '/bin/ls' (x86_64)
Process 2282 stopped
* thread #1: tid = 2282, 0x00007f0f0cea26b0, name = 'ls', stop reason = trace
    frame #0: 0x00007f0f0cea26b0
error: No such process
bin             cmake_install.cmake      examples         rules.ninja  utils
build.ninja     CPackConfig.cmake        include          share
cmake           CPackSourceConfig.cmake  lib              test
CMakeCache.txt  docs                     LLVMBuild.cmake  tools
CMakeFiles      DummyConfigureOutput     projects         unittests
Process 2282 exited with status = 0 (0x00000000) 
(lldb) 

Keno - can you have a look and see if you might be doing something different? 
Also, can you try to use the steps above and see if that unblocks you?

Thanks!  I'm not able to repro this from the info you've given me.  I'll leave
this open until I hear back that you are able to repeat this fix.

-Todd

Todd Fiala changed bug 20400

What | Removed | Added |

Comment # 7 on bug 20400 from Todd Fiala

I'm taking myself off the bug.  The scope of the issue appears to be:
lldb doesn't create a functional lldb build with this clang version (or any
that I know of) on Ubuntu 12.04.

The workarounds that I see are:

* Use gcc 4.8+ to build.  I've used 4.8.1, 4.8.2 and 4.9.1 successfully on
Ubuntu 12.04 x86_64.

* Use a newer Ubuntu.  I've used Ubuntu 13.10 x86_64 and 14.04 x86_64
successfully with gcc and with clang to build lldb.

* Debug clang on Ubuntu 12.04 x86_64 and figure out what is going wrong with
lldb in that scenario.

* Maybe try to bring in a newer clang that maybe fixes the issue.

Vince Harron changed bug 20400

Chaoren Lin changed bug 20400

What | Removed | Added |

  • | - | - |
    Status | NEW | RESOLVED |
    Resolution | — | FIXED |

Comment # 13 on bug 20400 from Chaoren Lin

Configuring cmake with LLVM_DEFAULT_TARGET_TRIPLE=i386-linux-gnu seems to fix
this issue on 32 bit builds. The default of i686-pc-linux-gnu is compatible but
not necessarily identical to the inferior binaries, so I think it's better to
apply Azat's solution of using ArchSpec::IsCompatibleMatch() instead to prevent
this issue from resurfacing on other platforms in the future.

Sylvestre Ledru changed bug 20400

What | Removed | Added |

  • | - | - |
    Status | RESOLVED | REOPENED |
    Resolution | FIXED | — |

Comment # 14 on bug 20400 from Sylvestre Ledru

I don't think the bug can be closed now.
This should be managed by the cmake and the autotools.

For now, building lldb on a recent ubuntu will fail and it is quite hard to
debug.
Moreover, the bug is also affecting 64 bit linux.

How is a fix for 32 bit builds only a solution for this issue?

It’s not. That’s why I said “I think it’s better to apply Azat’s solution of using ArchSpec::IsCompatibleMatch() instead to prevent this issue from resurfacing on other platforms in the future.”

Feel free to add yourself as a reviewer here: http://reviews.llvm.org/D7897

> How is a fix for 32 bit builds only a solution for this issue?

It's not. That's why I said "I think it's better to apply Azat's solution
of using ArchSpec::IsCompatibleMatch() instead to prevent this issue from
resurfacing on other platforms in the future."

Feel free to add yourself as a reviewer here: ⚙ D7897 Fix Bug 20400

I'm fine with this patch, and indeed it must fix not only 32bit builds.

Cheers,
Azat.

Chaoren Lin changed bug 20400