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

BUG: unable to compile on Archlinux #89

Closed
quinnjr opened this issue Feb 20, 2022 · 10 comments
Closed

BUG: unable to compile on Archlinux #89

quinnjr opened this issue Feb 20, 2022 · 10 comments

Comments

@quinnjr
Copy link

quinnjr commented Feb 20, 2022

Attempts to compile this library on Archlinux for using snap result in the following error:

# github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang
../go/src/github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go:630:2: duplicate case _Ciconst_C_ACT_KILL_THREAD (value 0) in switch
	previous case at ../go/src/github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go:626:2

The library does compile correctly in a clean chroot. The only thing I can really find different in my system versus a clean chroot is that I have CC/CXX set to Clang versus gcc.

@kolyshkin
Copy link
Contributor

I believe this is fixed by #85, which is currently being reviewed.

@pcmoore pcmoore changed the title Unable to compile on Archlinux BUG: unable to compile on Archlinux Feb 22, 2022
@pcmoore pcmoore linked a pull request Feb 22, 2022 that will close this issue
@pcmoore pcmoore added this to the v0.9.2 milestone Feb 22, 2022
@pcmoore
Copy link
Member

pcmoore commented May 6, 2022

With #85 merged, any chance @quinnjr that you can verify that the current main branch solved your problem?

@quinnjr
Copy link
Author

quinnjr commented May 8, 2022

With #85 merged, any chance @quinnjr that you can verify that the current main branch solved your problem?

No, still having the same issue with the switch statement.

*** Setting version to '2.55.4-1' from user.
# github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang
../go/src/github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go:630:7: duplicate case (_Ciconst_C_ACT_KILL_THREAD) (constant 0 of type C.uint) in expression switch
	../go/src/github.com/snapcore/snapd/vendor/github.com/seccomp/libseccomp-golang/seccomp_internal.go:626:7: previous case

@pcmoore
Copy link
Member

pcmoore commented May 8, 2022

Hmm, I wonder if this is due to something related to snap? On my current (as of May 8, 2022) Arch system with my libseccomp-golang repo sitting at f57e1d5, I'm able to build and run the tests without problem.

% make test
go test -v -timeout 10s
=== RUN   TestExpectedSeccompVersion
...
ok      github.com/seccomp/libseccomp-golang    0.021s

@quinnjr are you able to fetch the current repo and successfully do a make test outside of a snap environment?

@quinnjr
Copy link
Author

quinnjr commented May 8, 2022

@quinnjr are you able to fetch the current repo and successfully do a make test outside of a snap environment?

Tests all are passing just using make test. Might just be a snap issue then.

ishtar AUR/libseccomp-golang ‹main› » make test  
go test -v -timeout 10s
=== RUN   TestExpectedSeccompVersion
    seccomp_test.go:39: === RUN   TestExpectedSeccompVersion
        === RUN   TestExpectedSeccompVersion/subprocess
            seccomp_test.go:55: _EXPECTED_LIBSECCOMP_VERSION not set
        --- PASS: TestExpectedSeccompVersion (0.00s)
            --- SKIP: TestExpectedSeccompVersion/subprocess (0.00s)
        PASS
--- PASS: TestExpectedSeccompVersion (0.00s)
=== RUN   TestGetAPILevel
    seccomp_test.go:39: === RUN   TestGetAPILevel
        === RUN   TestGetAPILevel/subprocess
            seccomp_test.go:90: Got API level of 6
        --- PASS: TestGetAPILevel (0.00s)
            --- PASS: TestGetAPILevel/subprocess (0.00s)
        PASS
--- PASS: TestGetAPILevel (0.00s)
=== RUN   TestSetAPILevel
    seccomp_test.go:39: === RUN   TestSetAPILevel
        === RUN   TestSetAPILevel/subprocess
        --- PASS: TestSetAPILevel (0.00s)
            --- PASS: TestSetAPILevel/subprocess (0.00s)
        PASS
--- PASS: TestSetAPILevel (0.00s)
=== RUN   TestActionSetReturnCode
--- PASS: TestActionSetReturnCode (0.00s)
=== RUN   TestSyscallGetName
    seccomp_test.go:140: Got name of syscall 0x1 on native arch as write
--- PASS: TestSyscallGetName (0.00s)
=== RUN   TestSyscallGetNameByArch
--- PASS: TestSyscallGetNameByArch (0.00s)
=== RUN   TestGetSyscallFromName
    seccomp_test.go:185: Got syscall number of write on native arch as 1
--- PASS: TestGetSyscallFromName (0.00s)
=== RUN   TestGetSyscallFromNameByArch
    seccomp_test.go:203: Got syscall number of write on AMD64 as 1
--- PASS: TestGetSyscallFromNameByArch (0.00s)
=== RUN   TestMakeCondition
--- PASS: TestMakeCondition (0.00s)
=== RUN   TestGetNativeArch
    seccomp_test.go:266: Got native arch of system as amd64
--- PASS: TestGetNativeArch (0.00s)
=== RUN   TestFilterCreateRelease
--- PASS: TestFilterCreateRelease (0.00s)
=== RUN   TestFilterReset
--- PASS: TestFilterReset (0.00s)
=== RUN   TestFilterArchFunctions
--- PASS: TestFilterArchFunctions (0.00s)
=== RUN   TestFilterAttributeGettersAndSetters
--- PASS: TestFilterAttributeGettersAndSetters (0.00s)
=== RUN   TestMergeFilters
--- PASS: TestMergeFilters (0.00s)
=== RUN   TestAddRuleErrors
    seccomp_test.go:39: === RUN   TestAddRuleErrors
        === RUN   TestAddRuleErrors/subprocess
        --- PASS: TestAddRuleErrors (0.00s)
            --- PASS: TestAddRuleErrors/subprocess (0.00s)
        PASS
--- PASS: TestAddRuleErrors (0.00s)
=== RUN   TestRuleAddAndLoad
    seccomp_test.go:39: === RUN   TestRuleAddAndLoad
        === RUN   TestRuleAddAndLoad/subprocess
        --- PASS: TestRuleAddAndLoad (0.00s)
            --- PASS: TestRuleAddAndLoad/subprocess (0.00s)
        PASS
--- PASS: TestRuleAddAndLoad (0.00s)
=== RUN   TestLogAct
    seccomp_test.go:39: === RUN   TestLogAct
        === RUN   TestLogAct/subprocess
        --- PASS: TestLogAct (0.00s)
            --- PASS: TestLogAct/subprocess (0.00s)
        PASS
--- PASS: TestLogAct (0.00s)
=== RUN   TestCreateActKillThreadFilter
    seccomp_test.go:39: === RUN   TestCreateActKillThreadFilter
        === RUN   TestCreateActKillThreadFilter/subprocess
        --- PASS: TestCreateActKillThreadFilter (0.00s)
            --- PASS: TestCreateActKillThreadFilter/subprocess (0.00s)
        PASS
--- PASS: TestCreateActKillThreadFilter (0.00s)
=== RUN   TestCreateActKillProcessFilter
    seccomp_test.go:39: === RUN   TestCreateActKillProcessFilter
        === RUN   TestCreateActKillProcessFilter/subprocess
        --- PASS: TestCreateActKillProcessFilter (0.00s)
            --- PASS: TestCreateActKillProcessFilter/subprocess (0.00s)
        PASS
--- PASS: TestCreateActKillProcessFilter (0.00s)
=== RUN   TestNotif
    seccomp_test.go:39: === RUN   TestNotif
        === RUN   TestNotif/subprocess
            seccomp_test.go:936: Starting test 0
            seccomp_test.go:936: Test 0 completed
            seccomp_test.go:936: Starting test 1
            seccomp_test.go:936: Test 1 completed
            seccomp_test.go:936: Starting test 2
            seccomp_test.go:936: Test 2 completed
            seccomp_test.go:936: Starting test 3
            seccomp_test.go:936: Test 3 completed
            seccomp_test.go:933: Tests completed
        --- PASS: TestNotif (0.00s)
            --- PASS: TestNotif/subprocess (0.00s)
        PASS
--- PASS: TestNotif (0.00s)
=== RUN   TestNotifUnsupported
    seccomp_test.go:39: === RUN   TestNotifUnsupported
        === RUN   TestNotifUnsupported/subprocess
            seccomp_test.go:958: seccomp notification is supported
        --- PASS: TestNotifUnsupported (0.00s)
            --- SKIP: TestNotifUnsupported/subprocess (0.00s)
        PASS
--- PASS: TestNotifUnsupported (0.00s)
=== RUN   TestCheckVersion
    seccomp_ver_test.go:25: verNew requires libseccomp >= 100.99.7 (current version: 2.5.4)
    seccomp_ver_test.go:25: verMajor+1 requires libseccomp >= 3.0.0 (current version: 2.5.4)
    seccomp_ver_test.go:25: verMinor+1 requires libseccomp >= 2.6.0 (current version: 2.5.4)
    seccomp_ver_test.go:25: verMicro+1 requires libseccomp >= 2.5.5 (current version: 2.5.4)
    seccomp_ver_test.go:25: <nil>
    seccomp_ver_test.go:25: <nil>
--- PASS: TestCheckVersion (0.00s)
=== RUN   TestCheckAPI
    seccomp_ver_test.go:59: apiHigh requires libseccomp >= 0.0.0 and API level >= 99 (current version: 2.5.4, API level: 6)
    seccomp_ver_test.go:59: api+1 requires libseccomp >= 0.0.0 and API level >= 7 (current version: 2.5.4, API level: 6)
    seccomp_ver_test.go:59: <nil>
    seccomp_ver_test.go:59: <nil>
    seccomp_ver_test.go:59: <nil>
    seccomp_ver_test.go:59: verHigh requires libseccomp >= 99.0.0 (current version: 2.5.4)
--- PASS: TestCheckAPI (0.00s)
PASS
ok  	github.com/seccomp/libseccomp-golang	0.016s

@pcmoore
Copy link
Member

pcmoore commented May 8, 2022

@quinnjr are you able to fetch the current repo and successfully do a make test outside of a snap environment?

Tests all are passing just using make test. Might just be a snap issue then.

If I'm understanding snap's go.mod correctly, it looks like they need to point to a more recent point in the repo as the revision they are referencing doesn't have the fix from #85. @quinnjr I'm going to close this issue as I don't think there is anything else we can do from a libseccomp-golang perspective, but if you find that not to be the case please feel free to comment/reopen this issue.

@pcmoore pcmoore closed this as completed May 8, 2022
@bboozzoo
Copy link

bboozzoo commented May 9, 2022

I can reproduce this with the version of libseccomp-golandg we're using in snapd and CC=clang. Interestingly gcc does not complain. Anyways, I'll see if I can update the revision have we have in snapd.

@pcmoore
Copy link
Member

pcmoore commented May 9, 2022

Thanks @bboozzoo. FWIW, I just tried CC=clang make test on the current libseccomp-golang repo and it run clean, as expected. I really believe it is simply an older version of libseccomp-golang that is causing the issue. If you find there is a problem with the libseccomp-goland bindings, or if there is anything we can do to help resolve this on our end please comment/reopen.

Thanks.

@allendred
Copy link

allendred commented Mar 12, 2024

snap 2.61.3-1 seccomp.h no such file or directory

@pcmoore
Copy link
Member

pcmoore commented Mar 12, 2024

The original issue was closed almost two years ago with a verdict it was a problem with snap and not libseccomp; please follow up with the snapcore/snapd team to further troubleshoot this issue.

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

Successfully merging a pull request may close this issue.

5 participants