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 support for Go libraries #1318

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Clement-Jean
Copy link

@Clement-Jean Clement-Jean commented May 29, 2024

Starting the conversation on adding support for Go libraries (#5242).

@partouf Is this the set of files that I need to be working on? Am I missing something? Also, is there any way to test what I'm doing? either manually or automatically

@partouf
Copy link
Member

partouf commented May 29, 2024

Yes, these are the ones

To test you would need to:

  • mkdir -p /opt/compiler-explorer if you hadn't already
  • make ce
  • bin/ce_install install 'go 1.22.1 to install GO 1.22.1 at the path that is expected
  • bin/ce_install list go/protobuf which should show protobuf as an installable item (doesn't do anything but check configuration)
  • bin/ce_install install go/protobuf (which will fail in this case, but should eventually work and probably do "nothing")
  • bin/ce_install build --buildfor gl1221 go/protobuf (which will fail in this case, but should eventually work)

install_context: InstallationContext,
buildconfig: LibraryBuildConfig,
):
self.logger = logger
Copy link
Member

Choose a reason for hiding this comment

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

the important part here is probably

[self.compilerprops, self.libraryprops] = get_properties_compilers_and_libraries(self.language, self.logger)

which will give you information about the compilers that are available

@partouf
Copy link
Member

partouf commented May 29, 2024

Also don't forget to add a case here:

elif self.build_config.build_type == "cargo":

You can check for self.build_config.type == "golib" instead of self.build_config.build_type.. but if that gives you trouble, maybe add a build_type to the lib entry at libraries.yaml and match with that.

Then instantiate and call the GoLibraryBuilder

@partouf
Copy link
Member

partouf commented May 29, 2024

You can use make static-checks to lint your code. There's also a make test, but it's probably not super useful here.

@Clement-Jean
Copy link
Author

Clement-Jean commented May 29, 2024

  • bin/ce_install install 'go 1.22.1

is there a way to download the ARM64 version? It downloads the AMD64 by default

edit

I found the url in ./bin/yaml/go.yaml, I'll modify it locally

@partouf
Copy link
Member

partouf commented May 29, 2024

  • bin/ce_install install 'go 1.22.1

is there a way to download the ARM64 version? It downloads the AMD64 by default

Ah.. not by default, but you can hack in this file https://github.com/compiler-explorer/infra/blob/main/bin/yaml/go.yaml#L6 and change the URL from amd64 to arm64

@partouf partouf marked this pull request as draft May 29, 2024 16:40
@Clement-Jean
Copy link
Author

Clement-Jean commented May 31, 2024

@partouf I made a little bit of progress but I'm still not sure I totally understand the difference between the library builder and the installable. As of right now, I'm able to install a library in /opt/compiler-explorer/libs/golibs.

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