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

gollvm: void Ptrmask::set_from(Gogo *, Type *, int64_t, int64_t): assertion '(offset % ptrsize) == 0' failed, while building Azure/run-command-extension-linux package #41931

Closed
advancedwebdeveloper opened this issue Oct 12, 2020 · 5 comments
Milestone

Comments

@advancedwebdeveloper
Copy link

@advancedwebdeveloper advancedwebdeveloper commented Oct 12, 2020

Hello.

$ go version

go version go1.15.2 gollvm LLVM 12.0.0git linux/amd64

Does this issue reproduce with the latest release?

I didn't built gollvm for the latest (as for today) source code base - so do not know that, yet.

What operating system and processor architecture are you using (go env)?

Ubuntu 20.04 x86_64

go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/oceanfish81/.cache/go-build" GOENV="/home/oceanfish81/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/oceanfish81/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/oceanfish81/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/home/oceanfish81/gollvm_dist" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/oceanfish81/gollvm_dist/tools" GCCGO="/home/oceanfish81/gollvm_dist/bin/llvm-goc" AR="ar" CC="/usr/bin/clang" CXX="/usr/bin/clang++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build145321530=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
$ go env

run-command-extension-linux/main$ go build cmds.go
./cmds.go:24:24: error: reference to undefined identifier 'log.Context'
./cmds.go:25:24: error: reference to undefined identifier 'log.Context'
./cmds.go:57:16: error: reference to undefined identifier 'log.Context'
./cmds.go:62:19: error: reference to undefined identifier 'log.Context'
./cmds.go:82:39: error: reference to undefined identifier 'log.Context'
./cmds.go:96:37: error: reference to undefined identifier 'vmextension.FindSeqNumStatus'
./cmds.go:114:21: error: reference to undefined identifier 'log.Context'
./cmds.go:127:21: error: reference to undefined identifier 'log.Context'
./cmds.go:146:18: error: reference to undefined identifier 'log.Context'
./cmds.go:210:25: error: reference to undefined identifier 'log.Context'
./cmds.go:42:14: error: reference to undefined name 'sendTelemetry'
./cmds.go:42:28: error: reference to undefined name 'newTelemetryEventSender'
./cmds.go:42:65: error: reference to undefined name 'Version'
./cmds.go:63:24: error: reference to undefined name 'dataDir'
./cmds.go:73:23: error: reference to undefined name 'mostRecentSequence'
./cmds.go:77:47: error: reference to undefined name 'dataDir'
./cmds.go:103:25: error: reference to undefined name 'mostRecentSequence'
./cmds.go:116:26: error: reference to undefined name 'dataDir'
./cmds.go:117:49: error: reference to undefined name 'dataDir'
./cmds.go:118:26: error: reference to undefined name 'dataDir'
./cmds.go:130:56: error: reference to undefined name 'mostRecentSequence'
./cmds.go:148:14: error: reference to undefined name 'parseAndValidateSettings'
./cmds.go:153:23: error: reference to undefined name 'dataDir'
./cmds.go:153:32: error: reference to undefined name 'downloadDir'
./cmds.go:162:22: error: reference to undefined name 'logPaths'
./cmds.go:163:21: error: reference to undefined name 'tailFile'
./cmds.go:167:21: error: reference to undefined name 'tailFile'
./cmds.go:210:54: error: use of undefined type 'handlerSettings'
./cmds.go:220:8: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:225:26: error: reference to field 'fileUrls' in object which has no fields or methods
./cmds.go:226:12: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:228:19: error: reference to field 'protectedSettings' in object which has no fields or methods
./cmds.go:232:23: error: reference to field 'fileUrls' in object which has no fields or methods
./cmds.go:235:13: error: reference to undefined name 'downloadAndProcessURL'
./cmds.go:235:51: error: reference to field 'StorageAccountName' in object which has no fields or methods
./cmds.go:235:75: error: reference to field 'StorageAccountKey' in object which has no fields or methods
./cmds.go:235:98: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:232:6: error: invalid type for range clause
./cmds.go:232:6: error: invalid type for range clause
./cmds.go:232:2: error: range clause must have array, slice, string, map, or channel type
./cmds.go:210:54: error: use of undefined type 'handlerSettings'
./cmds.go:252:8: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:254:12: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:256:15: error: reference to field 'protectedSettings' in object which has no fields or methods
./cmds.go:258:12: error: reference to field 'protectedSettings' in object which has no fields or methods
./cmds.go:260:15: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:262:50: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:262:82: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:266:15: error: reference to field 'protectedSettings' in object which has no fields or methods
./cmds.go:268:50: error: reference to field 'protectedSettings' in object which has no fields or methods
./cmds.go:268:85: error: reference to field 'publicSettings' in object which has no fields or methods
./cmds.go:275:8: error: reference to undefined name 'ExecCmdInDir'
./cmds.go:310:9: error: reference to undefined name 'postProcessFile'
llvm-goc: /home/oceanfish81/workarea/llvm-project/llvm/tools/gollvm/gofrontend/go/types.cc:2794: void Ptrmask::set_from(Gogo , Type , int64_t, int64_t): assertion '(offset % ptrsize) == 0' failed.
0 0x0000000000d765f3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0xd765f3)
1 0x0000000000d7468c llvm::sys::RunSignalHandlers() (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0xd7468c)
2 0x0000000000d76a85 SignalHandler(int) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0xd76a85)
3 0x00007f0d48cb43c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
4 0x00007f0d4885118b raise /build/glibc-ZN95T4/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
5 0x00007f0d48830859 abort /build/glibc-ZN95T4/glibc-2.31/stdlib/abort.c:81:7
6 0x000000000051b662 (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x51b662)
7 0x00000000004f0d9e Ptrmask::set_from(Gogo
, Type
, long, long) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f0d9e)
8 0x00000000004f0f42 Ptrmask::set_from(Gogo*, Type*, long, long) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f0f42)
9 0x00000000004f1091 Ptrmask::set_from(Gogo*, Type*, long, long) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f1091)
10 0x00000000004f0f42 Ptrmask::set_from(Gogo*, Type*, long, long) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f0f42)
11 0x00000000004f05b4 Type::gc_ptrmask_var(Gogo*, long, long) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f05b4)
12 0x00000000004f0399 Type::make_gc_symbol_var(Gogo*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f0399)
13 0x00000000004f003a Type::gc_symbol_pointer(Gogo*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4f003a)
14 0x0000000000578046 Struct_construction_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x578046)
15 0x0000000000578046 Struct_construction_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x578046)
16 0x00000000004e9179 Type::make_type_descriptor_var(Gogo*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4e9179)
17 0x00000000004e8d36 Type::type_descriptor_pointer(Gogo*, Location) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4e8d36)
18 0x0000000000578046 Struct_construction_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x578046)
19 0x00000000004e9179 Type::make_type_descriptor_var(Gogo*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4e9179)
20 0x00000000004e8d36 Type::type_descriptor_pointer(Gogo*, Location) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x4e8d36)
21 0x00000000005556f3 Type_conversion_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x5556f3)
22 0x000000000056fa3f Call_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x56fa3f)
23 0x000000000057ad97 Map_construction_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x57ad97)
24 0x00000000005556f3 Type_conversion_expression::do_get_backend(Translate_context*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x5556f3)
25 0x0000000000485643 Variable::get_init_block(Gogo*, Named_object*, Bvariable*) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x485643)
26 0x000000000048256f Gogo::write_globals() (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x48256f)
27 0x000000000046e9fe gollvm::driver::CompileGoImpl::invokeFrontEnd() (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x46e9fe)
28 0x000000000047118b gollvm::driver::CompileGo::performAction(gollvm::driver::Compilation&, gollvm::driver::Action const&, llvm::SmallVector<gollvm::driver::Artifact*, 3u> const&, gollvm::driver::Artifact const&) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x47118b)
29 0x0000000000467b12 gollvm::driver::Driver::processAction(gollvm::driver::Action*, gollvm::driver::Compilation&, bool) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x467b12)
30 0x0000000000467c22 gollvm::driver::Driver::processActions(gollvm::driver::Compilation&) (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x467c22)
31 0x0000000000460f07 main (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x460f07)
32 0x00007f0d488320b3 __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:342:3
33 0x000000000045fb2e start (/home/oceanfish81/gollvm_dist/bin/llvm-goc+0x45fb2e)
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/oceanfish81/gollvm_dist/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=/tmp/go-build533359978=/tmp/go-build -gno-record-gcc-switches -fgo-relative-import-path=
/home/oceanfish81/go_projects/run-command-extension-linux/main -o $WORK/b001/go.o -I $WORK/b001/importcfgroot ./cmds.go

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 12, 2020

