shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
236 stars 63 forks source link

zsh: ../configure: bad interpreter: /usr/bin/python: no file or directory #234

Open hiren3897 opened 2 years ago

hiren3897 commented 2 years ago

I have python3 in my MacOS in /usr/bin/python3 v3.9 no supported by shaka-player embedded for now

but I have python v2.7 in /usr/local/bin/python

when I run ../configure it says zsh: ../configure: bad interpreter: /usr/bin/python: no file or directory

Can you guide me on how should I configure it so it points to /urs/local/bin/python Or any PATH config to make python2.7 in /usr/local/bin/python should appear in /usr/bin/python*

joeyparrish commented 2 years ago

I think you'd have to do something like git grep /usr/bin/python and take instances like this:

https://github.com/shaka-project/shaka-player-embedded/blob/67283faf9b2875d7287b57c820eed4bb11c5e4a1/third_party/protobuf/wrapper.py#L1

#!/usr/bin/python

And replace them with this:

#!/usr/bin/env python

If you get this working, please send a PR!

hiren3897 commented 2 years ago

Hello, Thanks for the response

This didn't worked for me

#!/usr/bin/env python

This worked for me

#!/usr/bin/python3

But now I am facing an error while configuring and building the SDK You can see the error in the following screenshot. errorSE

It seems to be a python indentation problem in the file of boringssl

Could you please suggest to me how I can resolve this ? I tried to fix the indentation but when I do again ../configure then it again gives the same error

joeyparrish commented 2 years ago

Then #!/usr/bin/env python3 is the way to do it. This is more general than #!/usr/bin/python3, because it allows python3 to be anywhere in your $PATH environment variable.

As for the other issue, that's not indentation. In Python 3, print is a function rather than a statement. For example:

    print('export %s="%s"' % (key, value))

But that file (in third_party/boringssl) is coming from another repository through a git submodule. You will need to update the submodule to get a newer version of boringssl that has adopted Python 3.

hiren3897 commented 2 years ago

Thanks @joeyparrish

Yes! I have changed it to #!/usr/bin/env python3 which works fine.

I updated that submodule URL of boringssl form https://boringssl.googlesource.com/boringssl to https://github.com/google/boringssl.git in .gitmodules but it still clones the old repo and not the new one from https://github.com/google/boringssl.git :(

I tried to update the submodule but it is still the same when I run ../configure --ios again then it still keeps the old version of boringssl

https://github.com/shaka-project/shaka-player-embedded/blob/180462a1bb6ea0642f0681486cb41448c167b54f/shaka/tools/utils.py#L36

This line always updates the submodule I guess!

joeyparrish commented 2 years ago

It's not the URL that needs updating, but the git reference (SHA1) to pull.

hiren3897 commented 2 years ago

Hello @joeyparrish Happy Day

Can you please explain to me a bit how should I do that I have been waiting for your reply as I spent my whole day fixing this?

because I did check out the boringssl and pulled everything from the master branch but when I do ../configure it clone the same old repo :( again and I have the error

hiren3897 commented 2 years ago

Can you please help me in resolving this error! It would be a great help for me.

So that I will be able to build the SDK and start developing the app

As I have tried all the possible ways to do it.

Please

On boringssl it shows HEAD detached at 35b4a1225 when I do git status

hiren3897 commented 2 years ago

I did git config -f .gitmodules submodule.third_party/boringssl/src.branch master then git submodule update --remote

then when I do ../configure it again fetches the old repo code and gives me the error

is there a flag to stop the already cloned repos?

joeyparrish commented 2 years ago

In a nutshell, go to the submodule folder, which has its own ".git" and everything, then git pull and checkout a newer revision (main, a certain version, whatever). Then go back to the shaka-player-embedded repo and you can "commit" the change in submodule revision.

See also the docs on submodules: https://git-scm.com/book/en/v2/Git-Tools-Submodules You may also find more concise advice on submodules here: https://www.google.com/search?q=git+submodule+cheat+sheet

hiren3897 commented 2 years ago

yes was also able to do with git submodule update --remote and then commit from the shaka-player-embedded repo but now it gives a weird error of No such file or directory: 'go' in boringssl/src/util/generate_build_files.py line 867 :(

I see a go directory in util/bot/go

joeyparrish commented 2 years ago

Then perhaps something about the way the shaka-player-embedded build system builds/configures boringssl needs to be updated to match the newer version of boringssl. Sorry I don't have anything more specific to offer. You may want to dig through the source of both projects.

hiren3897 commented 2 years ago

I was able to install python 2.7.18 in macOS Monetary and was not having the previous errors

but now I am interrupted with the new error

Downloading... 100%
INFO:bootstrap:Extracting...
INFO:bootstrap:Validating...
INFO:bootstrap:Removing /Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-playerembedded/
third_party/boringssl/src/util/bot/golang/tmpRkBYQa
Traceback (most recent call last):
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/env.py", line 34, in <module>
new = bootstrap.prepare_go_environ()
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/bootstrap.py", line 266, in prepare_go_environ
bootstrap(logging.INFO)
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/bootstrap.py", line 258, in bootstrap
ensure_toolset_installed(TOOLSET_ROOT)
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/bootstrap.py", line 199, in ensure_toolset_installed
install_toolset(toolset_root, available)
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/bootstrap.py", line 140, in install_toolset
if not check_hello_world(toolset_root):
File "/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/
third_party/boringssl/src/util/bot/go/bootstrap.py", line 177, in check_hello_world
stderr=subprocess.STDOUT)
File "/Users/hrathod/.pyenv/versions/2.7.18/lib/python2.7/subprocess.py", line 223, in
check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['/Users/hrathod/Desktop/MyWork/ShakaPlayer iOS
SDK/shaka-player-embedded/third_party/boringssl/src/util/bot/golang/go/bin/go', 'run', '/Users/
hrathod/Desktop/MyWork/ShakaPlayer iOS SDK/shaka-player-embedded/third_party/boringssl/
src/util/bot/golang/tmpRkBYQa/hello.go']' returned non-zero exit status 1

Is it because of python version 2.7.18 where subprocess.py raise the error ?

fyanyan commented 2 years ago

Have you solved your problem?

hiren3897 commented 2 years ago

Not yet! We have to make all the third-party libs plus the main Shaka-embedded compatible with the latest python version.

which is really very complex to do for me because of having no prior experience in Objective C

naval77 commented 2 years ago

INSTALL 2 version pf python 2.7.18 and 3 when You configure use pyhton2.7 and for make python3 . Simply create ln -sh /usr/bin/python2.7 pyhton and same for pyhton 3 It will solve all python related issue.