Giter VIP home page Giter VIP logo

Comments (4)

seanmcleod avatar seanmcleod commented on July 19, 2024

I would like to know if it's possible to port JSBSim on Android?

Don't see any reason it can't be. JSBSim doesn't make use of any esoteric OS APIs/features, mostly plain old C++.

from jsbsim.

demonixis avatar demonixis commented on July 19, 2024

Hello,
i think the cmake file have to be updated to call the NDK (Android Native development kit) to produce a libJSBSim.a.

from jsbsim.

bcoconni avatar bcoconni commented on July 19, 2024

Hello, i think the cmake file have to be updated to call the NDK (Android Native development kit) to produce a libJSBSim.a.

According to the Android developer docs, I understand that our CMake files can be used unchanged provided that you pass some requested arguments

$ cmake \
    -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=$ABI \
    -DANDROID_PLATFORM=android-$MINSDKVERSION \
    $OTHER_ARGS

It does not seem that the CMake files for JSBSim need to be modified, do they ?

from jsbsim.

demonixis avatar demonixis commented on July 19, 2024

Hello,
Thank you for the command line, I tried it and it's promising but generates some errors.

Here is the command line

cmake .. \
    -DCMAKE_TOOLCHAIN_FILE=/Users/yann/Library/Android/sdk/ndk/23.2.8568313/build/cmake/android.toolchain.cmake \
    -DANDROID_ABI=arm64-v8a \
    -DANDROID_PLATFORM=android-16

And the errors

 21%] Building CXX object src/math/CMakeFiles/Math.dir/FGRealValue.cpp.o
In file included from /Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:57:
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:22: error: field has incomplete type 'struct sockaddr_in'
  struct sockaddr_in scktName;
                     ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:143:15: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in'
    int len = sizeof(struct sockaddr_in);
              ^     ~~~~~~~~~~~~~~~~~~~~
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:145:25: error: use of undeclared identifier 'htons'
    scktName.sin_port = htons(port);
                        ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:177:40: error: use of undeclared identifier 'IPPROTO_UDP'
    sckt = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
                                       ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:196:26: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in'
    memset(&scktName, 0, sizeof(struct sockaddr_in));
                         ^     ~~~~~~~~~~~~~~~~~~~~
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:198:25: error: use of undeclared identifier 'htons'
    scktName.sin_port = htons(port);
                        ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:201:40: error: use of undeclared identifier 'INADDR_ANY'
      scktName.sin_addr.s_addr = htonl(INADDR_ANY);
                                       ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:203:21: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in'
    socklen_t len = sizeof(struct sockaddr_in);
                    ^     ~~~~~~~~~~~~~~~~~~~~
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.cpp:248:19: error: invalid application of 'sizeof' to an incomplete type 'struct sockaddr_in'
  socklen_t len = sizeof(struct sockaddr_in);
                  ^     ~~~~~~~~~~~~~~~~~~~~
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
9 errors generated.

And this one

[ 34%] Building CXX object src/models/CMakeFiles/Models.dir/FGPropulsion.cpp.o
In file included from /Users/yann/Projects/Unreal/jsbsim/src/models/FGOutput.cpp:44:
In file included from /Users/yann/Projects/Unreal/jsbsim/src/input_output/FGOutputFG.h:42:
In file included from /Users/yann/Projects/Unreal/jsbsim/src/input_output/FGOutputSocket.h:43:
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:22: error: field has incomplete type 'struct sockaddr_in'
  struct sockaddr_in scktName;
                     ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
[ 34%] Built target Math
1 error generated.
make[2]: *** [src/models/CMakeFiles/Models.dir/FGOutput.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 35%] Building CXX object src/models/CMakeFiles/Models.dir/FGInput.cpp.o
In file included from /Users/yann/Projects/Unreal/jsbsim/src/models/FGInput.cpp:43:
In file included from /Users/yann/Projects/Unreal/jsbsim/src/input_output/FGUDPInputSocket.h:41:
In file included from /Users/yann/Projects/Unreal/jsbsim/src/input_output/FGInputSocket.h:42:
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:22: error: field has incomplete type 'struct sockaddr_in'
  struct sockaddr_in scktName;
                     ^
/Users/yann/Projects/Unreal/jsbsim/src/input_output/FGfdmSocket.h:102:10: note: forward declaration of 'JSBSim::sockaddr_in'
  struct sockaddr_in scktName;
         ^
1 error generated.

I'll take more time later today to see what can I do.

from jsbsim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.