dawnbeen / c_formatter_42

C language formatter for 42 norminette
GNU General Public License v3.0
165 stars 17 forks source link

Bad CPU type in executable #75

Open Alexs9090909 opened 6 months ago

Alexs9090909 commented 6 months ago

Hi ! I installed the formatter from pypi (pip3 install c-formatter-42), but when i run the command

c_formatter_42 < format_test.c

i get the following error :

Traceback (most recent call last):
  File "/opt/anaconda3/bin/c_formatter_42", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/c_formatter_42/__main__.py", line 43, in main
    print(run_all(content), end="")
          ^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/c_formatter_42/run.py", line 29, in run_all
    content = clang_format(content)
              ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/site-packages/c_formatter_42/formatters/clang_format.py", line 65, in clang_format
    process = subprocess.Popen(
              ^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/anaconda3/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

OSError: [Errno 86] Bad CPU type in executable: PosixPath('/opt/anaconda3/lib/python3.11/site-packages/c_formatter_42/data/clang-format-darwin') 

Any idea how to fix that ? I'm on macOS 14.1.1

Thanks a lot for the good work !

cacharle commented 6 months ago

Hi, are you using an ARM cpu by any chance?

Mar 22, 2024 10:32:23 Alexs9090909 @.***>:

Hi ! I installed the formatter from pypi (pip3 install c-formatter-42), but when i run the command

c_formatter_42 format_test.c

i get the following error :

Writing to format_test.c Error: /opt/anaconda3/lib/python3.11/site-packages/c_formatter_42/data/clang-format-darwin: Bad CPU type in executable

Any idea how to fix that ? I'm on macOS 14.1.1

Thanks a lot for the good work !

— Reply to this email directly, view it on GitHub[https://github.com/dawnbeen/c_formatter_42/issues/75], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AGBTCVPZW73NRJFHFXZI7PTYZP3CJAVCNFSM6AAAAABFC7MDLWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYDEMBXGMYDGNI]. You are receiving this because you are subscribed to this thread. [Tracking image][https://github.com/notifications/beacon/AGBTCVI2D235UWE2JGZFGUTYZP3CJA5CNFSM6AAAAABFC7MDLWWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHIGQHXZM.gif]

Alexs9090909 commented 6 months ago

I have an M2 processor, so it looks like it's ARM yes

cacharle commented 6 months ago

We do not have a clang-format executable for ARM but you could add it yourself in this directory: https://github.com/dawnbeen/c_formatter_42/tree/master/c_formatter_42/data

Mar 22, 2024 10:58:40 Alexs9090909 @.***>:

I have an M2 processor, so it looks like it's ARM yes

— Reply to this email directly, view it on GitHub[https://github.com/dawnbeen/c_formatter_42/issues/75#issuecomment-2014740027], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AGBTCVNBZ6TGXQHYAPL7MYLYZP6E5AVCNFSM6AAAAABFC7MDLWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJUG42DAMBSG4]. You are receiving this because you commented. [Tracking image][https://github.com/notifications/beacon/AGBTCVK2POYFLCK24EZZISDYZP6E5A5CNFSM6AAAAABFC7MDLWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTYCZ7DW.gif]

Alexs9090909 commented 6 months ago

Ok ! Thanks for your answers !