{"id":13667331,"url":"https://github.com/secure-software-engineering/phasar","last_synced_at":"2025-05-14T18:04:03.406Z","repository":{"id":38831017,"uuid":"131954048","full_name":"secure-software-engineering/phasar","owner":"secure-software-engineering","description":"A LLVM-based static analysis framework.","archived":false,"fork":false,"pushed_at":"2025-05-05T08:30:39.000Z","size":129248,"stargazers_count":981,"open_issues_count":47,"forks_count":146,"subscribers_count":29,"default_branch":"development","last_synced_at":"2025-05-05T09:44:51.339Z","etag":null,"topics":["c","cpp","data-flow-analysis","llvm","program-analysis","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/secure-software-engineering.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-03T06:53:30.000Z","updated_at":"2025-05-04T08:57:59.000Z","dependencies_parsed_at":"2023-10-20T15:38:36.016Z","dependency_job_id":"7bca1f32-613c-4143-8d35-e310abe68226","html_url":"https://github.com/secure-software-engineering/phasar","commit_stats":{"total_commits":2422,"total_committers":67,"mean_commits":"36.149253731343286","dds":0.7423616845582164,"last_synced_commit":"6e0f6f62288ff4130f2e7ac105ef6655991f1dce"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secure-software-engineering%2Fphasar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secure-software-engineering%2Fphasar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secure-software-engineering%2Fphasar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/secure-software-engineering%2Fphasar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/secure-software-engineering","download_url":"https://codeload.github.com/secure-software-engineering/phasar/tar.gz/refs/heads/development","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030964,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cpp","data-flow-analysis","llvm","program-analysis","static-analysis"],"created_at":"2024-08-02T07:00:35.209Z","updated_at":"2025-05-14T18:03:58.396Z","avatar_url":"https://github.com/secure-software-engineering.png","language":"C++","readme":"![PhASAR logo](img/Logo_RGB/Phasar_Logo.png)\n\n# PhASAR a LLVM-based Static Analysis Framework\n\n[![C++ Standard](https://img.shields.io/badge/C++_Standard-C%2B%2B17-blue.svg?style=flat\u0026logo=c%2B%2B)](https://isocpp.org/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blueviolet.svg)](https://raw.githubusercontent.com/secure-software-engineering/phasar/master/LICENSE.txt)\n\nVersion 2503\n\n## Secure Software Engineering Group\n\nPhASAR is primarily developed and maintained by the Secure Software Engineering Group at Heinz Nixdorf Institute (University of Paderborn) and Fraunhofer IEM.\n\nPhASAR was initially developed by Philipp Dominik Schubert (@pdschubert)(\u003cphilipp.schubert@upb.de\u003e).\n\nCurrently, PhASAR is maintained by\n- Fabian Schiebel (@fabianbs96)(\u003cfabian.schiebel@iem.fraunhofer.de\u003e)\n- Sriteja Kummita (@sritejakv)\n- Lucas Briese (@jusito)\n- Martin Mory (@MMory)(\u003cmartin.mory@upb.de\u003e)\n- *others*\n\n## Required Version of the C++ Standard\n\nPhASAR requires at least C++-17.\n\nHowever, building in C++20 mode is supported. You may enable this setting the cmake variable `CMAKE_CXX_STANDARD` to `20`.\nAlthough phasar currently does not make use of C++-20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 ealier.\n\n## Currently Supported Version of LLVM\n\nPhASAR is currently set up to support LLVM-15.0.*\n\n## What is PhASAR?\n\nPhASAR is a LLVM-based static analysis framework written in C++. It allows users\nto specify arbitrary data-flow problems which are then solved in a\nfully-automated manner on the specified LLVM IR target code. Computing points-to\ninformation, call-graph(s), etc. is done by the framework, thus you can focus on\nwhat matters.\n\n## Breaking Changes\n\nTo keep PhASAR in a state that it is well suited for state-of-the-art research in static analysis, as well as for productive use, we have to make breaking changes. Please refer to [Breaking Changes](./BreakingChanges.md) for detailed information on what was broken recently and how to migrate.\n\n## How do I get started with PhASAR?\n\nWe have some documentation on PhASAR in our [***Wiki***](https://github.com/secure-software-engineering/phasar/wiki). You probably would like to read\nthis README first.\n\u003c!-- and then have a look on the material provided on \u003chttps://phasar.org/\u003e\nas well. --\u003e\nPlease also have a look on PhASAR's project directory and notice the project directory `examples/` as well as the custom tool `tools/example-tool/myphasartool.cpp`.\n\n## Building PhASAR\n\nIt is recommended to compile PhASAR yourself in order to get the full C++ experience and to have full control over the build mode.\nHowever, you may also want to try out one of the pre-built versions of PhASAR or the Docker container.\n\nAs a shortcut for the very first PhASAR build on your system, you can use our [bootstrap](./bootstrap.sh) script.\nPlease note that you must have python installed for the script to work properly.\n\n```bash\n./bootstrap.sh\n```\n\nNote: If you want to do changes within PhASAR, it is recommended to build it in Debug mode:\n\n```bash\n./bootstrap.sh -DCMAKE_BUILD_TYPE=Debug\n```\n\nThe bootstrap script may ask for superuser permissions (to install the dependencies); however it is not recommended to start the whole script with `sudo`.\n\nFor subsequent builds, see [Compiling PhASAR](#compiling-phasar-if-not-already-done-using-the-installation-scripts).\n\n### Compiling PhASAR (if not already done using the bootstrap script)\n\nSet the system's variables for the C and C++ compiler to clang:\n\n```bash\nexport CC=/usr/local/bin/clang\nexport CXX=/usr/local/bin/clang++\n```\n\nYou may need to adjust the paths according to your system. When you cloned PhASAR from Github you need to initialize PhASAR's submodules before building it:\n\n```bash\ngit submodule update --init\n```\n\nIf you downloaded PhASAR as a compressed release (e.g. .zip or .tar.gz) you can use the `init-submodules-release.sh` script that manually clones the required submodules:\n\n```bash\nutils/init-submodules-release.sh\n```\n\nNavigate into the PhASAR directory. The following commands will do the job and compile the PhASAR framework:\n\n```bash\nmkdir build\ncd build/\ncmake -G Ninja -DCMAKE_BUILD_TYPE=Release ..\nninja -j $(nproc) # or use a different number of cores to compile it\nsudo ninja install # only if you wish to install PhASAR system wide\n```\n\nWhen you have used the `bootstrap.sh` script to install PhASAR, the above steps are already done.\nUse them as a reference if you wish to modify PhASAR and recompile it.\n\nAfter compilation using cmake the following two binaries can be found in the build/tools directory:\n\n+ `phasar-cli` - the PhASAR command-line tool (previously called `phasar-llvm`) that provides access to analyses that are already implemented within PhASAR. Use this if you don't want to build an own tool on top of PhASAR.\n+ `myphasartool` - an example tool that shows how tools can be build on top of PhASAR\n\nPlease be careful and check if errors occur during the compilation.\n\nWhen using CMake to compile PhASAR the following optional parameters can be used:\n\n| Parameter : Type|  Effect |\n|-----------|--------|\n| **BUILD_SHARED_LIBS** : BOOL | Build shared libraries -- Not recommended anymore. You may want to use PHASAR_BUILD_DYNLIB instead (default is OFF) |\n| **PHASAR_BUILD_DYNLIB** : BOOL | Build one fat shared library (default is OFF) |\n| **CMAKE_BUILD_TYPE** : STRING | Build PhASAR in 'Debug', 'RelWithDebInfo' or 'Release' mode (default is 'Debug') |\n| **CMAKE_INSTALL_PREFIX** : PATH | Path where PhASAR will be installed if \"ninja install” is invoked or the “install” target is built (default is /usr/local/phasar) |\n| **PHASAR_CUSTOM_CONFIG_INSTALL_DIR** : PATH | If set, customizes the directory, where configuration files for PhASAR are installed (default is /usr/local/.phasar-config)|\n| **PHASAR_ENABLE_DYNAMIC_LOG** : BOOL|Makes it possible to switch the logger on and off at runtime (default is ON)|\n| **PHASAR_BUILD_DOC** : BOOL | Build PhASAR documentation (default is OFF) |\n| **PHASAR_BUILD_UNITTESTS** : BOOL | Build PhASAR unit tests (default is ON) |\n| **PHASAR_BUILD_IR** : BOOL | Build PhASAR IR (required for running the unit tests) (default is ON) |\n| **PHASAR_BUILD_OPENSSL_TS_UNITTESTS** : BOOL | Build PhASAR unit tests that require OpenSSL (default is OFF) |\n| **PHASAR_ENABLE_PAMM** : STRING | Enable the performance measurement mechanism ('Off', 'Core' or 'Full', default is Off) |\n| **PHASAR_ENABLE_PIC** : BOOL | Build Position-Independed Code (default is ON) |\n| **PHASAR_ENABLE_WARNINGS** : BOOL | Enable compiler warnings (default is ON) |\n| **CMAKE_CXX_STANDARD** : INT|Build phasar in C++17 or C++20 mode (default is 17)|\n\nYou can use these parameters either directly or modify the installer-script `bootstrap.sh`\n\n#### A Remark on Compile Time\n\nC++'s long compile times are always a pain. As shown in the above, when using cmake the compilation can easily be run in parallel, resulting in shorter compilation times. Make use of it!\n\n### Running a Test Solver\n\nTo test if everything works as expected please run the following command:\n\n`$ phasar-cli -m test/llvm_test_code/basic/module_cpp.ll -D ifds-solvertest`\n\nYou can find the `phasar-cli` tool in the build-tree under `tools/phasar-cli`.\n\nIf you obtain output other than a segmentation fault or an exception terminating the program abnormally everything works as expected.\n\n### Building PhASAR on a MacOS System\n\nDue to unfortunate updates to MacOS and the handling of C++, especially on the newer M1 processors, we can't support native development on Mac.\nThe easiest solution to develop PhASAR on a Mac right now is to use [dockers development environments](https://docs.docker.com/desktop/dev-environments/). Clone this repository as described in their documentation. Afterwards, you have to login once manually, as a root user by running `docker exec -it -u root \u003ccontainer name\u003e /bin/bash` to complete the rest of the build process as described in this readme (install submodules, run bootstrap.sh, ...).\nNow you can just attach your docker container to VS Code or any other IDE, which supports remote development.\n\n## Installation\n\nPhASAR can be installed using the installer scripts as explained in the following.\nHowever, you do not need to install PhASAR in order to use it.\n\n### Installing PhASAR on an Ubuntu System\n\nIn the following, we would like to give an complete example of how to install\nPhASAR using an Ubuntu or Unix-like system.\n\nTherefore, we provide an installation script. To install PhASAR, just navigate to the top-level\ndirectory of PhASAR and use the following command:\n\n```bash\n./bootstrap.sh --install\n```\n\nThe bootstrap script may ask for superuser permissions.\n\nDone!\n\nIf You have already built phasar, you can just invoke\n```bash\nsudo ninja install\n```\n\n## How to use PhASAR?\n\nWe recomment using phasar as a library with `cmake` or `conan`.\n\nIf you already have installed phasar, [Use-PhASAR-as-a-library](https://github.com/secure-software-engineering/phasar/wiki/Using-Phasar-as-a-Library) may be a good start.\n\nOtherwise, we recommend adding PhASAR as a git submodule to your repository.\nIn this case, just `add_subdirectory` the phasar submodule directory within your `CMakeLists.txt`.\n\nAssuming you have checked out phasar in `external/phasar`, the phasar-related cmake commands may look like this:\n\n```cmake\nadd_subdirectory(external/phasar EXCLUDE_FROM_ALL)            # Build phasar with your tool\n\n...\n\ntarget_link_libraries(yourphasartool\n    ...\n    phasar # Make your tool link against phasar\n)\n```\n\nDepending on your use of PhASAR you also may need to add LLVM to your build.\n\nFor more information please consult our [PhASAR wiki pages](https://github.com/secure-software-engineering/phasar/wiki).\n\n## How to use with Conan v2 ?\n\nTo export the recipe and dependencies execute from repo root:\n- `conan export utils/conan/llvm-core/ --version 15.0.7 --user secure-software-engineering`\n- `conan export utils/conan/clang/ --version 15.0.7 --user secure-software-engineering`\n- `conan export .`\n- View exported `conan list \"phasar/*\"`\n- [Consume the package](https://docs.conan.io/2/tutorial/consuming_packages.html)\n\nIf you just want to use phasar-cli:\n- `conan install --tool-requires phasar/... --build=missing -of .`\n- `source conanbuild.sh`\n- `phasar-cli --help`\n\n## Please help us to improve PhASAR\n\nYou are using PhASAR and would like to help us in the future? Then please\nsupport us by filling out this [web form](https://goo.gl/forms/YG6m3M7sxeUJmKyi1).\n\nBy giving us feedback you help to decide in what direction PhASAR should stride in\nthe future and give us clues about our user base. Thank you very much!\n\n### Installing PhASAR's Git pre-commit hook\n\nYou are very much welcome to contribute to the PhASAR project.\nPlease make sure that you install our pre-commit hook that ensures your commit adheres to the most important coding rules of the PhASAR project.\nFor more details please consult [Coding Conventions](https://github.com/secure-software-engineering/phasar/wiki/Coding-Conventions) and [Contributing to PhASAR](https://github.com/secure-software-engineering/phasar/wiki/Contributing-to-PhASAR).\n\nTo install the pre-commit hook, please run the following commands in PhASAR's root directory:\n\n```bash\npip install pre-commit\npre-commit install\n```\n\nThanks. And have fun with the project.\n","funding_links":[],"categories":["Starchart","C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecure-software-engineering%2Fphasar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecure-software-engineering%2Fphasar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecure-software-engineering%2Fphasar/lists"}