Compile orekit python wrapper on windows

Hi all, I tried to compile orekit python wrapper on windows.
After installing java (1.8), microsoft visual C ++, JCC (3.13), I ran the following command:

python -m jcc
–use_full_names
–python orekit
–version 12.dev0
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/orekit-12.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-core-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-fitting-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-filtering-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-geometry-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-ode-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-optim-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/hipparchus-stat-3.0-SNAPSHOT.jar
–jar C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/rugged-3.0.jar
–package java.io
–package java.util
–package java.text
–package org.orekit
–package org.orekit.rugged
java.io.BufferedReader
java.io.FileInputStream
java.io.FileOutputStream
java.io.InputStream
java.io.InputStreamReader
java.io.ObjectInputStream
java.io.ObjectOutputStream
java.io.PrintStream
java.io.StringReader
java.io.StringWriter
java.lang.System
java.text.DecimalFormat
java.text.DecimalFormatSymbols
java.util.ArrayDeque
java.util.ArrayList
java.util.Arrays
java.util.Collection
java.util.Collections
java.util.Date
java.util.HashMap
java.util.HashSet
java.util.List
java.util.Locale
java.util.Map
java.util.Set
java.util.TreeSet
java.util.stream.Collectors
java.util.stream.Stream
java.util.stream.DoubleStream
java.util.function.LongConsumer
java.util.function.IntConsumer
java.util.function.DoubleConsumer
java.util.function.Supplier
–module C:\Users\victo\Documents\orekit_install\orekit_python_artifacts-dev/pyhelpers.py
–reserved INFINITE
–reserved ERROR
–reserved OVERFLOW
–reserved NO_DATA
–reserved NAN
–reserved min
–reserved max
–reserved mean
–reserved SNAN
–reserved get
–exclude org.hipparchus.util.RosenNumberPartitionIterator
–classpath ‘C:\Program Files\Java\jdk-8/lib/tools.jar’
–files 81
–build
–install

And I had the following error :

“C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe” /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DPYTHON -DJCC_VER=
"3.13" -D_java_generics “-IC:\Program Files\Java\jdk-20/include” “-IC:\Program Files\Java\jdk-20/include/win32” -Ibuild_orekit -IC:\Users\victo\PycharmProjects\jcc_im
port\venv\lib\site-packages\jcc\sources -IC:\Users\victo\PycharmProjects\jcc_import\venv\include -IC:\Users\victo\AppData\Local\Programs\Python\Python38\include -IC:\Use
rs\victo\AppData\Local\Programs\Python\Python38\Include “-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include” “-IC:\Progra
m Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt” “-IC:\Program Files (
x86)\Windows Kits\10\include\10.0.22621.0\um” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared” “-IC:\Program Files (x86)\Windows Kits\10\inclu
de\10.0.22621.0\winrt” “-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\cppwinrt” /EHsc /Tpbuild_orekit_init_.cpp /Fobuild\temp.win-amd64-cpython-38\Release\build_orekit_init_.obj /EHsc /D_CRT_SECURE_NO_WARNINGS
init.cpp
C:\Users\victo\PycharmProjects\jcc_import\venv\lib\site-packages\jcc\sources\JCCEnv.h(119): warning C4251: ‘JCCEnv::refs’ : class ‘std::multimap<int,countedRef,std::less,std::allocator<std::pair<const int,countedRef>>>’ nécessite une interface DLL pour être utilisé(e) par les clients de class ‘JCCEnv’
C:\Users\victo\PycharmProjects\jcc_import\venv\lib\site-packages\jcc\sources\JCCEnv.h(119): note: voir la déclaration de ‘std::multimap<int,countedRef,std::less,std::allocator<std::pair<const int,countedRef>>>’
C:\Users\victo\Documents\orekit_install\build_orekit\org/orekit/utils/units/Unit.h(102): error C2059: erreur de syntaxe : ‘;’
C:\Users\victo\Documents\orekit_install\build_orekit\org/orekit/utils/units/Unit.h(102): error C2238: jetons inattendus avant ‘;’
error: command ‘C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe’ failed with exit code 2

Note that I performed the equivalent operation on a Linux machine and it worked.

Please, would you mind give me some suggestions?

Many thanks
Victor

Hi Victor,

Compling orekit can be a bit challenging (that’s why I recommend conda packaging that locks the dependencies).

I would suggest you start with the version that is currently being build for the conda version, the artifacts are at: GitHub - petrushy/orekit_python_artifacts: Primary jar's for python orekit and make sure that that one builds.

I have not yet tried to build the 12.0 development branch. If you from the generated source figure out which classes that are generating the error you can start with --excluding them as a first step in the investigation…

Regards
Petrus

Hi Victor,
I did this a few weeks ago, starting from this script in the conda recipe. I think I had the same error, and it came from missing --reserved keywords in the build command, maybe PASCAL or PERCENT.
Clément

Hi Clement,
It was that, I added – reserved PASCAL keyword in the build command and it worked.
Thanks for your help
Victor