Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ylc compiler #1441

Merged
merged 6 commits into from
Oct 22, 2024
Merged

Add ylc compiler #1441

merged 6 commits into from
Oct 22, 2024

Conversation

Cr0a3
Copy link
Contributor

@Cr0a3 Cr0a3 commented Oct 20, 2024

Hi dear godbolt team,
I added a new compiler called ylc from my project ygen.
It is a rust package so i hope i done everything right.

DISCLAMER:
I did not test it locally because the ce_install script did not work

It's my first time to contribute to godbolt so please say everything i did wrong

Bye
Cr0a3

@Cr0a3 Cr0a3 changed the title Compilers Add ylc compiler Oct 20, 2024
fetch: https://github.com/Cr0a3/ygen/archive/refs/heads/main.zip
script: |
cd ygen-main
sudo apt install rust -y
Copy link
Member

Choose a reason for hiding this comment

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

Hi!

Sorry - but we can't do this: the system has no sudo and installing rust like this won't work across all our systems.

I replied on the feature request you opened (and then closed) - you'll probably need us to help and/or work with you to add support for building rust-based compilers like we build all our other compilers (C, C++, python, Rust itself, etc) with our misc-builder or clang-builder or ***-builder repositories.

Just copying the binary here might not work long-term: this doesn't copy any DLLs it may need too. We can help with this though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sorry, I did not think of this.
Luckily ylc does not depend on any dlls cuz it uses my own written code generation library.

Another way for builds is I could add a GitHub workflow which would build the toolchain in my main repo, release it with the commit id, which would then be downloadable (or just create a pr to misc-builder)

Copy link
Member

Choose a reason for hiding this comment

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

A PR to misc-builder means we would do the CI ourselves with infrastructure that "guarantees" it will run. But also an installable binary for an old Ubuntu would work too, or even better statically linked against MUSL to make it truly standalone.

Thanks!

Copy link
Contributor Author

@Cr0a3 Cr0a3 Oct 21, 2024

Choose a reason for hiding this comment

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

I changed it, so now it should download my pre build.
So it's now just a normal download

compilers:
ygen:
ylc:
type: ziparchive
Copy link
Member

Choose a reason for hiding this comment

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

This will download and install just once - which is probably not what you want for a "newest".

If you would like this to be installed every night , we will need an:

if: nightly

and then something to make it want to install every time. Some things have nightly as the type but I think we can add:

always_install: true

too.

When you support tagged stable releases we can revist so only the nightly gets installed this way.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks: confirmed this now works. But it will only install once. I assume that's OK as you didn't reply to the comments above.

ygen:
ylc:
type: ziparchive
fetch: https://github.com/Cr0a3/ygen/tree/build
Copy link
Member

Choose a reason for hiding this comment

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

This is missing the url: parameter. I suspect you need that. Maybe fetch should be url ?

RuntimeError: Missing required key 'url' in compilers/ygen/ylc newest

If I make that change locally then it does'nt know how to find "newest". You URL needs to somehow contain {name} in order to specify the target.

I can't see any releases on https://github.com/Cr0a3/ygen/releases so I don't know what URL you need to specify to download the built compiler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a little script which automatically builds my project and force pushes the changes to the build branch which this script should download

Copy link
Member

Choose a reason for hiding this comment

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

It does not do that.

@mattgodbolt
Copy link
Member

You can test this locally with:

$ make ce
$ bin/ce_install install ygen

(this will try and instlal to /opt/compiler-explorer but you can specify the destination with some --options - check --help for example)

@Cr0a3
Copy link
Contributor Author

Cr0a3 commented Oct 21, 2024

You can test this locally with:

$ make ce
$ bin/ce_install install ygen

Thank you, i found out when using wsl (which i do) you cannot use /mnt/c/... as your location you need to use ~ as the location. (Typical wsl problem happens often).

Anyway it now locally works.
After the installation, ylc should now be usable:

$ /opt/compiler-explorer/ygen/bin/ylc --version
ylc v1.0 (c) Cr0a3

Thank you for all your support

@Cr0a3
Copy link
Contributor Author

Cr0a3 commented Oct 21, 2024

@mattgodbolt can you also help me over the compiler-explorer side of thinks. When testing locally i get the error:

info: Exes found: {"cmake":[],"ylc":[]}
info: Creating compilers: 0
info: Compilers created: 0
info: Fetching possible arguments from storage
error: Top-level error (shutting down): Unexpected failure, no compilers found! {"stack":"Error: Unexpected failure, no compilers found!\n    at main (file:///home/toni/compiler-explorer/app.ts:458:19)"}
Program /usr/bin/node ./app.ts --debug --language ylc exited with code 1

compilers:
ygen:
ylc:
type: ziparchive
Copy link
Member

Choose a reason for hiding this comment

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

Thanks: confirmed this now works. But it will only install once. I assume that's OK as you didn't reply to the comments above.

@mattgodbolt
Copy link
Member

@mattgodbolt can you also help me over the compiler-explorer side of thinks. When testing locally i get the error:

info: Exes found: {"cmake":[],"ylc":[]}

It's not finding any compilers: probably as you have added them to the "amazon" settings which is the correct place to get them on the live site. However, it's not the configuration your system will use (else it would try and run on our amazon setup).

You can test locally by either copying the config to ylc.local.properties (or symlink it) -- that way your local install will pick up and use the same settings as the AWS instances just for your language.

Sorry it's so complex! There's some docs on adding a compiler and adding a language that you may already have seen but I'll link here.

@mattgodbolt mattgodbolt merged commit 761d84f into compiler-explorer:main Oct 22, 2024
4 checks passed
@mattgodbolt
Copy link
Member

Oct/22 01:19 admin-node~/infra (main|✔) $ ldd /opt/compiler-explorer/ygen/bin/ylc
        linux-vdso.so.1 (0x00007ffda73fb000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x0000718fb85d4000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000718fb8200000)
        /lib64/ld-linux-x86-64.so.2 (0x0000718fb88a9000)
Oct/22 01:20 admin-node~/infra (main|✔) $ /opt/compiler-explorer/ygen/bin/ylc --version
ylc v1.0 (c) Cr0a3

Confirmed installed ok. thanks

@mattgodbolt
Copy link
Member

(Noting that the path here is just "ygen" so you won't be able to add versions later without changing a few things)

@Cr0a3
Copy link
Contributor Author

Cr0a3 commented Oct 22, 2024

(Noting that the path here is just "ygen" so you won't be able to add versions later without changing a few things)

Oh, sorry I forgot to include it (can you quickly add the needed flag or should I create another pr)?

@mattgodbolt
Copy link
Member

I'll have to do some work to change it on my side as it will have been baked into our permanent image. Will make that change now though.

mattgodbolt pushed a commit to compiler-explorer/compiler-explorer that referenced this pull request Oct 22, 2024
Hi dear godbolt team,

> Before opening the PR, please make sure that the tests & linter pass
their checks,
 > by running `make check`.

With this pr i added support for the ylc compiler.

Infra-PR: compiler-explorer/infra#1441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants