Open Jonas231 opened 3 years ago
Hello, I tried to build Koko on windows using https://www.msys2.org. At first I used this tutorial: https://iraspa.org/blog/visual-studio-code-c-cpp-fortran-with-multiple-source-files/ After this worked I used CodeRunner on the makefile you provided.
I got this error (in ): And this one:
I also got errors of this kind: I fixed those by deleting one 3.
I got this error: So I had to add:
And I finally I get this output:
C:\msys64\mingw64\bin\ar.exe: creating liblinenoise.a
mv liblinenoise.a ../lib
make[2]: Verzeichnis „/c/Users/herbst/projects/Koko/Src/linenoise“ wird verlassen
gfortran -o koko-cli koko.o cmder.o names.o libload.o saverest.o -L./lib -static -Wl,--start-group -lkmath -lldm -lconfig -lhardware -lmacro -loptimize -lparaxial -lpickup -lraytrace -lspecsurf -lnonseq -lutility -lwavespot -lglass -lplotcad -llinenoise -lkmod -Wl,--end-group -lm -lstdc++ -lregex
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../lib\libregex.a(systre.o):(.text+0x1): undefined reference to tre_regcomp' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../lib\libregex.a(systre.o):(.text+0x11): undefined reference to
tre_regfree'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../lib\libregex.a(systre.o):(.text+0x21): undefined reference to tre_regerror' C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../lib\libregex.a(systre.o):(.text+0x31): undefined reference to
tre_regexec'
collect2.exe: error: ld returned 1 exit status
make[1]: [Makefile:60: koko-cli] Fehler 1
make[1]: Verzeichnis „/c/Users/herbst/projects/Koko/Src“ wird verlassen
make: [Makefile:31: all] Fehler 2
Do you have an idea why this is the case? Best regards, Jonas
Thank you for your interests.
I don’t know porting to windows 64 but but I think you need tre library for windows.
http://gnuwin32.sourceforge.net/packages/tre.htm
I also think you need “gnuwin64” library, but it is not exist.
Hello, thank you very much for your answer. I installed tre using the installer, however the error message remains the same. What do you mean by "I also think you need “gnuwin64” library, but it is not exist."? Any help on how to solve the problem on windows would be very appreciated. I assume you build koko for windows from Linux?
In this case I could also switch to Linux, however I have some optical design programs I would like to compare with (e.g. ZEMAX, OpTaliX which only run on Windows).
My plan is this one (however I have zero experience with fortran):
I. I would like to add a vtk-based 3D optical layout plot as an option in your gui. Basically an upgrade to your gnuplot VIE. Also I am thinking about making it in a way that it is a windows always open in the background but only updated on demand (update button). Steps:
II. Add some comment for https://sphinx-fortran.readthedocs.io/en/latest/ This would allow to get a better overview of the original "Src" by Mr. Klein.
I know these are very ambitious goals and will take a while but would be very useful.
Best regards, Jonas
Thank you for your reply.
I think you try to compile 64 bit enviorent.
compilation for Koko needs gnu tool( gnuwin32) kit and MSYS but any 64bit gnuwin64 tool kit not available now.
you need compile pre library as 64 bit library.
You should use WSL2 on Windows, It gave Linux environment on Windows.
Did you tried my 32bit windows binary ?
Thank you. I will try to compile a 32 bit version. I tried your 32 bit binary. The KODS gui starts however "VIE" does not work. Adding a surface "Edit > Insert surface" makes the gui crashing... . The default CURLENS Lenstext.dat is the Cook Tripet which should be shown, right? LensView > XZ or ortho does not show anything. Your LINUX version worked.
Sorry for inconvenience.
Please try CUI version koko and install gnuplot for windows.
What is CUI?
Try Koko-cli.exe
Hi,
I tried Koko-cli on two pcs with windows 10. The one with admin rights could open the cli. The one without not. Okay. Nice to know so I do not need the qt gui and I could basically do everything from koko-cli.exe including plotting with gnuplot?!
It would also be very helpful for me if you could provide some explanation in which source file (module) exactly the surface coordinates, sags, apertures (i.e. everything which defines an optical surface) and the layout rays are converted to something which gnuplot can plot. Then I could write something similar for vtk plotting and a command like "VTK" instead of "VIE".
Best regards, Jonas
you will see gnuplot folder in KODS folder. The gnuplot folder has plotting data corresponding to color data.
All plotting done by gnuplot.f in gnuplot folder among source files. You will see the functions which corresponding colors.
Okay. Thank you. I will check this out: https://github.com/dinosauria123/Koko/blob/master/Src/plotcad/gnuplot.f
Or more exactly what I am looking for are the KDP/Koko data arrays (names of fortran arrays and module names) wherein the data to be plotted is stored.
I try to remenber memories of several years ago... please wait.
I rebuild koko-gui.exe to work with koko-cli.exe. Place koko folder on your desktop and edit .kokorc PATH to fit your username.
https://github.com/dinosauria123/Koko/releases/download/untagged-1ad8ab22029e39255c87/koko.zip
the KDP/Koko data arrays (names of fortran arrays and module names)
Check "P1ARAY" array. IK is a surface number and other index are flags for plot data or not and plot colors.
Thank you. The link you provided for the new "koko.zip" does not work. I will check the array or some similar name...
Sorry for inconvinience. Check koko.zip on this page.
https://github.com/dinosauria123/Koko/releases/tag/20220129-win32-test
I try to compile koko-cli on MSYS64 mingw-w64-x86_64-toolchain. I found linking error caused by missing regex library.
I build regex library for MSYS64 env and it is possible to build koko-cli.exe.
My regex librery atteched below. copy your home dir and "make install" will copy needed libraries regex-2.7-src.zip .
I checked out the most important arrays that I would have to access from C++ in order to do a 3D layout plot with vtk:
The ALENS(J,SURF#) array holds all the surface dependent lens database information. Not strictly necessary to access that one (but useful).
The VERTEX(I,SURF) array stores the homogenous transformation matrix of each surface!
The SURPRO(N,Q,I) array WHERE C Q=1:3(X,Y AND Z GLOBAL COORDINATES,I=0:MAXSUR, AND N = TOTAL NUMBER OF DATA POINTS IN THE PROFILE=360
The EDGE array containing surface edge data
The RAYRAY array which contains the 3d layout ray data.
Maybe you have some experience how to make these arrays accessable from C++? Another approach would be to write a vtk file with a Fortran routine (perhaps VTKFortran) and read this file with C++, python or any other language that supports vtk.
Maybe you have some experience how to make these arrays accessable from C++?
No, I am not.
linenoise library use C++ and F90. It was written by Ulf Grissmann. I think his source is something help you.
Hello, I wondered if you could provide some kind of guide here on how to build koko in linux (and windows) here.
Why I am asking: I looked into the macro language of KDP-2 a little bit, which is very similar to the one of ACCOS V. See for instance: https://spie.org/Publications/Proceedings/Paper/10.1117/12.933359?SSO=1 I wanted to implement a linear fit with the macro language to describe distorted images of non-centered optical systems. I think this is more complicated than doing it in fortran. If I knew how to build Koko I could add an operand / command which does this (I would share it of course).
Do you think it is possible to provide this guide, here?
Another related issue: Where in the program source code would you add such a command?
Kind regards, Jonas