Libraries. Don't new projects create their own library to store it's symbols

I have been working on a project and had to edit a symbol. It edited the main library symbol. As the title I thought all symbols where copied to the projects folder. This way you could give that folder to anyone and open it up on any PC.

I then closed the project and reset the main library symbol I edited but when I opened the project it wanted to do a rescue.

It doesn’t seem right for not only will future projects be broken as libraries change but would also explain why I have some older ones from 4 a partly broken.

Am I missing something.

You’ve got it right.
Schematic symbols are not embedded in the schematic, the schematic just has references to some (external) library. This is of course not very robust, and as a stop-gap fix the [project_name]-cache.lib was added, which is a copy of the schematic symbols that is kept as a backup, and when the original libraries disappear the “rescue” mechanism is used with the [project_name]-cache.lib file.

As long as all original libraries are present, you can delete the [project_name]-cache.lib file, and KiCad will just re-create it from it’s original sources, but when you backup or archive your project you should include this file, because if you want to modify your project (possibly) years later, it’s likely libraries have changed and that cache file is the only source available for schematic symbols.

It’s not a very robust system. For a bit of redundancy I always include a .pdf variant of the schematic when archiving a project. I’ve been bitten a few times with old PCB programs, for which I do not have the software anymore, and can’t open old files in any way, and the only schematics left are some printouts on paper or .png’s I made for a website.

I’ve archived a few project manually by exporting all used schematic symbols into a library and manually fixing the links to use that external library, but this (or something similar) can also be done with a script:

For the next KiCad version this will all be a thing of the past.
KiCad-nightly V5.99 saves copies of used schematic symbols into the schematic file itself in a way very similar to Footprints in Pcbnew.

2 Likes

You can edit a standard library symbol. However you need to save the modified symbol with a new name in a custom lib.

The custom lib should not be located in the same path as standard lib as that may be overwritten by a later standard lib rev.

Make a personal custom lib and place all new/modified symbols there. See the FAQ for info setting up the custom lib.

1 Like

Thanks paulvdh, I hate being proven right, I mean, I thought this was just a V5 bug as I assumed *cache.lib was not doing its job but this to me is a major critical bug that’s been around since v0.000001 I’m a hobbyist and use kicad once every blue moon but if you are professional this is a big no no, sorry boss I opened project dot from 2020 clicked on the wrong button and now i have just pretty green lines… You yourself described the lengths you go to to protect yourself, I can’t imagine how many business are at risk for this. It sounds like the old Linux mentality, to run this program you need to download this dependency for this dependency for this dependency but only if it’s this version but not this version or that version.

Sorry, getting carried away as i’m blown away by this revelation for to me clicking on save will save all with the project files its basic common sense. Inkscape, Xcel virtually all programs will save a what you import or copy into it and will not link back to the original unless you tell it to. How many IC’s have the same part number but a letter variation that can determine the pin configuration. One future mistake in the library can cook your old projects that need to be made again.

Congratulations on your new car purchase MR Blogs. But just remember if you drive out of our yard we will have to remove all the nuts and bolts for they are part of our inventory.

I won’t be trying the nightly. The caveat kind of makes impossible: " projects edited with these are not usable with current stable release"

Thanks.

2 Likes

This might be of interest Project and libary setup for sharing and collaboration (KiCad version 5) (TlDr: how your setup will look like highly depends on what you want to achieve. There is not one single answer.)

And for version 5 and earlier also this What are the cache and rescue libs and how does the schematic rescue dialog work? (KiCad version 5.x and earlier)

Thanks rene but after reading it I’m still surprised at the complexity for something that should be simple yet alone have been implemented years ago. But that’s me.

You want shematic xyz, no worries here is the project folder. Just remember, if you update the symbols from the global or any other library you will hit red flags for the updated symbols, custom symbols or modified ones. better yet, I’ll lock the symbols so you can add changes but not break the existing unless you first unlock the symbol.

Variables? don’t worry about them unless it asks then point it where yours are. The project is self contained.

I do this as a hobby and can tolerate the broken schematics. I learned that going from 4 to 5 even though I keep my own library they where still broken. *-cache.lib you are a liar and a thief.

Anyway, thanks all and hopefully V6 will be practical in this regard…

2 Likes

As I wrote earlier, it’s been fixed for KiCad-nightly V5.99.

The first time I saw the [ ?? ] question mark symbols in KiCad I panicked and made it worse. I think I deleted them and placed new symbols there. If you do that you loose both the annotation and the “timestamp” values and therefore synchronization with Pcbnew is also lost.

If you get over the scare, then it’s usually fixable. The question mark symbol in Eeschema just means that KiCad can not show graphics for a symbol, because it points to some library that is not there.

It is indeed a bit annoying, but it’s not a show stopper.
In the past I’ve had PCB programs with bugs that were complete showstoppers. One of them did not always properly update the netlist if a schematic symbol was deleted, which resulted in faulty PCB. Another program drew 100 wires criss-cross over your schematic if you dared to drag a connector with that many pins to another location, which was a constant nuisance and distraction while trying to concentrate on designing a schematic.

When I started with KiCad, the absence of such bugs was a big relief. The most serious bug back then was in the library management, there were some odd things happenening when making new libraries and moving or copying schematic symbols between libraries. But that has been fixed years ago, and in the last years KiCad is improving and getting polished in many different ways.

2 Likes

Nobody here can change the past. All we can do is document how KiCad currently works and how to effectively use it. We can also not make decisions for you. KiCad allows for very flexible use, i generally document all options and then let you decide what is best for your environment.


To preface: I generally do nothing special and basically never had an issue where the rescue stuff broke for me. All i do is i ensure that i treat the cache lib (and if present rescue lib) files as if they are part of the schematic itself. So i am careful to include them in any backup, any version control command, any time i sent it to somebody else, …

The rescue process is what does the decoupling of your project from the global lib. It allows you to keep old projects unchanged even if your global libs changed (this is the intended use). Of course this will mean that the old symbol needs to be stored somewhere. The rescue dialog that comes up is what does this for you. It of course fully relies on a valid cache lib! And such a rescued project will end up with a rescue lib that then needs to be treated as if it is part of the schematic file itself. (These two last sentences are the reason for my strict requirement regarding the two files)


It does not allow you to have a local modification of the symbol valid for just this project (i mean you can misuse it for this but i would advice against it).
The correct (clean) way to have local modification is to first copy the original symbol into a project local lib. Do the special change needed for this project and save. Then use the project local copy in the schematic.

I do this quite often for example to have a more specialized symbol for a micro controller (one where is set the electrical type of GPIOs as per the MCU hardware setup).

And i will continue to do this even in v6. It is just not clean to have modifications done to a hidden asset. (Similar to how i never make project local modifications to footprints without having a project library for them)

Updating from v4 is by the way a different story. The remap process made assumptions about the project state (it assumed a fully valid cache and rescue lib or if the cache lib is not present then it assumed the same libraries are still present in the same directory as before the remap). As long as these assumptions hold you can just click through the process without thinking.

If either assumption does not hold then of course you need to do some manual work before starting the remap process. See Converting KiCad version 4 projects to version 5 (Remap a project)

A backup before such a major operation is however always a good idea (luckily current versions of KiCad makes a backup of the project right at the start of the remap process so if you forget it then there is still a chance to go back – but definitely harder than if you make your own backup)

1 Like

I came to this conclusion in my previous reply though not added. In any case I thought that is a reasonable way but why would they not add a dialogue that on adding a symbol you get a choice of Add to projects library or retain global library link. Kicad has so many features that one would have been simple. You could even switch it off if you wanted to.

No matter, As paulvdh said it’s been resolved in nightly 5.99 I just have to wait until it becomes stable.

Thanks and no need to respond. I have a reasonable grasp now.

Thanks paulvdh but on going to download the nightly which I could not see a version number the following caveat killed it: projects edited with these are not usable with current stable release.

So you probably can’t go backwards to a stable release if you had to as it also puts in doubt going forward with your projects created in nightly’s.

No worries, until 5.99 stable I just need to remember.
1 - create project library in projects folder then add path.
2 - Insert symbol in schematic then > ctrl + e > ctrl + shift + s > save in projects library.

Also to leave a note in the project to add path if re-installing or moving to another PC.

All’s well. Thanks.

One can not add a dialog for every possible usecase. Otherwise your fingers would break from clicking away all these dialogs that you are not currently interested in.

I did not want to encourage you (too much) to start working with KiCad-nightly V5.99.
It is still a nightly, and has regular issues:

Eeschema file format has completely changed and is incompatible with the old, so backward conversion pretty much means drawing the whole schematic again. The PCB format also changed, but is apparently still reversible by deleting some sections.

KiCad V6 is expected somewhere this year. there are lots of small bugs and such that still need a bit of fixing.

My main reason for mentioning V5.99 was that it’s “close”, and (almost) all development effort is going towards making it ready for release. There is simply no chance that V5 is going to change and writing about wishes to do so are pretty much futile. What’s left is suggesting some workarounds, or confirmation that there is no better option so you won’t have to search for it.

1 Like

Paul OP, like any other CAD program, you need to LEARN how it really works, not just imagine a way you want it work.

A buddy of mine is an excellent analog and ps designer. He makes project libs. But every time he starts a new design he has to copy specific symbols and footprints to the new libs. I consider that a substantial burden.

So there is no single BEST way to do things.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.