Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: undefined reference to `usbmuxd_save_pair_record_with_device_id' #709

Open
tkreuder opened this issue Oct 3, 2018 · 27 comments
Open

Comments

@tkreuder
Copy link

tkreuder commented Oct 3, 2018

Hi,
I used this script: http://pastebin.com/6u0TEhjz to install the latest versions and running ./autogen.sh --enable-debug-code results in:

../src/.libs/libimobiledevice.so: undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status
Makefile:653: recipe for target 'idevice_id' failed

i did a grep on usbmuxd_save_pair_record_with_device_id, which results in:

/usr/local/include $ grep -irn "usbmuxd_save_pair_record_with_device_id" .
./usbmuxd.h:221:int usbmuxd_save_pair_record_with_device_id(const char* record_id, uint32_t device_id, const char *record_data, uint32_t record_size);
@tkreuder
Copy link
Author

tkreuder commented Oct 3, 2018

Solution:

  1. $ sudo vim /etc/ld.so.conf
    #file content:
    /usr/local/lib
  2. sudo ldconfig
  3. make && sudo make install

@dnsBlah
Copy link

dnsBlah commented Oct 5, 2018

I get the same when building on OSX 10.14 Mojave

@beret
Copy link

beret commented Oct 5, 2018

I had this same issue with the latest builds. Once I rolled back to fb71aee I was able to compile without issue.

Unfortunately the workaround you mentioned didn't work for me. My (updated from git) usbmuxd headers are in /usr/include. I applied that and /usr/local/lib, with no change in the issue.

Arch x64, linux-lts 4.14.69, gcc 8.2.1

Configuration for libimobiledevice 1.2.1:
  Install prefix: .........: /usr
  Debug code ..............: no
  Python bindings .........: no
  SSL support backend .....: OpenSSL
Making all in tools
make[2]: Entering directory '/home/user/build/libimobiledevice-git/src/libimobiledevice/tools'
  CCLD     idevice_id
  CCLD     ideviceinfo
  CCLD     idevicename
  CCLD     idevicepair
/usr/bin/ld: ../src/.libs/libimobiledevice.so: undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:697: idevicename] Error 1
make[2]: *** Waiting for unfinished jobs....
/usr/bin/ld: ../common/.libs/libinternalcommon.a(userpref.o): in function `userpref_save_pair_record':
userpref.c:(.text+0x37f): undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status
/usr/bin/ld: ../src/.libs/libimobiledevice.so: undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:705: idevicepair] Error 1
make[2]: *** [Makefile:653: idevice_id] Error 1
/usr/bin/ld: ../src/.libs/libimobiledevice.so: undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:693: ideviceinfo] Error 1
make[2]: Leaving directory '/home/user/build/libimobiledevice-git/src/libimobiledevice/tools'
make[1]: *** [Makefile:455: all-recursive] Error 1
make[1]: Leaving directory '/home/user/build/libimobiledevice-git/src/libimobiledevice'
make: *** [Makefile:385: all] Error 2

@b-m-f
Copy link

b-m-f commented Nov 4, 2018

Try removing the package that is provided by the distro of libusbmuxd. Then compiling from https://github.com/libimobiledevice/libusbmuxd and using the solution from @mcplectrum should work.

@ethanas
Copy link

ethanas commented Nov 26, 2018

I get the same when building on raspberry pi 3B+(Raspbian GNU/Linux 9.1 (stretch))

@ethanas
Copy link

ethanas commented Nov 27, 2018

I also rolled back to fb71aee ,that is ok

@tinwasp
Copy link

tinwasp commented Dec 12, 2018

In case this is of any help: I have a similar problem here on Arch (though only on one of my systems in spite of similar configurations). I kept getting systemd errors, saying "Failed to start Daemon for power management", that slowed the entire machine to a crawl, making it impossible to work with. I then checked the upower.service status which gave me an error, saying "/usr/lib/upowerd: symbol lookup error: /usr/lib/libimobiledevice.so.6: undefined symbol: usbmuxd_save_pair_record_with_device_id".
After finding this bug report I downgraded from libimobiledevice-1.2.0+87+g92c5462-1-x86_64 to libimobiledevice-1.2.0+66+g5a85432-2-x86_64, which fixed the issue for now.

@cayenne3
Copy link

cayenne3 commented Dec 28, 2018

Same here. Raspberry Pi 3B+ running Rasbian (stretch). @mcplectrum 's workaround did not work for me either but rolling back to fb71aee worked.

Edit: I take it back. I just did a clean install and it worked. I had some of the libraries and usbmuxd that were installed from a previous apt-get install lying around. Removing those and recompiling usbmuxd worked.

Edit 2: A year later I had to recompile it and I got the same error on a clean install. This time @mcplectrum 's workaround did work for me. Thanks @mcplectrum !!!

@jbycdmys
Copy link

