Installing GDB broke LLDB, how do I fix LLDB? - lldb

On Ubuntu 18.04.1, I have been using lldb and llnode to debug node. I was curious to see if gdb would be any better, so I installed it. After that, lldb failed to load core files anymore.
This worked:
~$ lldb /usr/bin/node -c core
(lldb) target create "/usr/bin/node" --core "/home/ubuntu/core"
Core file '/home/ubuntu/core' (x86_64) was loaded.'
Then I installed gdb:
~$ sudo apt install gdb
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gdbserver libbabeltrace1 libc6-dbg libdw1
Suggested packages:
gdb-doc
The following NEW packages will be installed:
gdb gdbserver libbabeltrace1 libc6-dbg libdw1
0 upgraded, 5 newly installed, 0 to remove and 19 not upgraded.
Need to get 8737 kB of archives.
After this operation, 51.5 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libdw1 amd64 0.170-0.4 [203 kB]
Get:2 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libbabeltrace1 amd64 1.5.5-1 [154 kB]
Get:3 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 gdb amd64 8.1-0ubuntu3 [2937 kB]
Get:4 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 gdbserver amd64 8.1-0ubuntu3 [282 kB]
Get:5 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 libc6-dbg amd64 2.27-3ubuntu1 [5161 kB]
Fetched 8737 kB in 1s (10.8 MB/s)
Selecting previously unselected package libdw1:amd64.
(Reading database ... 125740 files and directories currently installed.)
Preparing to unpack .../libdw1_0.170-0.4_amd64.deb ...
Unpacking libdw1:amd64 (0.170-0.4) ...
Selecting previously unselected package libbabeltrace1:amd64.
Preparing to unpack .../libbabeltrace1_1.5.5-1_amd64.deb ...
Unpacking libbabeltrace1:amd64 (1.5.5-1) ...
Selecting previously unselected package gdb.
Preparing to unpack .../gdb_8.1-0ubuntu3_amd64.deb ...
Unpacking gdb (8.1-0ubuntu3) ...
Selecting previously unselected package gdbserver.
Preparing to unpack .../gdbserver_8.1-0ubuntu3_amd64.deb ...
Unpacking gdbserver (8.1-0ubuntu3) ...
Selecting previously unselected package libc6-dbg:amd64.
Preparing to unpack .../libc6-dbg_2.27-3ubuntu1_amd64.deb ...
Unpacking libc6-dbg:amd64 (2.27-3ubuntu1) ...
Setting up libc6-dbg:amd64 (2.27-3ubuntu1) ...
Setting up libdw1:amd64 (0.170-0.4) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up gdbserver (8.1-0ubuntu3) ...
Setting up libbabeltrace1:amd64 (1.5.5-1) ...
Setting up gdb (8.1-0ubuntu3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Now lldb cannot load the core file anymore:
~$ lldb /usr/bin/node -c core
(lldb) target create "/usr/bin/node" --core "core"
error: core failed to load objfile for /home/ubuntu/core
error: Unable to find process plug-in for core file '/home/ubuntu/core'
How do I fix this? I like lldb better for what I am doing right now and want it back. I tried purging gdb and its additional packages, and then purging and re-installing lldb, but that did not fix anything.

Turns out lldb is terrible at diagnosing and reporting problems with itself. The Unable to find process plug-in error was a direct consequence of the failed to load objfile error.
The failed to load objfile can be caused by anything. In some versions it can be caused by permissions making the core file unreadable. In my case of post hoc, ergo propter hoc, the gdb installation was a red herring. The actual cause of the problem was that other processes consumed enough memory that there was not enough free memory to load the core image. Freeing up memory on the machine by stopping the memory hog processes fixed the problem.

Related

Why can't I install libc6-dev

I want to compile a c file, but an error occurs after entering the compile command.
~$ gcc helloworld.c -o helloworld
fatal error: stdio.h: No such file or directory
compilation terminated.
I installed libc6-dev according to the method on the Internet
~$ sudo apt install libc6-dev
Then this error appeared
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libc6-dev : Depends: libc6 (= 2.23-0ubuntu11.3) but 2.31-0ubuntu9.2 is to be installed
Depends: libc-dev-bin (= 2.23-0ubuntu11.3)
E: Unable to correct problems, you have held broken packages.
So I followed the method
sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:5 http://archive.ubuntu.com/ubuntu xenial-security InRelease
Reading package lists... Done
sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
ubuntu-advantage-tools
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
sudo apt-get -u dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
ubuntu-advantage-tools
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
sudo dpkg --configure -a
sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
sudo apt-get install libc6-i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libc6-i386 : Depends: libc6 (= 2.23-0ubuntu11.3) but 2.31-0ubuntu9.2 is to be installed
E: Unable to correct problems, you have held broken packages.
What should I do
I have debian, but I think this solution can help you. This is the new line I added to my /etc/apt/sources.list
deb http://ftp.it.debian.org/debian bullseye-updates main contrib non-free

How to compile libvips with libjpeg-turbo8 instead of libjpeg

I would like to compile libvips with libjpeg-turbo8 to get a better performance, but I'm having trouble replacing it.
When both libjpeg and libjpeg-turbo8 are installed, the regular libjpeg seems to be used during compilation as the performance is quite bad. (I have another docker image where everything does compile properly where it is much faster.)
When I try to remove libjpeg, it will also remove libtiff.
So my question is: How can I compile libvips with libjpeg-turbo8, while keeping libraries that depend on libjpeg?
# apt remove libjpeg8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
libjpeg-dev libjpeg8 libjpeg8-dev libtiff-dev libtiff5 libtiff5-dev libtiffxx5
0 upgraded, 0 newly installed, 7 to remove and 113 not upgraded.
After this operation, 1664 kB disk space will be freed.
Do you want to continue? [Y/n]
Below a snippet of apt list that shows all installed jpeg libraries:
libjpeg-dev/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg-progs/bionic 1:9b-2 amd64
libjpeg-turbo-progs/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo-test/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo8/bionic-updates,bionic-security,now 1.5.2-0ubuntu5.18.04.3 amd64 [installed]
libjpeg-turbo8-dbg/bionic-updates,bionic-security 1.5.2-0ubuntu5.18.04.3 amd64
libjpeg-turbo8-dev/bionic-updates,bionic-security,now 1.5.2-0ubuntu5.18.04.3 amd64 [installed,automatic]
libjpeg62/bionic 1:6b2-3 amd64
libjpeg62-dev/bionic 1:6b2-3 amd64
libjpeg8/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg8-dbg/bionic 8c-2ubuntu8 amd64
libjpeg8-dev/bionic,now 8c-2ubuntu8 amd64 [installed,automatic]
libjpeg9/bionic 1:9b-2 amd64
libjpeg9-dbg/bionic 1:9b-2 amd64
libjpeg9-dev/bionic 1:9b-2 amd64
There's no need to rebuild anything -- the two libjpegs are binary compatible and you can simply remove one library binary and install the other.
apt knows how to do this. Just apt install libjpeg-turbo8 and it'll remove the slow libjpeg8, install the new turbo version, and off you go.

MIPS Cross Compilation on Travis

How would one setup a .travis.yml to do cross compilation for MIPS target ? For PowerPC, this is trivial:
addons:
apt:
packages:
- gcc-powerpc-linux-gnu
Since I have access to the package directly.
For MIPS I cannot find a compiler for it in Ubuntu Trusty:
Software Packages in "trusty", Subsection devel
Even though it appears to be whitelisted:
https://github.com/travis-ci/apt-package-whitelist/commit/5761eccc#diff-3583c6522a64da63a272436df8de85ceR1311
It seems I would need an updated Ubuntu image (not possible on Travis):
GNU C compiler for the mips architecture
The alternate solution would be to use some pre-build MIPS compiler, eg:
Sourcery CodeBench Lite 2013.11-36 for MIPS GNU/Linux
But documentation rather explicitely says not to cache those things:
Caching Dependencies and Directories#Things not to cache
Large files that are quick to install but slow to download do not
benefit from caching, as they take as long to download from the cache
as from the original source:
Android SDKs
Debian packages
JDK packages
Compiled binaries
Docker images
How would you install a mips cross compiler on the default Ubuntu Travis image ?
Update I tried a naive solution:
addons:
apt:
sources:
- debian-sid
packages:
- gcc-mips-linux-gnu
But this fails with:
dpkg-deb: error: archive '/var/cache/apt/archives/gcc-7-base_7.2.0-18_amd64.deb' has premature member 'control.tar.xz' before 'control.tar.gz', giving up
dpkg: error processing archive /var/cache/apt/archives/gcc-7-base_7.2.0-18_amd64.deb (--unpack):
subprocess dpkg-deb --control returned error exit status 2
It seems dpkg in Ubuntu/Trusty will not support those deb files:
xz compressed control.tar files not supported
It seems I cannot use container based because of this requirement, I gave up and simply used:
sudo: true
dist: trusty
addons:
apt:
packages:
- u-boot-tools
before_install:
- sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
- sudo apt-get -qq update
- sudo apt-get install -qq gcc-mips-linux-gnu
I am still intrigued by the fact that gcc-mips-linux-gnu is explicitly white-listed.

gdb shared libraries no debugging information

i try to debug a program for find to floating point exception location on beaglebone black debian i installed libc6 and libc6-dbg but still
From To Syms Read Shared Object Library
0xb6fda7c0 0xb6ff32b0 Yes (*) /lib/ld-linux.so.3
0xb6f24200 0xb6f8af00 Yes (*) /lib/arm-linux-gnueabi/libm.so.6
0xb6f06668 0xb6f17e74 Yes (*) /lib/arm-linux-gnueabi/libgcc_s.so.1
0xb6dd44a0 0xb6eca348 Yes (*) /lib/arm-linux-gnueabi/libc.so.6
(*): Shared library is missing debugging information.
seems like this.
and my debug directory is:
The directory where separate debug symbols are searched for is "/usr/lib/debug"
floating point exception appear like this
Program received signal SIGFPE, Arithmetic exception.
0xb6de9a98 in raise () from /lib/arm-linux-gnueabi/libc.so.6
You appear to be using GDB with remote debugging, possibly on an x86 host.
i installed libc6 and libc6-dbg
You need to install libc6-dbg for the arm (matching your arm target libc build). Installing libc6-dbg for host does you no good.

/lib/libc.so.6: version `GLIBC_2.17' not found

I am trying to compile a program to put on a BeagleBone black, but im getting this error
when running the program on my board:
/lib/libc.so.6: version `GLIBC_2.17' not found
I made sure that i cross compiled for ARM (arm-linux-gnueabi-gcc).
On my desktop, I have EGLIBC 2.17-9.
What did i do wrong?
Had face the same problem.
Solved it by the following steps.
Downloaded "libc6_2.17-0ubuntu5.1_i386.deb"
sudo dpkg -i ipts libc6_2.17-0ubuntu5.1_i386.deb
sudo dpkg -i ipts libc6_2.17-0ubuntu5.1_i386.deb
Download 64 bit package from this site https://launchpad.net/ubuntu/raring/amd64/libc6/2.17-0ubuntu4
Install libc6 2.17 by the command ,
sudo dpkg -i libc6_2.17-0ubuntu4_amd64.deb
Cheers !
You don't have glibc 2.17 installed on your target board. You need to ensure that you have the SAME version of glibc (for ARM) installed on both the target board and on your build machine (your desktop). You can do this by either installing 2.17 on the target board or by figuring out what version you have installed there and installing that same version on your build machine (and linking with it).
This shell script worked for me: https://groups.google.com/forum/#!category-topic/beagleboard/oPq-Xt0TVdY
see the response from "A P" which is a script that installs a later version on the beaglebone black:
I am running a beaglebone black rev C with debian wheezy.
#!/bin/sh
echo "deb http://ftp.debian.org/debian sid main" >> /etc/apt/sources.list
apt-get update
apt-get -t sid install libc6 libc6-dev libc6-dbg
echo "Please remember to hash out sid main from your sources list. /etc/apt/sources.list"

Resources