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

TenDRA build doesn't work when un-tarred into CE #3

Closed
mattgodbolt opened this issue Aug 13, 2020 · 5 comments
Closed

TenDRA build doesn't work when un-tarred into CE #3

mattgodbolt opened this issue Aug 13, 2020 · 5 comments

Comments

@mattgodbolt
Copy link
Member

I built tendra (huge thanks to @partouf and @katef); but the resulting "obj" directory doesn't seem "portable".

We currently assume we can build compilers in one spot and then untar them elsewhere. To test whether we had a viable binary I built in docker, tar'd and uploaded to s3, then pulled down on one of the CE nodes and tried to run:

$ cd tendra-trunk-20200813/
$ ./bin/tcc
tcc: Warning: Can't open environment, 'base': Permission denied
tcc: Warning: Can't open environment, 'base': Permission denied
tcc: Warning: Can't find environment, 'base'
tcc: Fatal: No input files specified
$ cat > ../hellow.c
#include <stdio.h>
int main(int argc, const char *argv[]) { puts("hello\n"); }
$ ./bin/tcc -E /tmp/hellow.c 
tcc: Warning: Can't open environment, 'base': Permission denied
tcc: Warning: Can't open environment, 'base': Permission denied
tcc: Warning: Can't find environment, 'base'
tcc: Fatal: Undefined variable <MKDIR>

Any ideas?

@partouf
Copy link
Contributor

partouf commented Aug 13, 2020

@partouf
Copy link
Contributor

partouf commented Aug 13, 2020

Or maybe even both startup and env folders https://github.com/tendra/tendra/tree/main/tcc
Why they were not packaged, I'm not sure. (or are they?)

@partouf
Copy link
Contributor

partouf commented Aug 13, 2020

Ok, so I've built tendra with these changes to its source code: tendra/tendra@main...partouf:envfixes

And then I could do this and get an executable:
TEMP_PATH=/tmp TCCENV=/home/partouf/Documents/misc-builder/tendra-trunk-20200813/tendra-trunk-20200813/lib/tcc/env bin/tcc /home/partouf/Documents/main.c

The TCCENV bit should probably still be fixed.
And I think this should still be compatible with how other users would build it.

@partouf
Copy link
Contributor

partouf commented Aug 13, 2020

need for TCCENV eliminated, sent a PR

@katef
Copy link

katef commented Aug 14, 2020

Hi there! These paths are currently compiled into tcc at build time. They can be overridden at runtime of course, see tcc -vd to print a list of its internal environment variables. ENVPATH is one of those, it's like $PATH for binaries.

So for our purposes for CE, I don't think we need to change anything - we should be able to invoke tcc with something like tcc -yENVPATH=/path/to/environments ... to the same effect.

The idea for having tcc figure out its location to set defaults makes sense to me - I'll comment about that on the PR in the tendra repo. Essentially I wonder if we can do the prefixing in the environment files (which are a simple config language), rather than in C.

@partouf partouf closed this as completed Aug 20, 2020
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

No branches or pull requests

3 participants