USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.24k stars 766 forks source link

Error 2 in make processing of cereal. #762

Open iajzenszmi opened 2 years ago

iajzenszmi commented 2 years ago

cmake cereal -- boost_variant.cpp -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Configuring done -- Generating done -- Build files have been written to: /home/ian/cereal (01:31 ian@ian-Aspire-One-753 cereal) > ls cereal CMakeFiles doc cerealConfig.cmake cmake_install.cmake Makefile cerealConfigVersion.cmake coverage sandbox CMakeCache.txt CTestTestfile.cmake unittests (01:31 ian@ian-Aspire-One-753 cereal) > make [ 1%] Building CXX object unittests/CMakeFiles/portability_test32.dir/portability_test.cpp.o In file included from /home/ian/cereal/cereal/include/cereal/cereal.hpp:32, from /home/ian/cereal/cereal/include/cereal/archives/portable_binary.hpp:32, from /home/ian/cereal/cereal/unittests/portability_test.cpp:28: /usr/include/c++/11/type_traits:38:10: fatal error: bits/c++config.h: No such file or directory 38 | #include <bits/c++config.h> | ^~~~~~ compilation terminated. make[2]: [unittests/CMakeFiles/portability_test32.dir/build.make:76: unittests/CMakeFiles/portability_test32.dir/portability_test.cpp.o] Error 1 make[1]: [CMakeFiles/Makefile2:368: unittests/CMakeFiles/portability_test32.dir/all] Error 2 make: *** [Makefile:146: all] Error 2 (01:31 ian@ian-Aspire-One-753 cereal) >

sejun000 commented 1 year ago

I tried to make in 18.04. and this installation worked. apt install doxygen apt install boost apt install libboost apt install libboost-all-dev apt install make-guide apt install build_essential apt install build-essential apt install gcc-multilib apt install make-guile apt install g++-multilib

waxz commented 2 months ago

you can disable unit test to avoid the problem

cmake .. -DBUILD_TESTS=OFF
iajzenszmi commented 2 months ago

On Fri, Sep 6, 2024 at 1:05 PM wonder @.***> wrote:Disabling unit tests in software development—especially in projects related to mission-critical systems or those that handle ethical and safety concerns—can introduce both ethical and technical risks. Here’s an outline of the issues:

1. Ethical Issues

A. Accountability & Responsibility

2. Technical Issues

A. Introduction of Bugs

3. Mission-Critical Safety Concerns

A. Lack of Verification

Recommendations

Disabling unit tests should be a last resort, especially for systems with significant ethical and safety implications. Maintaining a robust testing framework is crucial for ensuring software reliability, maintaining trust, and adhering to ethical standards.

you can disable unit test to avoid the problem

cmake .. -DBUILD_TESTS=OFF

— Reply to this email directly, view it on GitHub https://github.com/USCiLab/cereal/issues/762#issuecomment-2333138476, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGRK55B666BWTJEDPJBS23ZVELYZAVCNFSM6AAAAABNXWNV7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZTGEZTQNBXGY . You are receiving this because you authored the thread.Message ID: @.***>

iajzenszmi commented 2 months ago

