Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

C_and_C++.txt 3.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  1. = C and C++ Packaging Guidelines
  2. // https://github.com/asciidoctor/asciidoctor/commit/426d8389aa1706a589b66c96801542f587ae6b61
  3. :pp: ++
  4. == Introduction
  5. The C and {cpp} languages and runtimes
  6. are one of the most common development frameworks for packages in fedora.
  7. As such there is a wide variety of quality, style, and convention
  8. in all of those packages.
  9. The follow document provides best practice
  10. for certain aspects of C and {cpp} packaging.
  11. == Packaging
  12. === BuildRequires and Requires
  13. If your application is a C or {cpp} application
  14. you must list a `BuildRequires` against `gcc`, `gcc-c{pp}` or `clang`.
  15. Those packages will include everything that is required
  16. to build a standards conforming C or {cpp} application.
  17. If your library includes standard C or {cpp} headers,
  18. you must list `BuildRequires` against `gcc`, `gcc-c{pp}`, or `clang`
  19. to install the needed standards conforming headers.
  20. If at runtime you use `cpp` to process C or {cpp} language headers
  21. then you have no choice but to use `Requires` for `gcc`, `gcc-c{pp}`, or `clang`
  22. to install the required headers
  23. for a standard conforming C or {cpp} application.
  24. In the future this might change
  25. if a set of standard C or {cpp} language headers are provided
  26. by a special-purpose provides e.g. `c-headers` or `c{pp}-headers`.
  27. You need not include a `BuildRequires` or `Requires` on `glibc-headers`,
  28. or any other core C or {cpp} implementation package
  29. unless you have a specific and special need
  30. e.g. static compilation requires the `.*-static` library packages
  31. e.g. `BuildRequires: glibc-static`.
  32. The default use case of a dynamically compiled C or {cpp} application
  33. is taken care of by the `gcc`, `gcc-c{pp}`, and `clang` packages.
  34. Please refer to xref:index.adoc#compiler[Compiler Guidelines]
  35. for the list of supported compilers for C and {cpp} compilers.
  36. === Packaging Q&A
  37. [qanda]
  38. Do I need a `Requires: glibc` to ensure I have the C runtime installed for my application?::
  39. No.
  40. RPM will automatically determine what ELF libraries you need
  41. based on the binaries in your package.
  42. This is sufficient to cause glibc to be installed.
  43. Do I need to include a `Requires: libgcc`?::
  44. If you are using an API from `libgcc` directly,
  45. then yes, you must have a `Requires: libgcc`.
  46. In general though `glibc` requires `libgcc`, so it is always installed.
  47. == Libraries
  48. Libraries should have unique shared object names
  49. (SONAMEs via `-Wl,-soname=libfoo.so`)
  50. that do not conflict with other library SONAMEs used in the distribution.
  51. For example there should be only one `libfoo.so` in the distribution.
  52. The exception is when there are multiple implementations of the same library
  53. `libfoo.so` provided by different authors and each conflicts with the other.
  54. In this case both `libfoo.so` must provide exactly the same interface,
  55. but with a different implementation.
  56. Having two `libfoo.so` each with a different API is bad practice
  57. and makes it harder to package and distribute those packages.
  58. Libraries should version all of their symbols using a version script.
  59. Versioning allows the library to avoid changing the SONAME when the API changes
  60. and instead compatibility functions can be written
  61. to provide backwards compatibility for older applications.
  62. == Applications
  63. No additional suggestions are provided for applications at this time.
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...