Skip to content

Can't install #272

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

Closed
DeadNumbers opened this issue Feb 23, 2018 · 20 comments
Closed

Can't install #272

DeadNumbers opened this issue Feb 23, 2018 · 20 comments

Comments

@DeadNumbers
Copy link

go get -v -u github.com/andlabs/ui
github.com/andlabs/ui (download)
github.com/andlabs/ui
# github.com/andlabs/ui
/usr/sbin/ld: ../Go/src/github.com/andlabs/ui/libui_linux_amd64.a(libui-combined.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/sbin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

go version go1.10 linux/amd64
libui 0.3.5.alpha-1
gcc 7.3.0

@andlabs
Copy link
Owner

andlabs commented Feb 23, 2018

I thought I fixed this argh; will go back and fix it for real later

@ghost
Copy link

ghost commented Feb 25, 2018

@andlabs is there a work-around? The README's build instructions now just refer to go get.

@mdejong
Copy link

mdejong commented Feb 25, 2018

I just tried to use go get on Mac OSX and it failed like so:

go version
go version go1.9.4 darwin/amd64
go get -v -u github.com/andlabs/ui
github.com/andlabs/ui (download)
github.com/andlabs/ui
go build github.com/andlabs/ui: invalid flag in #cgo LDFLAGS: /Users/modejong/Development/GoPackages/src/github.com/andlabs/ui/libui_darwin_amd64.a

@andlabs
Copy link
Owner

andlabs commented Feb 25, 2018

@serussell it's a problem with libui's build process in which I need to figure out why -fPIC isn't being applied... because I thought I did apply it explicitly

@mdejong upgrade to Go 1.10 or wait for 1.9.5

@ghost
Copy link

ghost commented Feb 25, 2018

@andlabs Understood. Can you paste the build command (and arguments) in the meantime so we can build the project?

@mdejong
Copy link

mdejong commented Feb 25, 2018

I found that setting the following ENV var also worked around the build problem on MacOSX:

export CGO_LDFLAGS_ALLOW=".*"

@andlabs
Copy link
Owner

andlabs commented Feb 25, 2018

@serussell I just do cmake -DBUILD_SHARED_LIBS=OFF and then make.

@SirNeural
Copy link

SirNeural commented Feb 25, 2018

getting an error on OSX High Sierra 10.3.3 using Go 1.10
go get -v -u github.com/andlabs/ui github.com/andlabs/ui (download) github.com/andlabs/ui go build github.com/andlabs/ui: invalid flag in #cgo LDFLAGS: -mmacosx-version-min=10.8
ive bypassed the error by using the export CGO_LDFLAGS_ALLOW=".*" but I then get a warning which I'm not sure if I should be worried about.
go get -v -u github.com/andlabs/ui github.com/andlabs/ui (download) github.com/andlabs/ui ld: warning: object file (/Users/neural/golang/src/github.com/andlabs/ui/libui_darwin_amd64.a(libui-combined.o)) was built for newer OSX version (10.12) than being linked (10.8)

@andlabs
Copy link
Owner

andlabs commented Feb 25, 2018

Again, the "invalid cgo flag" stuff is a Go 1.10 thing, because of a recent security vulnerability. CGO_LDFLAGS_ALLOW=".*" defeats that whole problem, so you should probably alter this regex to be fine-tuned toward the specific cases until the 1.10.1 patch comes out that will handle the things that weren't patched in.

@mdejong @SirNeural where did each of you get the .* workaround from?

The "was built for newer version" stuff is another libui build bug I thought I fixed already.

@SirNeural
Copy link

@andlabs I just saw the reply from @mdejong and tried it, seemed to help get the go get command working
Anything I can do to help give more information on this issue?

@vanillaSprinkles
Copy link

vanillaSprinkles commented Feb 26, 2018

Using ArchLinux here and the CGO_LDFLAGS_ALLOW=".*" does not work to get this installed (get the same error as OP)

  • go version go1.10 linux/amd64
  • mingw-w64-gcc 7.3.0-1
  • gcc 7.3.0-1

tried to use all of the new CGO ALLOW vars with no success (CGO_CFLAGS_ALLOW=".*" CGO_CXXFLAGS_ALLOW=".*" CGO_LDFLAGS_ALLOW=".*")

Go 1.10.1 is expected march 1st, hopefully it helps.

@andlabs
Copy link
Owner

andlabs commented Feb 26, 2018

Right, the issue the OP has has nothing to do with the cgo options whitelist.

@vanillaSprinkles
Copy link

vanillaSprinkles commented Feb 26, 2018

(sorry I missed relaying some info in the wee hours last night): I tried also setting CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go get github.com/andlabs/ui which changed the OP error into a cgo issue (got the idea to set the flags from an old issue#)

Edit: well after looking at all this again I did it right finally; pulled down libui, cmake + make and copied the out/libui.a over ui's libui_linux_amd64.a allowing a go build && go install

Maybe the release section of libui can have the .o and .a files as well and ui can just reference them?

@drahoslove
Copy link

@andlabs, I tried to compile libui by myself, replacing libui_linux_amd64.a by out/libui.a and then go install ui. As @vanillaSprinkles did. But it fails with these errors:

/tmp/go-build458073604/b001/_x010.o: In function `newFont':
./draw.go:88: undefined reference to `uiDrawLoadClosestFont'
/tmp/go-build458073604/b001/_x010.o: In function `_cgo_2fc1135dc6ba_Cfunc_uiDrawFontFamiliesFamily':
/tmp/go-build/cgo-gcc-prolog:327: undefined reference to `uiDrawFontFamiliesFamily'
/tmp/go-build458073604/b001/_x010.o: In function `_cgo_2fc1135dc6ba_Cfunc_uiDrawFontFamiliesNumFamilies':
/tmp/go-build/cgo-gcc-prolog:344: undefined reference to `uiDrawFontFamiliesNumFamilies'
/tmp/go-build458073604/b001/_x010.o: In function `_cgo_2fc1135dc6ba_Cfunc_uiDrawListFontFamilies':
/tmp/go-build/cgo-gcc-prolog:408: undefined reference to `uiDrawListFontFamilies'
... and few others such lines

Is it possible, that current libui is not compatible with current ui? Which version is then?

@andlabs
Copy link
Owner

andlabs commented Mar 23, 2018

Yep, groan. Will need to update all the APIs :|

@drahoslove
Copy link

Would you appreciate some helping hand? :)
Is it only about renaming or are these complicated API changes?

@andlabs
Copy link
Owner

andlabs commented Mar 23, 2018

Er wait I reread, you are building libui from source, so I assume you are building it from master. master has breaking API changes. You'll need to build from one of the stable tarball releases. Sorry!

@drahoslove
Copy link

You are right, thanks. Now I have a different problem - my program panics at the start, but it might not be a problem with (lib)ui.

@virtualsue
Copy link

I'm getting this same error on debian 9, go 1.10. Is it best to build from source? Will try that now.

@andlabs andlabs closed this as completed Mar 26, 2018
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

7 participants