qamel icon indicating copy to clipboard operation
qamel copied to clipboard

can't load package

Open kooksee opened this issue 5 years ago • 5 comments

When I run qamel build in project qamel-hn, I encountered the following error remind

can't load package: package qamel-hn: /Users/barry/gopath/src/qamel-hn/qamel-cgo-main.go: malformed #cgo argument: $(foreach

and My operating system is mac

kooksee avatar Jan 13 '20 05:01 kooksee

My situation is the same as yours

sh1luo avatar Apr 21 '20 07:04 sh1luo

These arguments are from a temporary makefile generated from qmake invokation here. The resulted makefile looks like this:

EXPORT_VALID_ARCHS = x86_64
EXPORT_ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
EXPORT_ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))

Normally make would take care of expanding these function calls, but Go tools cannot. I suppose a direct fix would be to replace EXPORT_ARCH_ARGS with -arch + profile.Arch.

JokerQyou avatar Jun 14 '20 13:06 JokerQyou

But after I added these codes on line 136 of internal/generator/cgo.go, I would report the error of null pointer reference.as the picture shows. I have recompiled qamel after adding the code, and it still does not work. My operating system is windows10. image

sh1luo avatar Jun 15 '20 05:06 sh1luo

Hmmm, that's weird, I've tested numerous times on macOS that my fix works. Stack trace in your screenshot indicates the panic happens before invoking qmake, so I don't think it's related to my fix at all. Can you please test again without adding the fix and see what happens?

Also your profile has target OS set to darwin, but I doubt that would work.

JokerQyou avatar Jun 15 '20 10:06 JokerQyou

TIM图片20200615230932 I switched to mac for compilation and it succeeded immediately! :)))))))))))))))) Originally, I thought that I would no longer support the mac platform, but it was solved, thanks for giving! Now our software has supported windows, linux and mac operating systems. Thanks again!

sh1luo avatar Jun 15 '20 15:06 sh1luo