sisl / SOFA.jl

Unofficial wrapper of the IAU SOFA C libraries for fundamental astronomy.
Other
10 stars 1 forks source link

Can't add SatelliteDynamics.jl because it can't build SOFA.jl #4

Open benjjensen opened 3 years ago

benjjensen commented 3 years ago

I am having a problem downloading the SatelliteDynamics.jl package because of a problem with SOFA.jl. I am using Julia 1.5.3 on Windows 10. I started with a clean install of Julia and have nothing else in the environment. The error that I get is pasted below.

Building SOFA → C:\Users\benjj\.julia\packages\SOFA\kZlWv\deps\build.log ┌ Error: Error building SOFA: │ ERROR: LoadError: None of the selected providers could satisfy library group SOFA │ Use BinDeps.debug(package_name) to see available providers │
│ Stacktrace:
│ [1] error(::String) at .\error.jl:33
│ [2] satisfy!(::BinDeps.LibraryGroup, ::Array{DataType,1}) at C:\Users\benjj.julia\packages\BinDeps\ZEval\src\dependencies.jl:915 │ [3] satisfy!(::BinDeps.LibraryGroup) at C:\Users\benjj.julia\packages\BinDeps\ZEval\src\dependencies.jl:874
│ [4] top-level scope at C:\Users\benjj.julia\packages\BinDeps\ZEval\src\dependencies.jl:977
│ [5] include(::String) at .\client.jl:457
│ [6] top-level scope at none:5
│ in expression starting at C:\Users\benjj.julia\packages\SOFA\kZlWv\deps\build.jl:27
└ @ Pkg.Operations C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:949

duncaneddy commented 3 years ago

This is because there isn't a build process for the underlying SOFA C library on windows. SOFA.jl is really just a light wrapper on the underlying SOFA C library

The package uses BinDeps.jl to simply call the build GNU makefile provided with the SOFA C library here. This makefile works on Linux/Mac, but not on windows.

If you can setup your environment using the Windows Subsystem for Linux the package should build in that environment.

I'm happy to accept a PR for windows-compatible build process, though ideally that would happen upstream in the underlying SOFA C-library so all wrapper projects can benefit from it.

dhartmanBH commented 1 year ago

Per the suggestion about the error in building SOFA , I moved to install WSL. However, now that I have WSL running, I get the following new error when trying to call Pkg.build("SOFA")

Building SOFA → ~/.julia/packages/SOFA/AEhle/deps/build.log ┌ Error: Error building SOFA: │ [ Info: Attempting to create directory /home/davidhartman/.julia/packages/SOFA/AEhle/deps/usr │ [ Info: Directory /home/davidhartman/.julia/packages/SOFA/AEhle/deps/usr already exists │ [ Info: Attempting to create directory /home/davidhartman/.julia/packages/SOFA/AEhle/deps/usr/lib │ [ Info: Directory /home/davidhartman/.julia/packages/SOFA/AEhle/deps/usr/lib already exists │ [ Info: Changing directory to /home/davidhartman/.julia/packages/SOFA/AEhle/deps/src/sofa │ ERROR: LoadError: IOError: could not spawn make clean: not a directory (ENOTDIR) │ Stacktrace: │ [1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at ./process.jl:99 │ [2] #585 at ./process.jl:112 [inlined] │ [3] setup_stdios(::Base.var"#585#586"{Cmd}, ::Array{Any,1}) at ./process.jl:196 │ [4] _spawn at ./process.jl:111 [inlined] │ [5] run(::Cmd; wait::Bool) at ./process.jl:439 │ [6] run(::Cmd) at ./process.jl:438 │ [7] run(::BinDeps.SynchronousStepCollection) at /home/davidhartman/.julia/packages/BinDeps/5xsHU/src/BinDeps.jl:524 (repeats 2 times) │ [8] satisfy!(::BinDeps.LibraryDependency, ::Array{DataType,1}) at /home/davidhartman/.julia/packages/BinDeps/5xsHU/src/dependencies.jl:951 │ [9] satisfy!(::BinDeps.LibraryGroup, ::Array{DataType,1}) at /home/davidhartman/.julia/packages/BinDeps/5xsHU/src/dependencies.jl:917 │ [10] satisfy!(::BinDeps.LibraryGroup) at /home/davidhartman/.julia/packages/BinDeps/5xsHU/src/dependencies.jl:881 │ [11] top-level scope at /home/davidhartman/.julia/packages/BinDeps/5xsHU/src/dependencies.jl:984 │ [12] include(::String) at ./client.jl:457 │ [13] top-level scope at none:5 │ in expression starting at /home/davidhartman/.julia/packages/SOFA/AEhle/deps/build.jl:27

Any suggestions?

duncaneddy commented 1 year ago

Hmm..... not really.

The error is this line ERROR: LoadError: IOError: could not spawn make clean: not a directory (ENOTDIR). Which is occurring during trying compile the C code into the library.

What the package is doing is trying to compile the underlying C code stored in deps/src/sofa using the makefile contains in that directory. It does this by first changing the directory to the local package directory /home/davidhartman/.julia/packages/SOFA/AEhle/deps/src/sofa then starting the build process contained in https://github.com/sisl/SOFA.jl/blob/master/deps/build.jl with the command make clean.

However for some reason on WSL instead of working this is returning the error above claiming it isn't a directory. That I don't know why. What you could do to try to debug is to try to run the command account and see which directory the command failed in (in this case /home/davidhartman/.julia/packages/SOFA/AEhle/deps/src/sofa then manually navigate to that directory and try to debug it by manually trying to sequentially run the commands here: https://github.com/sisl/SOFA.jl/blob/master/deps/build.jl#L18

Possible causes of the error include:

  1. Permissions: The WSL environment may have insufficient permissions to access or execute the make clean command or the associated files. Ensure that you have appropriate read, write, and execute permissions for the relevant directories and files.
  2. Missing dependencies: The make command relies on other tools and dependencies to execute properly. If any of these dependencies are missing or not properly installed in the WSL environment, it can result in the "not a directory" error. Make sure you have the necessary build tools and libraries installed in your WSL setup.
PatrickeTownsend commented 1 year ago

Hello! I had the same problem after configuring WSL in VScode, I was able to fix it by installing gcc through the console with this command: sudo apt install build-essential After that everything works properly Hope it helps