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

+micro #466

Closed
wants to merge 3 commits into from
Closed

+micro #466

wants to merge 3 commits into from

Conversation

davdroman
Copy link
Contributor

No description provided.

@what-the-diff
Copy link

what-the-diff bot commented Mar 6, 2023

  • The package.yml file was added to the micro-editor repository
  • A new version of go is required for building this project (1.16)
  • LDFLAGS are set in order to build a pie executable on linux systems, which prevents segmentation faults when running the program
  • make build and mv commands were added as part of the script that builds this project from source code

@davdroman
Copy link
Contributor Author

Can't make it work... closing for now.

@davdroman davdroman closed this Mar 6, 2023
@jhheider
Copy link
Contributor

jhheider commented Mar 6, 2023

A bug was released in brewkit (currently pulling 0.5.1 and releasing 0.5.2), so if it was just that test issue, I wouldn't give up yet.

@jhheider
Copy link
Contributor

jhheider commented Mar 6, 2023

This is an interesting one. You need to get -buildmode=pie into the ADDITIONAL_GO_LINKER_FLAGS. possibly make ADDITIONAL_GO_LINKER_FLAGS='-buildmode=pie', but that might just overwrite it. It might be necessary to use sed to inject it directly into the makefile with, for example, sed -i.bak -e 's/ADDITIONAL_GO_LINKER_FLAGS = /ADDITIONAL_GO_LINKER_FLAGS = -buildmode=pie /' Makefile.

@davdroman davdroman reopened this Mar 6, 2023
@davdroman
Copy link
Contributor Author

@jhheider cool thanks for the tips! I'll take a look tomorrow.

@davdroman davdroman marked this pull request as draft March 6, 2023 20:53
@davdroman davdroman marked this pull request as ready for review March 8, 2023 19:30
@jhheider
Copy link
Contributor

jhheider commented Apr 2, 2023

Try:

sed -i.bak -e 's/^ADDITIONAL_GO_LINKER_FLAGS = /ADDITIONAL_GO_LINKER_FLAGS = "-buildmode=pie" /' Makefile
rm Makefile.bak

and see if that gets it.

@magnusviri
Copy link
Contributor

I think that fixed it. I don't know what that does though. I actually figured out that the command builds and runs, but as soon as the build script finishes, it doesn't work anymore. I'm assuming this is because pkg build modifies the binary. This step perhaps?

  fixing up built products
doing SLOW rpath fixes…

Anyway, that sed command seemed to fix it. My package.yml file is so hacked up that I have to reduce it down to the minimum to see what is really important.

@jhheider
Copy link
Contributor

jhheider commented Apr 2, 2023

It just adds the appropriate flag to the Makefile, since there doesn't seem to be a better way to do so.

@magnusviri
Copy link
Contributor

It's all fixed. I'll see if I can figure out how to add to this pull request.

@magnusviri
Copy link
Contributor

@jhheider I don't know what -buildmode=pie does. I think it's only required on Linux, so I'm going to put it in an if statement.

@magnusviri
Copy link
Contributor

I finally read that link. The segfault only happens on Linux.

@jhheider
Copy link
Contributor

jhheider commented Apr 2, 2023

It is optional on linux, but it's always on on Ubuntu. It's a hardened memory runtime that provides additional alignment guarantees, so if the system uses it, binaries must as well, but not vice versa.

I don't recommend being interested but the technologies are called position-independent code and position-independent executable if you want to know more.

@magnusviri
Copy link
Contributor

Well, I tried to follow these instructions but it was harder than that. I had to do this.

TEA_PANTRY_PATH=/opt/tea/tea.xyz/var/pantry tea gh repo set-default
TEA_PANTRY_PATH=/opt/tea/tea.xyz/var/pantry tea gh pr checkout 466

After I made my change and committed, I tried to do a push and I got this.

git push
remote: Permission to davdroman/pantry.extra.git denied to magnusviri.
fatal: unable to access 'https://github.com/davdroman/pantry.extra.git/': The requested URL returned error: 403

I've never done this type of thing before so I'm not sure how to proceed. Is it possible to push it to my fork and have this pull request reference my fork? I kind of doubt it... IDK.

@magnusviri
Copy link
Contributor

I don't recommend being interested but the technologies are called position-independent code and position-independent executable if you want to know more.

LOL, I'm kind of interested, but there's a lot of things between where I'm at and those specifics. When I switch to Linux as my daily driver (been on my to-do list for over 3 years now) then I might start looking into that type of thing more.

@magnusviri
Copy link
Contributor

Here's my branch

@jhheider
Copy link
Contributor

jhheider commented Apr 3, 2023

There's a lot you can do with git remotes; possibly the easiest way to do it without adding remotes is to use the edit file feature on the web and just paste in your updated file.

@davdroman davdroman deleted the +micro branch April 5, 2023 08:38
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.

3 participants