Thanks tinwasp! After updating Arch to 4.20.0, I had multiple issues with xfce, including upower failing to start. Downgrading libimobiledevice solved my issues. Thanks

@rajpancha1
Copy link

Hi All:

I am new to the libimobiledevice forum.

Like Ethanas, I am also trying to install libimobiledevice suite on Raspberry PI 3B+ (Stretch Lite with openbox). Linux SSbase 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux.

I am also getting the same error:

CC idevice_id-idevice_id.o
CCLD idevice_id
../src/.libs/libimobiledevice.so: undefined reference to `usbmuxd_save_pair_record_with_device_id'
collect2: error: ld returned 1 exit status

I am following steps from: raspbian-install.sh on https://gist.github.com/kfatehi/8922430#file-raspbian-install-sh-L13.

Can someone please guide me through to resolve the issue?
Should I use the branch https://github.com/libimobiledevice/libimobiledevice/tree/1.1.7 for all the related packages?

I greatly appreciate your help.

Thanks

@nikias
Copy link
Member

nikias commented Jan 18, 2019

You seem to have an older libusbmuxd package installed. Make sure to remove that.

@rajpancha1
Copy link

I tried to remove sudo apt-get remove libusbmuxd libimobiledevice
and got
Unable to locate package for both.
This is the first time I am installing these packages on Raspbian Stretch Lite.

@nikias
Copy link
Member

nikias commented Jan 18, 2019

In that case you somehow managed to install an older version of libusbmuxd.

@rajpancha1
Copy link

So how do I install the right one?

I just followed the raspbian-install.sh script on
https://gist.github.com/kfatehi/8922430#file-raspbian-install-sh-L13.

Appreciate your prompt reply. I need to install the suite so that when a user connects the iOS device on the RPI3 B+, it gets notified with information about the hosted iOS device, at least for now.

@TitanFighter
Copy link

TitanFighter commented Jan 18, 2019

IGNORE THIS MESSAGE. Check @nikias message below.

Just for those who does not know what does it mean:

I had this same issue with the latest builds. Once I rolled back to fb71aee I was able to compile without issue.

$ git clone https://github.com/libimobiledevice/libimobiledevice.git
$ cd libimobiledevice
$ git reset --hard fb71aeef10488ed7b0e60a1c8a553193301428c0

@nikias
Copy link
Member

nikias commented Jan 18, 2019

@TitanFighter that is not the right approach. The symbol it can't find was added to libusbmuxd on September 15 with commit libimobiledevice/libusbmuxd@07a493a and libimobiledevice was updated to use that on September 29 with commit f1ee0fd.
I am using latest git head and it works fine.

@nikias
Copy link
Member

nikias commented Jan 18, 2019

I just installed it on my raspberry pi 3 with the following commands:

mkdir limd
cd limd
sudo apt-get install git build-essential libtool autoconf automake libusb-1.0-0-dev libssl-dev
git clone https://github.com/libimobiledevice/libplist.git
git clone https://github.com/libimobiledevice/libusbmuxd.git
git clone https://github.com/libimobiledevice/libimobiledevice.git
git clone https://github.com/libimobiledevice/usbmuxd.git
cd libplist
./autogen.sh
make && sudo make install
cd ..
cd libusbmuxd
./autogen.sh
make && sudo make install
cd ..
cd libimobiledevice
./autogen.sh --enable-debug-code
make && sudo make install
cd ..
cd usbmuxd
./autogen.sh
make && sudo make install

# one-time setup only:
sudo groupadd -r usbmux
sudo useradd -r -c 'USBMux user' -g usbmux -d /nonexistant -s /sbin/nologin usbmux
sudo ldconfig
sudo /etc/init.d/udev restart

Plugged in device, trusted computer, then:

$ idevice_id -l
4918**********************
$ ideviceinfo -k ProductVersion
12.1.2

All working. I don't see what is going wrong there.

@nikias
Copy link
Member

nikias commented Jan 18, 2019

@rajpancha1 check if you have any other libusbmuxd leftovers:

$ find /usr -name "libusbmuxd*"
/usr/local/lib/libusbmuxd.so
/usr/local/lib/libusbmuxd.so.4
/usr/local/lib/libusbmuxd.a
/usr/local/lib/pkgconfig/libusbmuxd.pc
/usr/local/lib/libusbmuxd.so.4.1.0
/usr/local/lib/libusbmuxd.la

That is my output. Just one library there.

@rajpancha1
Copy link

Thank you TitanFighter and Nikias.

Following TitanFighter's suggestion I rebuilt the libimobiledevice.

Then following Nikias suggestion, here's the output:
$ ls -ltra find /usr -name "libusbmuxd*"
-rw-r--r-- 1 root root 86 Jun 4 2016 /usr/share/lintian/overrides/libusbmuxd4
lrwxrwxrwx 1 root root 19 Jun 9 2016 /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4 -> libusbmuxd.so.4.0.0
-rw-r--r-- 1 root root 30316 Jun 9 2016 /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4.0.0
-rwxr-xr-x 1 root staff 96812 Jan 18 08:25 /usr/local/lib/libusbmuxd.so.4.1.0
lrwxrwxrwx 1 root staff 19 Jan 18 08:25 /usr/local/lib/libusbmuxd.so.4 -> libusbmuxd.so.4.1.0
lrwxrwxrwx 1 root staff 19 Jan 18 08:25 /usr/local/lib/libusbmuxd.so -> libusbmuxd.so.4.1.0
-rwxr-xr-x 1 root staff 1015 Jan 18 08:25 /usr/local/lib/libusbmuxd.la
-rw-r--r-- 1 root staff 116154 Jan 18 08:25 /usr/local/lib/libusbmuxd.a
-rw-r--r-- 1 root staff 276 Jan 18 08:25 /usr/local/lib/pkgconfig/libusbmuxd.pc

/usr/share/doc/libusbmuxd4:
total 64
-rw-r--r-- 1 root root 2898 Jun 4 2016 copyright
-rw-r--r-- 1 root root 516 Jun 4 2016 changelog.Debian.gz
drwxr-xr-x 2 root root 4096 Aug 18 13:23 .
drwxr-xr-x 1351 root root 49152 Jan 18 09:22 ..

@TitanFighter
Copy link

TitanFighter commented Jan 18, 2019

@rajpancha1 Thanks for step-by-step commands. Also in my case the command:
ideviceinfo -k ProductVersion
raised issue
ERROR: Could not connect to lockdownd, error code -2.

Found the solution here, ie libimobiledevice must be generated like this ./autogen.sh --enable-openssl

P.S. Ubuntu 18.10 64 bit.

@nikias
Copy link
Member

nikias commented Jan 18, 2019

@rajpancha1 as you can see, you have an older version from 2016:

lrwxrwxrwx 1 root root     19 Jun 9 2016 /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4 -> libusbmuxd.so.4.0.0
-rw-r--r-- 1 root root  30316 Jun 9 2016 /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4.0.0

So when linking libimobiledevice it will use that one. Also there's

/usr/share/lintian/overrides/libusbmuxd4

Which denotes that it selected another package as default package.
Try removing the libusbmuxd4 and the other packages:

sudo apt-get remove libplist3 libusbmuxd4 libimobiledevice6

If it still says package not installed, remove the files manually:

sudo rm /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4 /usr/lib/arm-linux-gnueabihf/libusbmuxd.so.4.0.0

Also remove the lintian file:

sudo rm /usr/share/lintian/overrides/libusbmuxd4

Good luck.

@nikias
Copy link
Member

nikias commented Jan 18, 2019

@TitanFighter there is no need to pass --enable-openssl if you have libssl-dev installed since it will select OpenSSL by default (unless you configured it previously to use GnuTLS). The same lockdown error is also thrown if you didn't trust the computer on the device yet, btw.

@rajpancha1
Copy link

I just started restoring the flash from my pre-libimobiledevice journey.
I will restart clean install based on guidance from both of you.
I had install libssl-dev.

I'll let you know soon.
Thanks

1 similar comment
@rajpancha1
Copy link

I just started restoring the flash from my pre-libimobiledevice journey.
I will restart clean install based on guidance from both of you.
I had install libssl-dev.

I'll let you know soon.
Thanks

@rajpancha1
Copy link

Great! It works!
Thank TitanFighter and Nikias for your help.
One more question. How do I create a notification when any device is connected?

sudo service usbmuxd start
sudo service usbmuxd status
$ sudo service usbmuxd status
? usbmuxd.service - Socket daemon for the usbmux protocol used by Apple devices
Loaded: loaded (/lib/systemd/system/usbmuxd.service; static; vendor preset: enabled)
Active: active (running) since Fri 2019-01-18 19:56:01 CST; 10min ago
Docs: man:usbmuxd(8)
Main PID: 2220 (usbmuxd)
CGroup: /system.slice/usbmuxd.service
mq2220 /usr/local/sbin/usbmuxd --user usbmux --systemd
....
....
$ idevice_id -l
11a00339c2da93672ae1b56c393a49921b4e109d

$ ideviceinfo -k ProductVersion
9.3.5
$ idevicename
Darshanas iPad

@rajpancha1
Copy link

After installing libimobiledevice suite, I am noticing that mouse and keyboard freezes.
Has any one else also noticed this behavior?

@nikias
Copy link
Member

nikias commented Jan 21, 2019

@rajpancha1 I never attached mouse or keyboard to the RPi but I somehow doubt this is related in any way. Is this happening also if no iOS device is plugged in? If you check the process list for usbmuxd:

ps axgu |grep usbmuxd

If it doesn't show anything (except for a line with grep usbmuxd) then it is definitely not because of libimobiledevice since nothing is running that could interfere with HID.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests