-
Notifications
You must be signed in to change notification settings - Fork 139
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
avrintel.h missing from installation #1683
Comments
It seems to me we need to change the following file. Unfortunately I also do not know much about CMake and I do not know how to fix it. |
Maybe here?
PUBLIC_HEADER seems to be the keyword. Now this only needs to be a list. P.S. I have tested that if I copy avrintel.h manually to /usr/include both compilation of the program works and the resulting binary also works as expected. |
seems to do the trick (still no cmake expert, only stackoverflow knowledge...) |
So it appears that the header part of the API is for libavrdude users to (I have not found any examples for a libavrdude user within the avrdude sources, or any libavrdude users for that matter. The avrdude utility is not easily separable from libavrdude in the current source code tree, with the code for both being mixed inside the same directory The addition of That patch adds three function prototypes to const Configitem_t *avr_locate_config(const Configitem_t *cfg, int nc, const char *name);
int avr_get_config_value(const PROGRAMMER *pgm, const AVRPART *p, const char *cname, int *valuep);
int avr_set_config_value(const PROGRAMMER *pgm, const AVRPART *p, const char *cname, int value); The commit message only mentions the two So adding The quick workaround is to install The BTW, I do not see any changes to library symbol versioning or soname or similar corresponding to adding these three functions to the ABI. That might be due to my eyes being unused to cmake after 20+ years of working with automake+libtool in the libgphoto2 buildsystem, but the ABI related definitions inside If the From my experience with libgphoto2 + libgphoto2_port + gphoto2 I would recommend keeping everything one source code repository BTW, where is the libavrdude library API and ABI documented, and how are library users supposed to find the library? Just try the default include and linker path? Some modern library allow themselves flexibility for future incompatible API changes by installing their header files into Not sure how far you can get with symbol versioning when targeting Linux, BSDs, OSX, Windows, so classical library soname and header location is probably the way to go. |
As we only need a pointer to that type in That would be my proposed resolution to this issue. |
Thanks a lot for your serious consideration of this issue! |
For completeness' sake: My role here is that I have been involved with Fedora's avrdude packages since about 2011, and that I have recently contributed a few simple fixes around building avrdude, mostly with the autotools based buildsystem. So I lack the institutial knowledge a seasoned member of the avrdude development team would know, such as e.g. libavrdude users - and I want to learn more. |
Is the In that case, we could remove |
The idea behind libavrdude.h was that it's exactly one public header file that is needed and needs to be published. There used to be a dozen (or more) files in the past, and we once cooked the public part into a single file. So the correct method would be ndim's proposed solution to use a pointer to an incomplete struct. |
Good question. ;-) |
TLDR; I think it's best to install The long of it. As AVRDUDE obtained a better model of the 350+ parts, 150+ programmers and their interaction, it needed to know more about the parts than was reasonable to put into the user-modifiable avrdude.conf file; amongst the new things were interrupt vector names (needed by urclock), bit-level fuse configuration (needed by the terminal While Maintenance-wise the easiest is to break the rule that there is only one header file for libavrdude and put a second header file as a sibling into the directory wherever libavrdude.h lives. Other solutions are possible, but forward-declaring some types for the API won't give the |
If it makes sense to ship additional header files, might I suggest to treat those as internal headers and implementation details not to be included directly by library users? Those additional header files might then clutter Then libavrdude users would then only ever deal with the one header file, and any other header files would never be part of the public API and could therefore be renamed and moved and removed (provided their former content is provided in another way). So #define LIBAVRDUDE_INCLUDE_INTERNAL_HEADERS
#include <avrintel.h>
#undef LIBAVRDUDE_INCLUDE_INTERNAL_HEADERS while #ifndef LIBAVRDUDE_INCLUDE_INTERNAL_HEADER
#error Do not directly #include <avrintel.h>. Do #include <libavrdude.h> instead.
#endif Perhaps another name for |
Yes, this should work well and this is how the current use is intended. Admittedly, there is still one instance of
Good idea!
Both were intended: the former to ensure user code does not need to include avrdude.h (seeing that avrintel.c has become part of libavrdude) and the latter was my gut-feeling that someone "out there" might reasonably want to use that function. Note that it is not solely
Guilty as charged!
However, all things considered, I think |
#819 is more of a generic issue. The following two Issues which may be difficult to fix and require more efforts.
And in order to use libavrdude more effectively, #1057 on documentation (as well as examples) is good to be improved. |
I have created PR #1686 to follow @ndim's recommendation. All that's left doing is to
@ndim What do you think? If I merge PR #1686 as is, could you make the above changes in your PR #1681? |
@stefanrueger I have started to look into the library versioning with cmake only a few hours ago. I have not figured out yet how they work. The libtool versioning scheme looks weird and complex at first sight, but it does allow adding parts to a dynamic library's ABI without needing to relink software which is dynamically linked to that library. The cmake library BTW I started looking into the library version while trying to script the Autotools build system to get that information from |
As many things have been added to I have verified that both the Making library ABI version numbers the same as CMAKE_PROJECT_VERSION is a bad idea. ABI changes and release version numbers are very different things. My suggestion for the version numbers is to keep The installation of |
BTW... is the Lines 1386 to 1397 in a826792
That unnamed union imposes on any compilation unit which includes Or is C11 officially the C language standard which |
Good catch. This is for another time. I might review the project in the future to see whether we can restrict ourselves to C99 |
I just merged PR #1686 so this should be in git main |
OK, that is a good suggestion |
It may be difficult as MSVC is still evolving the support of C11. |
Please take a look at the MSVC C99/C11 comformance limitations to see if we can move to C11. Our CI is using the pretty new MSVC version from VS2022 so basic C11 features should work with some exceptions). |
The language standard used to build |
Good point. Thanks. |
I think PR #1688 is good to go and it will fix this issue. |
Build environment: Linux openSUSE 15.5
Sorry, not a cmake expert, so I don't have a patch :-(
Problem:
libavrdude.h ist installed in the include directory of CMAKE_INSTALL_PREFIX:PATH (e.g. /usr/include or /usr/local/include)
In libavrdude.h you have since 7.3
#include "avrintel.h"
but this is not installed to the same path, so any compilations of programs using libavrdude.h will fail.
avrdude itself just works, because it is build in the full source tree.
I've found that after the build in build_linux there is a file named install_manifest.txt, which contains a list of the files and path of all the files that final install step will distribute on the system. I expect that avrintel.h just needs to be added there.
Unfortunately I did not find an (to me) obvious place in the build systems to do so.
The text was updated successfully, but these errors were encountered: