Current project: Modified Stargen (a solar system generator)

Post requests, images, descriptions and reports about work in progress here.
Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 8 months
Location: NY, USA

Post #61by selden » 01.06.2020, 14:00

There should be a file in "CMake Files" named "CMakeOutput.log" which should contain a history of what cmake did.

FWIW, I used the command-line version of cmake, which put the stargen executable in the current default directory. In my case, that was stargen-master/build

Note that stargen actually starts with an lower-case s. Also, under Linux, it might not have any filetype extension at all.

Added after 16 minutes 37 seconds:
I suspect you need to type the make command yourself.

I just now ran cmake-gui on Windows under Cygwin. All it did was create the Makefile for stargen. It did not run make, so it did not build stargen.
Selden

Avatar
Tegmine
Posts: 200
Joined: 20.03.2011
With us: 13 years 1 month

Post #62by Tegmine » 01.06.2020, 22:56

I keep getting this, regardless of what folder I open in a terminal:

Code: Select all

make: *** No targets specified and no makefile found.  Stop.



-M-

Added after 1 minute 2 seconds:
Of course, all I have been entering is "cmake"....no clue what to type after that...if anything. The instructions don't really say.

-M-

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 8 months
Location: NY, USA

Post #63by selden » 02.06.2020, 00:23

The critical sequence of four words in three commands is deceptively simple:

Code: Select all

cd build
cmake ..
make

