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

error: invalid argument '-std=c++11' not allowed with 'C' #4821

Closed
jiangenj opened this issue May 20, 2024 · 1 comment · Fixed by #4823
Closed

error: invalid argument '-std=c++11' not allowed with 'C' #4821

jiangenj opened this issue May 20, 2024 · 1 comment · Fixed by #4823
Labels

Comments

@jiangenj
Copy link
Contributor

With this comment, syz-extract failed: error: invalid argument '-std=c++11' not allowed with 'C'.

commit 3e60354bf2a2ad7e7fa81fe8107f3ce24e098287
Author: Dmitry Vyukov <dvyukov@google.com>
Date:   Thu May 2 19:35:10 2024 +0200

    executor: make flatrpc build for C++

It looks like it caused by

diff --git a/sys/targets/targets.go b/sys/targets/targets.go
index 02a26028b..3635eb023 100644
--- a/sys/targets/targets.go
+++ b/sys/targets/targets.go
@@ -584,6 +584,9 @@ var oses = map[string]osCommon{
 
 var (
        commonCFlags = []string{
+               "-std=c++11",
+               "-I.",
+               "-Ivendor",
                "-O2",
                "-pthread",
                "-Wall",

After comment -std=c++11, syz-extract succeed.

Can you suggest or provide a common fix?

@jiangenj jiangenj added the bug label May 20, 2024
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
@dvyukov
Copy link
Collaborator

dvyukov commented May 21, 2024

Hi Joey,

I cannot reproduce this, but I think #4823 should fix it.

syzkaller💻 syz-env make extract SOURCEDIR=/usr/local/google/home/dvyukov/src/linux
gcr.io/syzkaller/env:latest
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=c0f1611a36d66bb0bb8e2f294b97fb685bfc5f9c -X 'github.com/google/syzkaller/prog.gitRevisionDate=20240517-125934'" -o bin/syz-extract ./sys/syz-extract
bin/syz-extract -build -os=linux -sourcedir=/syzkaller/kernel 
generating linux/386...
generating linux/amd64...
generating linux/arm...
generating linux/arm64...
generating linux/mips64le...
generating linux/ppc64le...
generating linux/riscv64...
generating linux/s390x...
syzkaller💻 SYZ_CLANG=yes syz-env make extract SOURCEDIR=/usr/local/google/home/dvyukov/src/linux
gcr.io/syzkaller/env:latest
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=c0f1611a36d66bb0bb8e2f294b97fb685bfc5f9c+ -X 'github.com/google/syzkaller/prog.gitRevisionDate=20240517-125934'" -o bin/syz-extract ./sys/syz-extract
bin/syz-extract -build -os=linux -sourcedir=/syzkaller/kernel 
generating linux/386...
generating linux/amd64...
generating linux/arm...
generating linux/arm64...
generating linux/mips64le...
generating linux/ppc64le...
generating linux/riscv64...
generating linux/s390x...

dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
dvyukov added a commit to dvyukov/syzkaller that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix google#4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes google#4821
github-merge-queue bot pushed a commit that referenced this issue May 21, 2024
Add C++ compiler and flags to the target
and build executor with the C++ compiler.
This will be needed to merge syz-fuzzer in to syz-executor
since it will be beefier and will most likely require linking in libc++.
But also this should fix #4821 since we won't use C++ flags
when building C sources (we already had work-around in pkg/csource,
but not in syz-extract).

Fixes #4821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants