Skip to content
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

ogma-core: F' template mentions undefined queueSize #186

Closed
ivanperez-keera opened this issue Dec 4, 2024 · 6 comments
Closed

ogma-core: F' template mentions undefined queueSize #186

ivanperez-keera opened this issue Dec 4, 2024 · 6 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Milestone

Comments

@ivanperez-keera
Copy link
Member

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:

--- 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

Expected result

The above command compiles without errors.

Desired result

The above command compiles without errors.

Proposed solution

Modify the fprime template to use the variable QUEUE_SIZE, instead of queueSize, since the former is known to work.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Bug Admin only: Change request pertaining to error detected labels Dec 4, 2024
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the issue exists.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Dec 4, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Dec 4, 2024
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for fixing in Ogma 1.6.0.

Fix assigned to: @ivanperez-keera .

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels Dec 4, 2024
@ivanperez-keera ivanperez-keera added this to the 1.6.0 milestone Dec 4, 2024
@ivanperez-keera ivanperez-keera self-assigned this Dec 4, 2024
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels Dec 4, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Dec 4, 2024
The variable queueSize is no longer defined by default in the component
generated by fprime. This makes components generated by Ogma not compile
with the latest version of fprime.

This commit replaces the variable Default.queueSize with
Default.QUEUE_SIZE, which is defined and meant as its replacement.
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Dec 4, 2024
@ivanperez-keera
Copy link
Member Author

Implementor: Solution implemented, review requested.

@ivanperez-keera ivanperez-keera added CR:Status:Verification Admin only: Change request that is currently being verified and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels Dec 5, 2024
ivanperez-keera added a commit to ivanperez-keera/ogma that referenced this issue Dec 5, 2024
@ivanperez-keera
Copy link
Member Author

ivanperez-keera commented Dec 5, 2024

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      Compiling a specification produces an fprime component and dockerfile that can be further compiled successfully:
      --- 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"
      
      --- Dockerfile
      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):
      $ docker run -v $PWD/fprime_demo/:/fprime_demo -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=88441c03167696ac0f078b3bcaf995459a76cd67" -it ogma-verify-186
      $ cd fprime_demo
      $ docker build -t ogma-verify-186-fprime -f Dockerfile .
      
  • Implementation is documented. Details:
    No updates needed.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed.
  • Required version bumps are evaluated. Details:
    Bump needed; change requires newer version of fprime.

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Verification Admin only: Change request that is currently being verified labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Bug Admin only: Change request pertaining to error detected
Projects
None yet
Development

No branches or pull requests

1 participant