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

Build: Builtin compiler options do not work when following README #201

Open
sanderjo opened this issue Sep 29, 2024 · 8 comments
Open

Build: Builtin compiler options do not work when following README #201

sanderjo opened this issue Sep 29, 2024 · 8 comments

Comments

@sanderjo
Copy link

the build.sh went well, PATH is set, but I get:

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ aarch64-w64-mingw32-gcc ../hello.c 
aarch64-w64-mingw32-gcc: fatal error: cannot execute ‘cc1’: posix_spawnp: No such file or directory
compilation terminated.

cc1 is there in subdirs:

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ find . -type f -executable -print | grep cc1
./libexec/gcc/aarch64-w64-mingw32/15.0.0/cc1
./lib/libcc1.so.0.0.0
./lib/gcc/aarch64-w64-mingw32/15.0.0/cc1plus
./lib/gcc/aarch64-w64-mingw32/15.0.0/cc1
./lib/gcc/aarch64-w64-mingw32/15.0.0/plugin/libcc1plugin.la
./lib/gcc/aarch64-w64-mingw32/15.0.0/plugin/libcc1plugin.so.0.0.0
./lib/libcc1.la
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ printenv PATH
~/cross-aarch64-w64-mingw32-msvcrt/bin:/home/sander/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

So what now?

@Blackhex
Copy link
Member

Thank you for the report. It seems that aarch64-w64-mingw32-gcc cannot find cc1 in the PATH. This should not happen so we will try to reproduce and investigate the issue. For now, adding ./libexec/gcc/aarch64-w64-mingw32/15.0.0 to PATH should help.

@sanderjo
Copy link
Author

sanderjo commented Sep 29, 2024

Thanks for the quick answer.

ll ~/cross-aarch64-w64-mingw32-msvcrt/libexec/gcc/aarch64-w64-mingw32/15.0.0/
export PATH="~/cross-aarch64-w64-mingw32-msvcrt/libexec/gcc/aarch64-w64-mingw32/15.0.0/:$PATH"
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ printenv PATH
~/cross-aarch64-w64-mingw32-msvcrt/libexec/gcc/aarch64-w64-mingw32/15.0.0/:~/cross-aarch64-w64-mingw32-msvcrt/bin:/home/sander/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Looks good?

But still

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ aarch64-w64-mingw32-gcc ../hello.c
aarch64-w64-mingw32-gcc: fatal error: cannot execute ‘cc1’: posix_spawnp: No such file or directory
compilation terminated.

The strange thing: cc1 is found ... altough I'm not sure this is aarch64-w64 one ...

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ cc1 --help | head
The following options are specific to just the language Ada:
  -fdump-scos                 		[available in Ada]

The following options are specific to just the language AdaSCIL:
 None found.  Use --help=AdaSCIL to show *all* the options supported by the AdaSCIL front-end.

The following options are specific to just the language AdaWhy:
 None found.  Use --help=AdaWhy to show *all* the options supported by the AdaWhy front-end.

The following options are specific to just the language C:

And which produces no output?

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ which cc1
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ 

@sanderjo
Copy link
Author

I read -B could help, but

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ aarch64-w64-mingw32-gcc -B ~/cross-aarch64-w64-mingw32-msvcrt/libexec/gcc/aarch64-w64-mingw32/15.0.0/ ../hello.c
../hello.c:1:19: error: no include path in which to search for stdio.h
    1 | #include <stdio.h>
      |                   ^
../hello.c: In function 'main':
../hello.c:4:4: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    4 |    printf("Hello, World!");
      |    ^~~~~~
../hello.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #include <stdio.h>
../hello.c:4:4: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
    4 |    printf("Hello, World!");
      |    ^~~~~~
../hello.c:4:4: note: include '<stdio.h>' or provide a declaration of 'printf'

@Blackhex
Copy link
Member

Hmm, interesting. It seems that builtin compiler options do not work. Don't know why yet but the other error could be fixed with -I/home/sander/cross-aarch64-w64-mingw32-msvcrt/include.

What is your host operating system / UNIX environment?

@Blackhex Blackhex changed the title aarch64-w64-mingw32-gcc: fatal error: cannot execute ‘cc1’: posix_spawnp: No such file or directory Builtin compiler options do not work when following README. Sep 29, 2024
@Blackhex Blackhex changed the title Builtin compiler options do not work when following README. Builtin compiler options do not work when following README Sep 29, 2024
@sanderjo
Copy link
Author

Is this how -I should be used?

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ aarch64-w64-mingw32-gcc -B ~/cross-aarch64-w64-mingw32-msvcrt/libexec/gcc/aarch64-w64-mingw32/15.0.0/ -I /home/sander/cross-aarch64-w64-mingw32-msvcrt/include   ../hello.c
../hello.c:1:10: fatal error: stdio.h: No such file or directory
    1 | #include <stdio.h>
      |          ^~~~~~~~~
compilation terminated.

Plain Ubuntu 22.04

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ 
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ uname -a
Linux brixit 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.5 LTS
Release:	22.04
Codename:	jammy

@eukarpov
Copy link
Member

is it the same issue if it is called this way?
~/cross-aarch64-w64-mingw32-msvcrt/aarch64-w64-mingw32-gcc ../hello.c

@sanderjo
Copy link
Author

So ... hard-specifying the location inside the bin directory? With a bit different pathes ... that works:

sander@brixit:~$ ~/cross-aarch64-w64-mingw32-msvcrt/bin/aarch64-w64-mingw32-gcc ./hello.c -o hello_1234
sander@brixit:~$
sander@brixit:~$ file hello_1234
hello_1234: PE32+ executable (console) Aarch64, for MS Windows

and also

sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt/bin$ ./aarch64-w64-mingw32-gcc  ~/hello.c -o hello_2222
sander@brixit:~/cross-aarch64-w64-mingw32-msvcrt/bin$ file hello_2222
hello_2222: PE32+ executable (console) Aarch64, for MS Windows

@eukarpov
Copy link
Member

It looks it can be reproduced on our side. Thanks for reporting this.

@Blackhex Blackhex changed the title Builtin compiler options do not work when following README Build: Builtin compiler options do not work when following README Jan 5, 2025
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