Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Tommy Murphy
> Could it be that my Ubuntu version is the culprit (I'm using
> Ubuntu 20.04.1 LTS). Although this shouldn't matter, because
> eventually the build happens in Docker...

I don't think so.
I just did a build of the linux 64 bit openocd on Ubuntu 20.04.1 and it went 
fine and ldd -v doesn't show anything untoward.
___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread kristof . mulier
Hi @Liviu Ionescu and @Tommy Murphy,
Sorry for my late reply.

The way I attempt to execute OpenOCD
=
In my last e-mail, I told you that I executed OpenOCD  after the build
without specifying *how* exactly. My apologies for that. So here is what
I did:

1. I copied everything from ~/Work/openocd-0.10.0-14/deploy/ into
   another folder:

$ cd ~/Work/openocd-0.10.0-14/deploy
$ cp -R * /media/sf_ubuntu
$ cd /media/sf_ubuntu

2. I extracted the zipped file "xpack-openocd-0.10.0-14-linux-x64.tar.gz"
   in that folder. The extraction itself I did from the standard Ubuntu
   file explorer (so not from the terminal).

3. I navigate into the extracted folder, and execute OpenOCD from there:

$ cd 
/media/sf_ubuntu/xpack-openocd-0.10.0-14-linux-x64/xpack-openocd-0.10.0-14/bin
$ ./openocd --version

./openocd: error while loading shared
libraries: libusb-0.1.so.4: cannot open
shared object file: No such file or
directory


Tommy Murphy's build
=
So @Tommy Murphy, you successfully built OpenOCD (with the last
three lines in the build script uncommented), and it just works?

Could it be that my Ubuntu version is the culprit (I'm using
Ubuntu 20.04.1 LTS). Although this shouldn't matter, because
eventually the build happens in Docker...


Suggestions about the how-to-build pages
=
@Liviu Ionescu, I also don't know how I screw things up. It seems
like the heavens don't want me to build OpenOCD...

Based on your build instructions, I wrote a guide (mainly for my own
use) on how to build OpenOCD:

https://new.embeetle.com/#embedded-dev/software/dev-tools/flash/openocd_build

In this guide, I literally documented every single step. I made that
guide a couple of months ago, because I've had so many troubles with building
OpenOCD in the past. I took the "write everyting down" approach, like really
every single click. It's as if I'm explaining to my grandmom how to do it.
Somehow I thought this guide would save me from further issues, which it did as
long as I only tested the Windows executables. Trouble started when I tested the
Linux executable a couple of days ago.

So my only suggestion: write it as if you're explaining it to your grandmom
(hopefully she is not a computer scientist).

I'm really thankful for all the efforts you made and still make!
I'll make another donation, because you're my OpenOCD hero!

Kind regards,
Kristof Mulier



- Oorspronkelijk bericht -
Van: "Liviu Ionescu" 
Aan: "Tommy Murphy" 
Cc: "kristof mulier" , "johan" , 
"matic" , "openocd-devel" 

Verzonden: Maandag 31 augustus 2020 14:14:20
Onderwerp: Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

> On 31 Aug 2020, at 15:08, Tommy Murphy  wrote:
> 
> ... the xPack project pages

with all those pages, it seems that people always find creative ways to mess 
things up, so my conclusion is that those pages need improvements.

I'm open to any suggestions. 

Kristof? what is wrong with those pages, such that you could not make it?


Liviu


___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Liviu Ionescu



> On 31 Aug 2020, at 15:08, Tommy Murphy  wrote:
> 
> ... the xPack project pages

with all those pages, it seems that people always find creative ways to mess 
things up, so my conclusion is that those pages need improvements.

I'm open to any suggestions. 

Kristof? what is wrong with those pages, such that you could not make it?


Liviu




___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Tommy Murphy
> Again my sincere thanks to all of you (Liviu Ionescu, Tommy Murphy, ...) that 
> are
> helping people like me to build OpenOCD for Windows/Linux/Mac.
>
> Kind regards,
> Kristof Mulier

Thanks but I am really just restating what Liviu already says on the xPack 
project pages so not actually adding any value as such. :-)
___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Liviu Ionescu



> On 31 Aug 2020, at 14:47, Tommy Murphy  wrote:
> 
> user@cockatoo:~/Downloads/xpack-openocd-0.10.0-14/bin$ ldd openocd
> linux-vdso.so.1 (0x7ffd1695f000)
> libusb-0.1.so.4 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libusb-0.1.so.4 
> (0x7f21f828a000)
> libftdi1.so.2 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libftdi1.so.2 
> (0x7f21f8279000)
> libhidapi-hidraw.so.0 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libhidapi-hidraw.so.0 
> (0x7f21f8272000)
> libusb-1.0.so.0 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libusb-1.0.so.0 
> (0x7f21f8255000)
> libudev.so.0 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libudev.so.0 
> (0x7f21f7a63000)
> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7f21f76c5000)
> libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x7f21f74c1000)
> libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f21f72a2000)
> librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x7f21f709a000)
> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7f21f6ca9000)
> libiconv.so.2 => 
> /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libiconv.so.2 
> (0x7f21f8155000)
> /lib64/ld-linux-x86-64.so.2 (0x7f21f806c000)


as expected, openocd will use the libraries from its own folder; only the 
system libraries are from /lib/.

q.e.d.


Liviu






___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Tommy Murphy
I just did a full rebuild of everything from the upstream openocd repo/HEAD 
(i.e. last three lines of defs-source.sh uncommented).
The build went fine as usual.
I then did this:

user@cockatoo:~$ cd ~/Downloads
user@cockatoo:~/Downloads$ tar -xzvf 
~/Work/openocd-0.10.0-14/deploy/xpack-openocd-0.10.0-14-linux-x64.tar.gz
user@cockatoo:~/Downloads$ cd xpack-openocd-0.10.0-14/bin/
user@cockatoo:~/Downloads/xpack-openocd-0.10.0-14/bin$ ldd openocd
linux-vdso.so.1 (0x7ffd1695f000)
libusb-0.1.so.4 => 
/home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libusb-0.1.so.4 
(0x7f21f828a000)
libftdi1.so.2 => 
/home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libftdi1.so.2 
(0x7f21f8279000)
libhidapi-hidraw.so.0 => 
/home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libhidapi-hidraw.so.0 
(0x7f21f8272000)
libusb-1.0.so.0 => 
/home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libusb-1.0.so.0 
(0x7f21f8255000)
libudev.so.0 => /home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libudev.so.0 
(0x7f21f7a63000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7f21f76c5000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x7f21f74c1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f21f72a2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x7f21f709a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7f21f6ca9000)
libiconv.so.2 => 
/home/user/Downloads/xpack-openocd-0.10.0-14/bin/./libiconv.so.2 
(0x7f21f8155000)
/lib64/ld-linux-x86-64.so.2 (0x7f21f806c000)
user@cockatoo:~/Downloads/xpack-openocd-0.10.0-14/bin$


___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread Liviu Ionescu



> On 31 Aug 2020, at 13:43, kristof.mul...@telenet.be wrote:
> 
> First I navigate to the
> folder where the OpenOCD executable is

since none of the libraries are found by ldd, you're probably not navigating to 
the correct folder. it should be 
'Work/openocd-0.10.0-14/linux-x64/install/openocd/bin/openocd'.

anyway, to be sure, unpack the resulting distribution .tar.gz and use that 
binary.

the trick with the xPack binaries is that they are adjusted to use DT_RPATH 
$ORIGIN, which means they look for the shared libraries in the same folder 
where the executable is.

this makes them standalone, which means two things: they do not depend on the 
system libraries, which may have different versions or do not be installed at 
all, and they can be executed from any folder.


regards,

Liviu



___
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel


Re: [OpenOCD-devel] Missing libusb shared object file in xPack build.

2020-08-31 Thread kristof . mulier
Hi @Tommy Murphy, 

I just did a clean build, following the exact steps you mentioned. 
Please note that just before starting the build, I uncomment the last 
three lines in 
~ /Downloads/ openocd-xpack.git/scripts/defs-source.sh 
to make sure that I'm building the most recent master branch. 

So these are the exact commands I run: 

# Clean apt-get and install the needed packages 
$ sudo apt-get clean 
$ sudo apt-get install -y apt-transport-https ca-certificates curl 
software-properties-common 

# Download and install docker 
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 
$ version_name=$(lsb_release -cs) 
$ sudo add-apt-repository "deb [arch=amd64] 
https://download.docker.com/linux/ubuntu ${version_name} stable" 
$ sudo apt-get update 
$ sudo apt-get -y install docker-ce 
$ sudo docker run hello-world 
$ sudo groupadd docker 
$ sudo gpasswd -a ${ USER } docker 
$ sudo service docker restart 

# Restart Ubuntu VM 
$ shutdown -r now 

# Test docker 
$ docker run hello-world 

# Clean everything from previous builds 
$ sudo rm -rf ~ /Downloads/openocd-xpack.git 
$ sudo rm -rf ~ /Work 

# Clone OpenOCD Xpack project 
$ git clone --recurse-submodules 
https://github.com/xpack-dev-tools/openocd-xpack.git ~ 
/Downloads/openocd-xpack.git 

# Navigate to the build script ' defs-source.sh ' 
$ cd ~ /Downloads/openocd-xpack.git/scripts/ 

# Edit the build script (uncomment three last lines) 
$ gedit defs-source.sh 

# Return to home folder and start build procedure 
$ cd ~ 
$ bash ~ /Downloads/openocd-xpack.git/scripts/build.sh --all 


Unfortunately the earlier problem persists: the shared-object libusb-0.1.so.4 
cannot be found. On the advice of @Liviu Ionescu, I issue the ldd command to 
print all the dependencies of the OpenOCD executable. First I navigate to the 
folder where the OpenOCD executable is, then I issue this command: 

$ ldd -v ./openocd 
linux-vdso.so.1 (0x7ffd96ddd000) 
libusb-0.1.so.4 => not found 
libftdi1.so.2 => not found 
libhidapi-hidraw.so.0 => not found 
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x7fadcb88c000) 
libudev.so.0 => not found 
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7fadcb73d000) 
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x7fadcb735000) 
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7fadcb712000) 
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x7fadcb707000) 
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7fadcb515000) 
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x7fadcb4e9000) 
/lib64/ld-linux-x86-64.so.2 (0x7fadcbcb7000) 

Version information: 
./openocd: 
librt.so.1 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/librt.so.1 
libdl.so.2 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libdl.so.2 
libm.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libm.so.6 
libpthread.so.0 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libpthread.so.0 
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.11) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6 
/lib/x86_64-linux-gnu/libusb-1.0.so.0: 
libudev.so.1 (LIBUDEV_183) => /lib/x86_64-linux-gnu/libudev.so.1 
libpthread.so.0 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libpthread.so.0 
libpthread.so.0 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libpthread.so.0 
libc.so.6 (GLIBC_2.9) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.8) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.17) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.7) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.3.4) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6 
/lib/x86_64-linux-gnu/libm.so.6: 
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2 
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6 
/lib/x86_64-linux-gnu/libdl.so.2: 
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2 
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6 
/lib/x86_64-linux-gnu/libpthread.so.0: 
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2 
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2 
libc.so.6 (GLIBC_2.7) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6 
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6