Maybe some flags aren't passed properly - I wasn't able to enforce Clang to generate me sub-step files and IR bitcode file.

$ go build -work -x cmds.go
WORK=/tmp/go-build760275396
mkdir -p $WORK/b001/
cd $WORK
/home/oceanfish81/gollvm_dist/bin/llvm-goc -fgo-importcfg=/dev/null -c -x c - -o /dev/null || true
mkdir -p $WORK/b001/importcfgroot/github.com/Azure/azure-docker-extension/pkg
ln -s /home/oceanfish81/go/pkg/gccgo_linux_amd64/github.com/Azure/azure-docker-extension/pkg/libvmextension.a $WORK/b001/importcfgroot/github.com/Azure/azure-docker-extension/pkg/libvmextension.a
mkdir -p $WORK/b001/importcfgroot/github.com/Azure/run-command-extension-linux/pkg
ln -s /home/oceanfish81/go/pkg/gccgo_linux_amd64/github.com/Azure/run-command-extension-linux/pkg/libseqnum.a $WORK/b001/importcfgroot/github.com/Azure/run-command-extension-linux/pkg/libseqnum.a
mkdir -p $WORK/b001/importcfgroot/github.com/go-kit/kit
ln -s /home/oceanfish81/go/pkg/gccgo_linux_amd64/github.com/go-kit/kit/liblog.a $WORK/b001/importcfgroot/github.com/go-kit/kit/liblog.a
mkdir -p $WORK/b001/importcfgroot/github.com/pkg
ln -s /home/oceanfish81/go/pkg/gccgo_linux_amd64/github.com/pkg/liberrors.a $WORK/b001/importcfgroot/github.com/pkg/liberrors.a
cd /home/oceanfish81/go_projects/run-command-extension-linux/main
/home/oceanfish81/gollvm_dist/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -fgo-relative-import-path=_/home/oceanfish81/go_projects/run-command-extension-linux/main -o $WORK/b001/go.o -I $WORK/b001/importcfgroot ./cmds.go

