## how to update or reinstall wiringPi of either prior installation source

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### how to update or reinstall wiringPi of either prior installation source

hello,
how to update or reinstall wiringPi of either prior installation source (perhaps some files are corrupted, outdated or missing)?
Do I have to do always first a clean uninstall, and if yes, how to?
I cannot recall anymore if I once had it installed from the original Jessie distribution, or meanwhile reinstalled from git, or by a tar file, or from either way or source.

buja
Posts: 498
Joined: Wed Dec 31, 2014 8:21 am
Location: Netherlands

### Re: how to update or reinstall wiringPi of either prior installation source

If wiringPi was installed from the package manager, APT knows about it.

Code: Select all

apt list wiringpi
Listing... Done
wiringpi/stable,now 2.44+1 armhf [installed]
This shows wiringPi was installed through APT, and any updates will be automatically handled by APT.
But this is with Raspbian Stretch, if you are still on Raspbian Jessie the exact command may be a bit different (try "man apt" to find the right command).
Any updates or repairs (reinstallation) are now possible through APT (again refer to the man page for the exact commands).

If you installed from another source, you have some searching to do through your directories to see where it went. Complete uninstall and reinstall is your best option.

Two more remarks:
• This clearly shows the advantage of sticking to the standard packages and the package manager.
• It might be wise to upgrade to Raspbian Stretch.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

thank you, it shows (running Jessie):

Code: Select all

apt list wiringpi
Listing... Done
wiringPi/oldstable 2.44 armhf
but I am not clear about what that means (what means "oldstable"? also the rest of the message looks different from yours) and additionally I don't remember if I once had reinstalled or installed over the existig wiringPi from git or from where ever (and at that time I never had an idea about if that had made any difference to do it this or either different way for updating)

Does my apt list message look confidentially?

Otherwise:
how to clean uninstall?

(I cannot upgrade to Stretch because 1st, I have Noobs and 2nd, some hardware shields of mine are not yet supported by the manufacturer for Stretch, but just for Jessie)

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

"oldstable" is just another name for Jessie.

"apt-get remove" or "apt-get purge" will uninstall, "purge" will also remove any configuration files.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

topguy wrote:
Mon Nov 20, 2017 1:18 pm
"oldstable" is just another name for Jessie.

"apt-get remove" or "apt-get purge" will uninstall, "purge" will also remove any configuration files.
I see, thank you.
But then my installation is probably ok, isn't it? (If so, there would be eventually no need to uninstall and re-install again)

Will then every time when I call
sudo apt-get update
also all wiringPi libs and configurations be updated in the future too, automatically?
(and also all other programs which I once had installed via apt-get install?)

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

Code: Select all

sudo apt update


BUT!:
The use of "apt list" when you dont get "[installed]" means that the package is not installed.
I dont use that command to check for installed pacakages, I use "dpkd -l | grep name".

Example:

Code: Select all

name@ThinkPad-T570:~\$ dpkg -l | grep gedit
ii  gedit                                           3.22.0-2ubuntu1                               amd64        official text editor of the GNOME desktop environment
ii  gedit-common                                    3.22.0-2ubuntu1                               all          official text editor of the GNOME desktop environment (support files)

You see that it print all packages that matches the name you give, and the "ii" at the start of the line tells me that those packages are installed.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

sorry, now that whole stuff is completely confusing me...

wiringPi/oldstable 2.44 armhf
means it is NOT installed, even if I can use some/most wiringPi functions????

so what do I have to do now, in simple steps, from A to Z ?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

Let me re-phrase that slightly:
The use of "apt list" when you dont get "[installed]" means that the package is not installed WITH APT.

You started this thread by wondering how wiringPi was installed, and I'm saying that its not likely installed with apt/apt-get. That means it will not be update automatically by apt either.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

hmm, well - I now simply typed
sudo apt-get install wiringPi
in the console (no uninstall before, just install over the existing files), then it did some certain things, and after that
apt list wiringPi
echoes "...installed"
Now it seems to be ok again, isn't it?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

Now you most likely have two installations of WiringPi in your system ? ( you said it was working before so.. )
Now you need to figure out which one is used when you do programming.

If you installed from source a long time ago, its most likely that those files where installed somewhere under "/usr/local/lib" while the "apt" installation will install somewhere under "/usr/lib".

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

hell what a mess!
That's why I asked what to do, which steps from A to Z... :-/

But there is nothing called "wiringPi", no file and no directory, neither in "/usr/local/lib" nor in "/usr/lib".
where do I have to look exactly?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

I dont have WiringPi installed on any Pi i have access to right now so its hard for me to give an A-Z list.
As far as I can google, you link with WiringPi by using "-lwiringPi" in the makefile/gcc command.

So the library should then have the name "libwiringPi.so".

So you should ( in theory ) find all instances by using:

Code: Select all


find /usr -name "libwiringPi.so*"

#or to cast a wider net
find /usr -name "*wiring*"


Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

thanks a lot! indeed, "libwiringPi.so" exist, not "wiringPi" though as I assumed.
In fact there are 2 of them listed, just as you already stated, both in "/usr/local/lib" as well as in "/usr/lib".

Now how to get rid of the false one?
Just delete this .so in "/usr/local/lib" or which is the correct procedure to erase it cleanly?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

The correct procedure would have been to find the build directory where you did "sudo make install" once upon a time and then do "sudo make uninstall" maybe. But of course this might not be possible, so manually remove them from /usr/local/lib is an acceptable solution.

BUT! you also have to look for the header files that you do #include <...> on, they should be hiding in "/usr/local/include".

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

the #includes only look like
#include <wiringPi.h>
no paths at all.
I once followed the installation guide on the wiringPi website, at that time no apt install had been mentioned (just the git thing and the .tar)
But even now they are misleading and ambiguous as there are now 3 ways how to install, but don't explain a thing about the installation paths and either details and differences.
After all, the apt install was the last one I did, so I would suppose all paths to be set to the apt install paths, not the old ones any longer.
[spoiler]
(But honestly, I dare say all about these installations on Linux is really an entire crap IMO.)
[/spoiler]

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

not sure if I understood you correctly:
did you mean that I have to delete all the *.h header files in "/usr/local/include" additionally?
If yes, what about the *.c ones?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

I cant tell you to delete all the files in "/usr/local/include" because I don't know what other libraries you might have installed from source. How many different "*.so" files are in "/usr/local/lib" ?

Are there really .c files in that directory ?

---

The common rule is that "/usr/local" is used for libraries and programs you compile "locally", everything installed from debian-packages with apt will be put in "/usr" ( /usr/bin /usr/lib /usr/include etc. )

The compiler GCC doesn't know where you have installed stuff so that is why you often see options like "-L/usr/local/lib" in the makefiles to tell GCC to also look for locally compiled libraries. And that is when you can run into problems with having two versions present in your system.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

there are no .c files in there, but I assumed they should be elsewhere, related to the corresponding .h files, and then to be deleted as well.

But ok, as to the .h files IIUC I actually do have to delete them but just the duplicate ones. In fact about half a dozen files were not duplicate, some less in .../lib, some more in .../include. Of course I only deleted the duplicates manually, a couple of dozens over all.
What a mess.
But after that, finally gpio -v and gpio readall still works fine in the console, thankfully.

No different pitfalls and/or orphans in different obscure directories?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

Stiller wrote:
Tue Nov 21, 2017 1:42 pm
there are no .c files in there, but I assumed they should be elsewhere, related to the corresponding .h files, and then to be deleted as well.
The .c files are compiled into the .so file, after that they are not useful anymore.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

thanks, again learnt something new! 8)

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

hi,
As stated, I have now installed the apt-get version and (probably) removed the former git clone version.

Now I just found out that there are still 2 files "wiringPi.h":

Code: Select all

sudo find / -iname wiringPi.h

\home\pi\wiringPi\wiringPi\wiringPi.h
\usr\include\wiringPi.h
is that correct? Is one of them redundant?
Is there even an additional entire directory which perhaps has to be removed?

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

The "/home/pi/wiringPi" is the directory where you downloaded the source and compiled the old version that ended up in "/usr/local/lib".
You can probably delete it.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

topguy wrote:
Wed Dec 06, 2017 8:43 am
The "/home/pi/wiringPi" is the directory where you downloaded the source and compiled the old version that ended up in "/usr/local/lib".
You can probably delete it.
thank you, I removed this "/home/pi/wiringPi" folder and wiringPi still works.

But tbh, as to those installations and all those folders and paths, all that is admittedly very confusing. Temporary folders for download purposes should be deleted automatically, and installation paths should be unified for either installation procedure (ie., both for git clone and for apt-get install).

topguy
Posts: 5780
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

### Re: how to update or reinstall wiringPi of either prior installation source

Stiller wrote:
Thu Dec 07, 2017 10:43 am
But tbh, as to those installations and all those folders and paths, all that is admittedly very confusing. Temporary folders for download purposes should be deleted automatically, and installation paths should be unified for either installation procedure (ie., both for git clone and for apt-get install).
It might be confusing for a beginner who forgot what he did originally but in general its a procedure that allows you to clean up you mess in a controlled way with some experience. There is no way for the system to know why you download code, and protecting OS files from accidental overwrites is also a good idea in the long run.

I understand that things are not obvious if you are new to Linux, I have 10+ years of experience and I still google a lot of stuff. The information is out there ( for example: https://wiki.debian.org/FilesystemHierarchyStandard ) but knowing where to look is half the work.

Stiller
Posts: 206
Joined: Fri Oct 14, 2016 9:03 am

### Re: how to update or reinstall wiringPi of either prior installation source

I have to disagree - IMO there should be just 1 default install path for all, i.e. all libs into "/usr/lib" by default (either if git or apt install).
And then there should be an overview menu like in Windows for everything which once has been installed, and an uninstall function to uninstall either one from this list.
In case either one has been installed into some different arbitrary directories, the uninstall procedure of course must know that and so is expected to always work correctly.
(This principle of procedure generally for libs and programs, and especially for wiringPi and all different C libs.)