@.:~$ nvim ser.cpp @.:~$ g++ ser.cpp ser.cpp:1:10: fatal error: cereal/types/unordered_map.hpp: No such file or directory 1 | #include <cereal/types/unordered_map.hpp> | ^~~~~~~~ compilation terminated. @.:~$ apt-cache search cereal cereal - automated, logged serial terminal management system libcereal-dev - C++11 library for serialization libcereal-doc - C++11 library for serialization HTML documentation libghc-bytes-dev - Sharing code for serialization between binary and cereal libghc-bytes-doc - Sharing code for serialization between binary and cereal; documentation libghc-bytes-prof - Sharing code for serialization between binary and cereal; profiling libraries libghc-cereal-conduit-dev - turn Data.Serialize Gets and Puts into Sources and Sinks libghc-cereal-conduit-doc - turn Data.Serialize Gets and Puts into Sources and Sinks; documentation libghc-cereal-conduit-prof - turn Data.Serialize Gets and Puts into Sources and Sinks; profiling libraries libghc-cereal-dev - binary serialization library libghc-cereal-doc - binary serialization library; documentation libghc-cereal-prof - binary serialization library; profiling libraries libghc-cereal-vector-dev - Serialize instances for Data.Vector types libghc-cereal-vector-doc - Serialize instances for Data.Vector types; documentation libghc-cereal-vector-prof - Serialize instances for Data.Vector types; profiling libraries libghc-safecopy-dev - Haskell serialization library with version control - GHC libraries libghc-safecopy-doc - Haskell serialization library with version control - documentation; documentation libghc-safecopy-prof - Haskell serialization library with version control - GHC profiling libraries; profiling libraries python3-cerealizer - secure pickle-like module for Python 3 @.:~$ sudo apt install libcereal-dev libcereal-doc [sudo] password for ian: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: chromium-codecs-ffmpeg-extra gstreamer1.0-vaapi libflashrom1 libftdi1-2 libgstreamer-plugins-bad1.0-0 libllvm13 libva-wayland2 Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: rapidjson-dev Suggested packages: rapidjson-doc The following NEW packages will be installed: libcereal-dev libcereal-doc rapidjson-dev 0 to upgrade, 3 to newly install, 0 to remove and 6 not to upgrade. Need to get 723 kB of archives. After this operation, 7,254 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://au.archive.ubuntu.com/ubuntu jammy/universe amd64 rapidjson-dev all 1.1.0+dfsg2-7 [95.0 kB] Get:2 http://au.archive.ubuntu.com/ubuntu jammy/universe amd64 libcereal-dev all 1.3.1+dfsg-1 [222 kB] Get:3 http://au.archive.ubuntu.com/ubuntu jammy/universe amd64 libcereal-doc all 1.3.1+dfsg-1 [406 kB] Fetched 723 kB in 0s (7,647 kB/s) Selecting previously unselected package rapidjson-dev. (Reading database ... 255799 files and directories currently installed.) Preparing to unpack .../rapidjson-dev_1.1.0+dfsg2-7_all.deb ... Unpacking rapidjson-dev (1.1.0+dfsg2-7) ... Selecting previously unselected package libcereal-dev. Preparing to unpack .../libcereal-dev_1.3.1+dfsg-1_all.deb ... Unpacking libcereal-dev (1.3.1+dfsg-1) ... Selecting previously unselected package libcereal-doc. Preparing to unpack .../libcereal-doc_1.3.1+dfsg-1_all.deb ... Unpacking libcereal-doc (1.3.1+dfsg-1) ... Setting up rapidjson-dev (1.1.0+dfsg2-7) ... Setting up libcereal-doc (1.3.1+dfsg-1) ... Setting up libcereal-dev (1.3.1+dfsg-1) ... @.:~$ g++ ser.cpp @.:~$ ./a.out @.:~$ nano ser,cpp @.:~$ nano ser.cpp @.:~$ ls out.cereal out.cereal @.:~$ cat out.cereal @.***:~$ cat ser.cpp

include <cereal/types/unordered_map.hpp>

include <cereal/types/memory.hpp>

include <cereal/archives/binary.hpp>

include

struct MyRecord { uint8_t x, y; float z;

template void serialize( Archive & ar ) { ar( x, y, z ); } };

struct SomeData { int32_t id; std::shared_ptr<std::unordered_map<uint32_t, MyRecord>> data;

template void save( Archive & ar ) const { ar( data ); }

template void load( Archive & ar ) { static int32_t idGen = 0; id = idGen++; ar( data ); } };

int main() { std::ofstream os("out.cereal", std::ios::binary); cereal::BinaryOutputArchive archive( os );

SomeData myData; archive( myData );

return 0; } @.***:~$

On Fri, Sep 6, 2024 at 2:15 PM Ian Ajzenszmidt @.***> wrote:

On Fri, Sep 6, 2024 at 1:05 PM wonder @.***> wrote:Disabling unit tests in software development—especially in projects related to mission-critical systems or those that handle ethical and safety concerns—can introduce both ethical and technical risks. Here’s an outline of the issues:

1. Ethical Issues