command-line-arguments

./cmds.go:24:24: error: reference to undefined identifier 'log.Context'
./cmds.go:25:24: error: reference to undefined identifier 'log.Context'
./cmds.go:57:16: error: reference to undefined identifier 'log.Context'

...

Stack dump:
0. Program arguments: /home/oceanfish81/gollvm_dist/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=/tmp/go-build760275396=/tmp/go-build -gno-record-gcc-switches -fgo-relative-import-path=_/home/oceanfish81/go_projects/run-command-extension-linux/main -o $WORK/b001/go.o -I $WORK/b001/importcfgroot ./cmds.go
$ export WORK=/tmp/go-build760275396

$ /home/oceanfish81/gollvm_dist/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=/tmp/go-build760275396=/tmp/go-build -gno-record-gcc-switches -fgo-relative-import-path=_/home/oceanfish81/go_projects/run-command-extension-linux/main -o $WORK/b001/go.o -I $WORK/b001/importcfgroot -S -emit-llvm -save-temps ./cmds.go

...

Stack dump:
0. Program arguments: /home/oceanfish81/gollvm_dist/bin/llvm-goc -c -O2 -g -m64 -fdebug-prefix-map=/tmp/go-build760275396=/tmp/go-build -gno-record-gcc-switches -fgo-relative-import-path=_/home/oceanfish81/go_projects/run-command-extension-linux/main -o /tmp/go-build760275396/b001/go.o -I /tmp/go-build760275396/b001/importcfgroot -S -emit-llvm -save-temps ./cmds.go
Aborted (core dumped)

So I can't find those artifacts anywhere.

CC @thanm @cherrymui @ianlancetaylor

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 13, 2020

What source code are you building to get this error? How can we reproduce the problem? Thanks.

@advancedwebdeveloper
Copy link
Author

@advancedwebdeveloper advancedwebdeveloper commented Oct 15, 2020

@ianlancetaylor , you could simply clone this repo into a custom folder.
Then enter the main sub-folder and run

$ go build cmds.go
or
$ go build -i -v -x cmds.go
.
You can take my last pre-compiled "release" build of gollvm.

@thanm
Copy link
Member

@thanm thanm commented Oct 15, 2020

I can't reproduce this problem. After an initial "go get -u github.com/Azure/run-command-extension-linux" I tried your command "go build cmds.go", and from this I see the various error mesages (e.g. "./cmds.go:210:54: error: use of undefined type 'handlerSettings'") but no crash.

Errors are to be expected, however -- "cmds.go" is not a stand-alone Go program, and needs to be built together with the other 'package main' files in that directory. When I do "go build ." it builds cleanly with gollvm.

Looking at your errors, I see

./cmds.go:24:24: error: reference to undefined identifier 'log.Context'

which is from the input dependency "github.com/go-kit/kit/log". If this type is coming up undefined it suggests that there is something damaged about your installation or your dependencies.

I would suggest setting up GOPATH (this project does not use modules) and rerunning "go get".

@thanm thanm closed this Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.