Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-fprime-queueSize' into develop. Close #186.
**Description** The variable `queueSize` is no longer defined by default in the component generated by the `fprime` application. This makes components generated by Ogma not compile. **Type** - Bug: Ogma generates code that no longer compiles with newer versions of F'. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Run the `fprime` command with a simple monitor and variables: ```haskell --- fprime-handlers handlerMyProperty --- fprime-variable-dbs ("pullup", "bool") ("input", "float") --- fprime-variables variables --- Monitor.hs import Copilot.Compile.C99 import Copilot.Language hiding (prop) import qualified Copilot.Library.PTLTL as PTLTL import Language.Copilot (reify) import Prelude hiding (not, (/=)) input :: Stream Float input = extern "input" Nothing myProperty :: Stream Bool myProperty = PTLTL.alwaysBeen (input /= 30.0) spec :: Spec spec = do trigger "handlerMyProperty" (not myProperty) [] main :: IO () main = reify spec >>= compile "copilot" ``` Commands ``` $ runhaskell Monitor.hs $ ogma fprime --app-target-dir fprime_demo --variable-file fprime-variables --handlers-file fprime-handlers --variable-db fprime-variable-db $ mv copilot* fprime_demo/ $ cd fprime_demo/ $ docker build -t copilot-fprime-test . ... omitted for brevity ... [ 94%] Generating Ports_RateGroupsEnumAi.xml, Ports_StaticMemoryEnumAi.xml, RefTopologyAppAi.xml [ 94%] Generating FppConstantsAc.cpp, FppConstantsAc.hpp, Ports_RateGroupsEnumAc.cpp, Ports_RateGroupsEnumAc.hpp, Ports_StaticMemoryEnumAc.cpp, Ports_StaticMemoryEnumAc.hpp, RefTopologyAc.cpp, RefTopologyAc.hpp [ 94%] Generating RefTopologyDictionary.json fpp-to-cpp /fprime/Ref/Top/instances.fpp:136.24 queue size Default.queueSize ^ error: undefined symbol queueSize make[3]: *** [Ref/Top/CMakeFiles/Ref_Top.dir/build.make:186: Ref/Top/FppConstantsAc.cpp] Error 1 make[3]: *** Waiting for unfinished jobs.... fpp-to-xml /fprime/Ref/Top/instances.fpp:136.24 queue size Default.queueSize ^ error: undefined symbol queueSize make[3]: *** [Ref/Top/CMakeFiles/Ref_Top.dir/build.make:119: Ref/Top/Ports_RateGroupsEnumAi.xml] Error 1 fpp-to-dict /fprime/Ref/Top/instances.fpp:136.24 queue size Default.queueSize ^ error: undefined symbol queueSize make[2]: *** [CMakeFiles/Makefile2:8004: Ref/Top/CMakeFiles/Ref_Top.dir/all] Error 2 make[1]: *** [CMakeFiles/Makefile2:2677: CMakeFiles/Ref.dir/rule] Error 2 make: *** [Makefile:190: Ref] Error 2 [ERROR] CMake erred with return code 2 The command '/bin/sh -c fprime-util build --jobs "$(nproc || printf '%s\n' 1)"' returned a non-zero code: 1 ``` Running the following dockerfile with the auxiliary files above produces an F' component and accompaying Dockerfile that compile successfully: ``` FROM ubuntu:trusty ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install --yes software-properties-common RUN add-apt-repository ppa:hvr/ghc RUN apt-get update RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4 RUN apt-get install --yes libz-dev ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH RUN cabal update RUN cabal v1-sandbox init RUN cabal v1-install alex happy RUN apt-get install --yes git ADD fprime-variables /tmp/fprime-variables ADD fprime-handlers /tmp/fprime-handlers ADD fprime-variable-dbs /tmp/fprime-variable-dbs ADD Monitor.hs /tmp/Monitor.hs CMD git clone $REPO && \ cd $NAME && \ git checkout $COMMIT && \ cd .. && \ cabal v1-sandbox init && \ cabal v1-install copilot $NAME/$PAT**/ \ --constraint="aeson>=2.0.3.0" \ --constraint="copilot>=4.1" \ --constraint="copilot-core>=4.1" \ --constraint="copilot-language>=4.1" \ --constraint="copilot-theorem>=4.1" \ --constraint="copilot-c99>=4.1" \ --constraint="copilot-interpreter>=4.1" \ --constraint="copilot-prettyprinter>=4.1" \ && \ ./.cabal-sandbox/bin/ogma fprime --app-target-dir fprime_demo --variable-file /tmp/fprime-variables --handlers-file /tmp/fprime-handlers --variable-db /tmp/fprime-variable-dbs && \ cabal v1-exec -- runhaskell /tmp/Monitor.hs && \ mv copilot* fprime_demo/ ``` Command (substitute variables based on new path after merge): ```sh $ docker run -v $PWD/fprime_demo/:/fprime_demo -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=<HASH>" -it ogma-verify-186 $ cd fprime_demo $ docker build -t ogma-verify-186-fprime -f Dockerfile . ``` **Expected result** Building and running the above image, and further building the resulting F' component, completes the compilation process without producing any errors. **Solution implemented** Modify the fprime template to use the variable `QUEUE_SIZE`, instead of `queueSize`, since the former is known to work. **Further notes** None.
- Loading branch information