A. Accountability & Responsibility

  • Negligence: By disabling unit tests, the development team may knowingly bypass essential validation steps, potentially leading to harm or failure in mission-critical systems. This could raise ethical concerns regarding responsibility.
  • Transparency: In industries with strict safety standards (e.g., medical, automotive, aerospace), omitting tests may violate transparency requirements, which stakeholders rely on for trust.

    B. Compliance with Standards

  • Regulatory Requirements: Many sectors require rigorous testing to ensure the safety and effectiveness of software. Disabling tests may violate standards like ISO 26262 (automotive) or IEC 61508 (functional safety). Ethical compliance with these standards is critical.
  • Public Trust: If software is deployed without proper testing and later causes harm, public trust in the development organization and software development as a whole may erode.

    C. Long-term Risk to Human Safety

  • Safety Risks: Skipping tests may introduce undetected errors, which in safety-critical applications (e.g., medical devices or aircraft control systems) could directly impact human lives.
  • Ethical Design Philosophy: Developers have a duty to create reliable and safe software. Disabling tests undermines this philosophy and may lead to ethical dilemmas, especially if preventable failures cause harm.

2. Technical Issues

A. Introduction of Bugs

  • Higher Likelihood of Bugs: Unit tests are designed to catch small bugs early in the development process. Disabling tests increases the risk of defects going unnoticed, which may lead to crashes or data corruption.
  • Regression Issues: Future changes to the codebase are not validated against the previously working state, making it harder to identify if new code introduces regressions (errors that reappear after being fixed).

    B. Increased Maintenance Costs

  • More Complex Debugging: Without unit tests, future debugging becomes more difficult because the foundational safety net for code validation is missing. Technical debt accumulates over time, making maintenance costly and challenging.
  • Code Quality Degradation: Unit tests enforce a modular and structured coding style. Without these tests, the code quality may deteriorate, making future changes and optimizations risky.

    C. Dependency Breakage

  • Broken Dependencies: If parts of the code rely on external libraries or APIs, disabling tests makes it easier to overlook issues arising from version upgrades or changes in these dependencies, leading to failures in the production environment.

3. Mission-Critical Safety Concerns

A. Lack of Verification

  • Inadequate Verification for Critical Functions: For systems that are mission-critical—such as avionics, healthcare, or space exploration—unit tests are essential for verifying the correct behavior of crucial functions. Without them, failures may occur during operation, leading to catastrophic consequences.

    B. Uncontrolled Failures

  • No Early Detection: Unit tests can serve as an early warning system, identifying defects before they cascade into more severe issues. In mission-critical systems, uncontrolled failures due to unchecked errors could lead to significant damage or loss of life.

    C. Reliability and Uptime

  • Decreased System Reliability: For systems where uptime is critical, such as in financial institutions or industrial control systems, failure to run unit tests can lead to lower reliability, causing financial loss, operational downtime, or system breaches.

Recommendations

  • Only Disable Tests Temporarily: If disabling tests is required to resolve a specific issue, ensure that it’s a temporary measure. Track this decision in the project logs and implement a plan to re-enable testing as soon as possible.

  • Isolate and Address Problematic Tests: Instead of disabling all tests, isolate and fix problematic tests or temporarily exclude only the affected ones.

  • Implement Alternative Safeguards: If unit tests are disabled, additional layers of code review, integration testing, or manual testing should be implemented to compensate for the lack of automated verification.

  • Document the Decision: If tests are disabled, document the rationale and communicate the risks to stakeholders. This ensures accountability and allows future teams to understand the decision context.

  • Maintain a Robust CI/CD Pipeline: Make sure the continuous integration (CI) pipeline is still running other tests (e.g., integration or system tests) to catch potential issues.

Disabling unit tests should be a last resort, especially for systems with significant ethical and safety implications. Maintaining a robust testing framework is crucial for ensuring software reliability, maintaining trust, and adhering to ethical standards.

you can disable unit test to avoid the problem

cmake .. -DBUILD_TESTS=OFF

— Reply to this email directly, view it on GitHub https://github.com/USCiLab/cereal/issues/762#issuecomment-2333138476, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABGRK55B666BWTJEDPJBS23ZVELYZAVCNFSM6AAAAABNXWNV7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZTGEZTQNBXGY . You are receiving this because you authored the thread.Message ID: @.***>