Skip to content

Commit

Permalink
Release Cosmopolitan 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Sep 20, 2022
1 parent 6cc9e08 commit 8c2bf34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ If you're doing your development work on Linux or BSD then you need just
five files to get started. Here's what you do on Linux:

```sh
wget https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.0.1.zip
unzip cosmopolitan-amalgamation-2.0.1.zip
wget https://justine.lol/cosmopolitan/cosmopolitan-amalgamation-2.1.zip
unzip cosmopolitan-amalgamation-2.1.zip
printf 'main() { printf("hello world\\n"); }\n' >hello.c
gcc -g -Os -static -nostdlib -nostdinc -fno-pie -no-pie -mno-red-zone \
-fno-omit-frame-pointer -pg -mnop-mcount -mno-tls-direct-seg-refs -gdwarf-4 \
Expand Down

6 comments on commit 8c2bf34

@mingodad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a comment here #601 (comment) about the need/usage of -pg on the readme and other examples.
There is any need to compile with profiling (-pg) ?

@mingodad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also after you've recommended to look at cosmocc/cosmo++ here #601 (comment) I looked at it and found some typos there.
There is several repetitions of the prefix /opt/cosmo and also what probably is a typo /opt/cosmos.
For my tests I replaced all of the prefixes with a variable that can be overwritten in one place:

COSMOH=$HOME/dev/c/A_programming-languages/cosmopolitan

CC="$COSMOH/o/third_party/gcc/bin/x86_64-linux-musl-gcc"
CFLAGS="-O2 -fno-omit-frame-pointer -fdata-sections -ffunction-sections -fno-pie -mnop-mcount -mno-tls-direct-seg-refs"
CPPFLAGS="-DNDEBUG -nostdinc -iquote $COSMOH -isystem $COSMOH/include -isystem $COSMOH/libc/isystem"
LDFLAGS="-static -no-pie -nostdlib -fuse-ld=bfd -Wl,--gc-sections -L$COSMOH/lib -Wl,-T,$COSMOH/o/ape/public/ape.lds $COSMOH/o/ape/ape-no-modify-self.o $COSMOH/o/libc/crt/crt.o"
LDLIBS="$COSMOH/o/cosmopolitan.a"

@mingodad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I asked/suggested here #601 (comment) to have STATIC_STACK_SIZE(0xXXXX); to be mentioned everywhere a cosmopolitan build is mentioned because it seem to be crucial to a successful build of third party applications with cosmopolitan like I discovered after several try and error attempts here #601 .

@jart
Copy link
Owner Author

@jart jart commented on 8c2bf34 Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. /opt/cosmos is not a typo. It's assumed that you'll use ./configure --prefix=/opt/cosmos when configuring open source projects. In that case, /opt/cosmos becomes your own personal distro.
  2. You need to use -pg if you want --ftrace to support. Read https://justine.lol/ftrace/ and note that this has nearly zero overhead if you can use a flag like -mnop-mcount which causes a NOP to be inserted in the prologue of functions.
  3. We're now using an 8mb stack by default for open source builds now I think. So STATIC_STACK_SIZE(0xXXXX) shouldn't be as necessary anymore.

@mingodad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for reply !
And sorry for not know that the info about some aspects of cosmopolitan is already documented.
Cheers !

@mingodad
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About the STATIC_STACK_SIZE(0xXXXX) I still think that it's relevant because as pointed here #601 (comment) when compiling several versions of Lua and trying to execute some tests for my surprise each version required a different value to pass the tests (using the latest cosmopolitan build without STATIC_STACK_SIZE(0xXXXX) they all segfault when trying to execute the tests see the source to reproduce here https://github.com/jart/cosmopolitan/files/9534950/am-lua-all.zip).

$date
mié sep 21 10:02:11 CEST 2022
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Please sign in to comment.