(Note the space and two dots after the command cmake, which you didn't mention.)

Below are the gory details of the procedure that I followed. I've included a few samples of the output that cmake and make generated along the way. I hope this helps.

1. Restore the stargen zip file to a convenient location on your computer
(perhaps to your default login directory.) It'll create the directory "stargen-master" containing many files and directories.

2. cd to the directory "stargen-master"

3. Use your favorite text editor (I used emacs) to insert into the file "CMakeLists.txt" the line

Code: Select all

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive ")

just ahead of the line

Code: Select all

install(TARGETS stargen RUNTIME DESTINATION bin)


4. Exit from the editor, writing the new version of "CMakeLists.txt"

5. You can use the command "tail" to verify that "CMakeLists.txt" contains what it should:

Code: Select all

tail CMakeLists.txt

tail types out lines from the end of a file. Here's what I see:

Code: Select all

$ tail CMakeLists.txt
set(LIBS ${LIBS} ${GSL_LIBRARIES})

add_executable(stargen accrete.cpp andromeda.cpp andromeda2.c display.cpp dole.cpp elements.cpp enviro.cpp gas_radius_helpers.cpp ic3094.cpp ic3094_2.c jimb.cpp main.cpp omega_galaxy.cpp omega_galaxy2.c Planetary_Habitability_Laboratory.cpp planets.cpp radius_tables.cpp ring_universe.cpp ring_universe2.c solid_radius_helpers.cpp solstation.cpp stargen.cpp star_temps.cpp star_trek.cpp structs.cpp utils.cpp)

target_link_libraries(stargen ${LIBS})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive ")

install(TARGETS stargen RUNTIME DESTINATION bin)
install(DIRECTORY html ref DESTINATION bin)


6. Type the command

Code: Select all

cd build

That tells bash to move you to the directory named build (i.e. to cause "stargen-master/build" to become your current default directory)

7. Type the command

Code: Select all

cmake ..

Note that cmake is followed by a space and two dots. You didn't mention them in what you wrote above. I dunno if you might have omitted them when you typed the command.

Those two dots tell cmake to look in the next superior directory, that is, to follow the instructions that it finds in the file "../CMakeLists.txt" (i.e. in the file "stargen-master/CMakeLists.txt")
to construct the file "Makefile" in the current directory (i.e. it will create the file "stargen-master/build/Makefile")
cmake will type some informative messages as it works.

Code: Select all

$ cmake ..
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
[... lots more stuff...]
-- Configuring done
-- Generating done
-- Build files have been written to: /cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build

The path that cmake has written to will be different on your computer, of course, although it should end with "stargen-master/build"

8. When cmake finishes, you can again use the command "tail" to verify that "Makefile" contains what it should:

Code: Select all

tail Makefile

The typeout should be

Code: Select all

$ tail Makefile
#=============================================================================
# Special targets to cleanup operation of make.

# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
        $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system


9. Type the command

Code: Select all

make

That tells the program make to follow the instructions that it finds in the file "Makefile" which is in the current default directory (i.e. in the directory "stargen-master/build" to create the program stargen, also in the current default directory.
make and the programs that it runs will type some informative messages, including a plenitude of errors and warnings.

Be patient. It takes a while. The output of make should start with something like the following, although here it's showing my directory structure:

Code: Select all

make[1]: Entering directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'
make[2]: Entering directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'
make[2]: Leaving directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'
make[2]: Entering directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'
[  3%] Building CXX object CMakeFiles/stargen.dir/accrete.cpp.o
In file included from /cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/accrete.cpp:10:
/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/utils.h:283:6: warning: redeclaration of ‘template<class T> bool is_close(T, T, long double)’ may not have default arguments [-fpermissive]
  283 | bool is_close(T a, T b, long double percent = 1)
      |      ^~~~~~~~

followed by many more lines of output. It'll provide a percentage of progress at the start of each line which also contains the phrase "Building CXX object", e.g.

Code: Select all

[ 48%] Building CXX object CMakeFiles/stargen.dir/omega_galaxy.cpp.o


As it finishes, make should type something like this:

Code: Select all

[100%] Linking CXX executable stargen.exe
make[2]: Leaving directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'
[100%] Built target stargen
make[1]: Leaving directory '/cygdrive/c/MyPrograms/Planet/StarGen/stargen-master (2014-2020)/stargen-master/build'

although it'll show your directory structure, of course, not mine.

When make finishes, the stargen executable should be present in "stargen-master/build" along with various files that cmake had created.

10. Type the command

Code: Select all

ls -l

You should see something like this

Code: Select all

$ ls -l
total 79612
-rw-rw-r--+ 1  selden None     2423 May 31 13:28 cmake_install.cmake
-rw-rw-r--+ 1  selden None    14881 Jun  1 10:12 CMakeCache.txt
drwxrwxr-x+ 1  selden None        0 Jun  1 19:45 CMakeFiles
-rw-rw-r--+ 1  selden None    25845 Jun  1 10:33 Makefile
-rwxrwxr-x+ 1  selden None 81465783 Jun  1 19:45 stargen.exe


10. Type the command

Code: Select all

./stargen -?

stargen should respond with

Code: Select all

Usage: stargen [options] [system name]
  Options:
Seed values:
    -s#  Set random number seed [default: from time]
    -i#  Number to increment each random seed [default: 1]
    -n#  Specify number of systems [default: 1]
    -A#  set accretion dust density ratio_arg to # [default: 0.0]
    -q#  set accretion inner dust border to # [default: 0.3]
    -Q#  set accretion planetesimal seed eccentricity coefficient to # [default: 0.077]

followed by lots more stuff.

Does this help?
Selden

Avatar
Tegmine
Posts: 200
Joined: 20.03.2011
With us: 13 years 1 month

Post #64by Tegmine » 02.06.2020, 13:19

It was very helpful. Initially hit a glitch; the build failed. I look back at older posts in this thread and found someone who had a similar issue, so I downloaded the library necessary, tried again, and the build is done! Many thanks! Now I just have to get syntax correct on this thing...

Glad to see you're still around, Selden!

-M-

Added after 55 minutes 53 seconds:
....all I'm getting is

Code: Select all

Segmentation fault (core dumped)


when I type (for example)

Code: Select all

stargen -m.89 -BG4V


And I also tried the "add in a fake secondary in a really far orbit" tactic...got the same response...

-M-

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 8 months
Location: NY, USA

Post #65by selden » 02.06.2020, 15:05

Two possibilities I can think of:

1.You might not be running the copy of stargen that you think you're running, since your stargen command does not specify where stargen is located.
2. stargen might be having problems writing its output file.

See below for details.
========
1.
Did you copy stargen to a directory which is included in your PATH or might you have an older version there? The PATH environment variable defines the list of directories which are searched automatically for programs when you don't explicitly specify a program's location. You can explicitly add "current default directory" (./) to your PATH, but doing so is a very bad practice. Strange things will happen if there is a program in your current directory which has the same name as a system program, including Malware.

If the directory where stargen is located is not in your PATH, then you must explicitly specify its directory. If stargen is located in your current default directory, then you must specify the ./ prefix (i.e. tell bash that it's located in your current default directory). For example:

Code: Select all

./stargen -m.89 -BG4V


This (./) command works fine for me to run Omega13'a's version of stargen.

On my computer, I have my own version of stargen in /usr/local/bin, which is in my PATH. My version of stargen doesn't recognize the -BG4V qualifier, although it complains and doesn't crash.

****************
Edited to add:

You can type the command

Code: Select all

which stargen

to find out what program is actually being run when you type the command "stargen" without the ./ prefix
****************

========
2.
I'm wondering if stargen is having problems writing its output file on your computer.
Check to make sure the sub-directory "html" exists in your current default directory and that you can create files in it.

Since the command above does not explicitly specify where to put stargen's output, stargen also requires that there be a directory named "html" (without the quotes) within the current default directory. That's where stargen will try to write its output file(s). Under Widows, stargen doesn't complain when no such directory exists, but it doesn't create an output file, either. Perhaps stargen's Linux I/O code doesn't handle I/O problems correctly.
Selden

Avatar
Tegmine
Posts: 200
Joined: 20.03.2011
With us: 13 years 1 month

Post #66by Tegmine » 03.06.2020, 13:07

I have read that Omega's version is [u]very[u] particular about how commands are entered. For example, if I enter this (after cd to appropriate directory):

Code: Select all

~/New Programs/stargen-master/build$ ./stargen -m1.04


I get:

Code: Select all

Unsupported star type: ????V


Type this:

Code: Select all

./stargen -m1.04 -BG1V


I get this:

Code: Select all

Segmentation fault (core dumped)


HOWEVER, I typed this (not paying attention):

Code: Select all

 ./stargen -m1.04 -G1V


and it created a .csv file in the html folder for the star.
Maybe I'm not specifying my output?

-M-

Avatar
selden
Developer
Posts: 10190
Joined: 04.09.2002
With us: 21 years 8 months
Location: NY, USA

Post #67by selden » 03.06.2020, 13:20

I dunno if the errors would be affected by providing an output file spec, but you probably should give that a try instead of just going with the defaults. Certainly something is causing confusion, though, since the default output is supposed to be html, not csv. See below.

The output file formats are listed near the end of stargen's on-screen output when you specify

Code: Select all

./stargen -?

where it says

Code: Select all

Output formats: (only one is generated)
(default) HTML to file
    -c   Celestia .ssc to stdout
    -C   Excel .csv [dl: no thumbnail html] to file
    -e   Excel .csv to file
    -S   Vector graphics (SVG) to file
    -t   Text to stdout
    -sn# Number of decimal places for numbers
Selden

Avatar
PlutonianEmpire M
Posts: 1374
Joined: 09.09.2004
Age: 39
With us: 19 years 8 months
Location: MinneSNOWta
Contact:

Post #68by PlutonianEmpire » 21.11.2020, 08:02

Tegmine, have you made any extra progress on this since the last post?

(Sorry for my late reply)
Terraformed Pluto: Now with New Horizons maps! :D


Return to “Add-on development”