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

can't load package #20

Open
kooksee opened this issue Jan 13, 2020 · 5 comments
Open

can't load package #20

kooksee opened this issue Jan 13, 2020 · 5 comments

Comments

@kooksee
Copy link

kooksee commented Jan 13, 2020

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

@sh1luo
Copy link
Contributor

sh1luo commented Apr 21, 2020

My situation is the same as yours

@JokerQyou
Copy link
Contributor

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.

@sh1luo
Copy link
Contributor

sh1luo commented Jun 15, 2020

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

@JokerQyou
Copy link
Contributor

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.

@sh1luo
Copy link
Contributor

sh1luo commented Jun 15, 2020

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!

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