Skip to content

robotgo does not build on FreeBSD #715

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

Open
walterjwhite opened this issue Apr 5, 2025 · 2 comments
Open

robotgo does not build on FreeBSD #715

walterjwhite opened this issue Apr 5, 2025 · 2 comments

Comments

@walterjwhite
Copy link

walterjwhite commented Apr 5, 2025

I have the necessary libraries; however, robotgo and the c libraries are expecting the headers to live @ /usr/include rather than /usr/local/include.

What is the best way to get this running on FreeBSD?

I am trying to build a simple example which is based off of the mouse example.

# github.com/go-vgo/robotgo
In file included from /home/user/go/pkg/mod/github.com/go-vgo/[email protected]/robotgo.go:48:
In file included from /home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/goWindow.h:12:
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:242:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:266:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:281:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
# cmd/example/robotgo/mouse
/usr/local/go123/pkg/tool/freebsd_amd64/link: running cc failed: exit status 1
/usr/bin/cc -m64 -o $WORK/b001/exe/a.out -Wl,--export-dynamic-symbol=__progname -Wl,--export-dynamic-symbol=_cgo_panic -Wl,--export-dynamic-symbol=_cgo_topofstack -Wl,--export-dynamic-symbol=crosscall2 -Wl,--export-dynamic-symbol=environ -Qunused-arguments -Wl,--compress-debug-sections=zlib /tmp/go-link-722109930/go.o /tmp/go-link-722109930/000000.o /tmp/go-link-722109930/000001.o /tmp/go-link-722109930/000002.o /tmp/go-link-722109930/000003.o /tmp/go-link-722109930/000004.o /tmp/go-link-722109930/000005.o /tmp/go-link-722109930/000006.o /tmp/go-link-722109930/000007.o /tmp/go-link-722109930/000008.o /tmp/go-link-722109930/000009.o /tmp/go-link-722109930/000010.o /tmp/go-link-722109930/000011.o /tmp/go-link-722109930/000012.o /tmp/go-link-722109930/000013.o /tmp/go-link-722109930/000014.o /tmp/go-link-722109930/000015.o /tmp/go-link-722109930/000016.o /tmp/go-link-722109930/000017.o /tmp/go-link-722109930/000018.o /tmp/go-link-722109930/000019.o /tmp/go-link-722109930/000020.o /tmp/go-link-722109930/000021.o /tmp/go-link-722109930/000022.o /tmp/go-link-722109930/000023.o /tmp/go-link-722109930/000024.o /tmp/go-link-722109930/000025.o /tmp/go-link-722109930/000026.o -O2 -g -O2 -g -lpthread -O2 -g -O2 -g -O2 -g -no-pie
ld: error: undefined symbol: XCloseDisplay
>>> referenced by xdisplay_c.h:13 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/../base/xdisplay_c.h:13)
>>>               /tmp/go-link-722109930/000002.o:(XCloseMainDisplay)
>>> referenced by xdisplay_c.h:13 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/../base/xdisplay_c.h:13)
>>>               /tmp/go-link-722109930/000002.o:(XGetMainDisplay)
>>> referenced by screen_c.h:48 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screen_c.h:48)
>>>               /tmp/go-link-722109930/000002.o:(sys_scale)
>>> referenced 28 more times

ld: error: undefined symbol: XOpenDisplay
>>> referenced by xdisplay_c.h:27 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/../base/xdisplay_c.h:27)
>>>               /tmp/go-link-722109930/000002.o:(XGetMainDisplay)
>>> referenced by xdisplay_c.h:31 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/../base/xdisplay_c.h:31)
>>>               /tmp/go-link-722109930/000002.o:(XGetMainDisplay)
>>> referenced by xdisplay_c.h:36 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/../base/xdisplay_c.h:36)
>>>               /tmp/go-link-722109930/000002.o:(XGetMainDisplay)
>>> referenced 25 more times

ld: error: undefined symbol: XResourceManagerString
>>> referenced by screen_c.h:32 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screen_c.h:32)
>>>               /tmp/go-link-722109930/000002.o:(sys_scale)

ld: error: undefined symbol: XrmGetStringDatabase
>>> referenced by screen_c.h:34 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screen_c.h:34)
>>>               /tmp/go-link-722109930/000002.o:(sys_scale)

ld: error: undefined symbol: XrmGetResource
>>> referenced by screen_c.h:39 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screen_c.h:39)
>>>               /tmp/go-link-722109930/000002.o:(sys_scale)

ld: error: undefined symbol: XrmDestroyDatabase
>>> referenced by screen_c.h:45 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screen_c.h:45)
>>>               /tmp/go-link-722109930/000002.o:(sys_scale)

ld: error: undefined symbol: XDefaultRootWindow
>>> referenced by screengrab_c.h:114 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screengrab_c.h:114)
>>>               /tmp/go-link-722109930/000002.o:(copyMMBitmapFromDisplayInRect)
>>> referenced by mouse_c.h:132 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:132)
>>>               /tmp/go-link-722109930/000002.o:(location)
>>> referenced by mouse_c.h:132 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:132)
>>>               /tmp/go-link-722109930/000002.o:(smoothlyMoveMouse)
>>> referenced 2 more times

ld: error: undefined symbol: XGetImage
>>> referenced by screengrab_c.h:114 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/screen/screengrab_c.h:114)
>>>               /tmp/go-link-722109930/000002.o:(copyMMBitmapFromDisplayInRect)

ld: error: undefined symbol: XWarpPointer
>>> referenced by mouse_c.h:95 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:95)
>>>               /tmp/go-link-722109930/000002.o:(moveMouse)
>>> referenced by mouse_c.h:95 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:95)
>>>               /tmp/go-link-722109930/000002.o:(dragMouse)
>>> referenced by mouse_c.h:95 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:95)
>>>               /tmp/go-link-722109930/000002.o:(smoothlyMoveMouse)
>>> referenced 2 more times

ld: error: undefined symbol: XSync
>>> referenced by mouse_c.h:97 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:97)
>>>               /tmp/go-link-722109930/000002.o:(moveMouse)
>>> referenced by mouse_c.h:97 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:97)
>>>               /tmp/go-link-722109930/000002.o:(dragMouse)
>>> referenced by mouse_c.h:155 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:155)
>>>               /tmp/go-link-722109930/000002.o:(toggleMouse)
>>> referenced 33 more times

ld: error: undefined symbol: XQueryPointer
>>> referenced by mouse_c.h:132 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:132)
>>>               /tmp/go-link-722109930/000002.o:(location)
>>> referenced by mouse_c.h:132 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:132)
>>>               /tmp/go-link-722109930/000002.o:(smoothlyMoveMouse)
>>> referenced by mouse_c.h:132 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:132)
>>>               /tmp/go-link-722109930/000002.o:(_cgo_dd183ab93a93_Cfunc_location)

ld: error: undefined symbol: XTestFakeButtonEvent
>>> referenced by mouse_c.h:154 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:154)
>>>               /tmp/go-link-722109930/000002.o:(toggleMouse)
>>> referenced by mouse_c.h:154 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:154)
>>>               /tmp/go-link-722109930/000002.o:(clickMouse)
>>> referenced by mouse_c.h:154 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:154)
>>>               /tmp/go-link-722109930/000002.o:(clickMouse)
>>> referenced 11 more times

ld: error: undefined symbol: floor
>>> referenced by mouse_c.h:296 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:296)
>>>               /tmp/go-link-722109930/000002.o:(smoothlyMoveMouse)
>>> referenced by mouse_c.h:296 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/mouse/mouse_c.h:296)
>>>               /tmp/go-link-722109930/000002.o:(smoothlyMoveMouse)

ld: error: undefined symbol: XSetErrorHandler
>>> referenced by pub.h:118 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:118)
>>>               /tmp/go-link-722109930/000002.o:(XDismissErrors)
>>> referenced by pub.h:123 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:123)
>>>               /tmp/go-link-722109930/000002.o:(XDismissErrors)
>>> referenced by pub.h:118 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:118)
>>>               /tmp/go-link-722109930/000002.o:(is_valid)
>>> referenced 23 more times

ld: error: undefined symbol: XInternAtom
>>> referenced by pub.h:156 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:156)
>>>               /tmp/go-link-722109930/000002.o:(initWindow)
>>> referenced by pub.h:157 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:157)
>>>               /tmp/go-link-722109930/000002.o:(initWindow)
>>> referenced by pub.h:158 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:158)
>>>               /tmp/go-link-722109930/000002.o:(initWindow)
>>> referenced 10 more times

ld: error: undefined symbol: XFree
>>> referenced by window.h:113 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:113)
>>>               /tmp/go-link-722109930/000002.o:(is_valid)
>>> referenced by window.h:409 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:409)
>>>               /tmp/go-link-722109930/000002.o:(get_active)
>>> referenced by pub.h:202 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:202)
>>>               /tmp/go-link-722109930/000002.o:(GetWindowProperty)
>>> referenced 7 more times

ld: error: undefined symbol: XGetInputFocus
>>> referenced by window.h:422 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:422)
>>>               /tmp/go-link-722109930/000002.o:(get_active)

ld: error: undefined symbol: XGetWindowProperty
>>> referenced by pub.h:186 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:186)
>>>               /tmp/go-link-722109930/000002.o:(GetWindowProperty)

ld: error: undefined symbol: XGetWindowAttributes
>>> referenced by pub.h:225 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:225)
>>>               /tmp/go-link-722109930/000002.o:(set_active)
>>> referenced by window.h:317 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:317)
>>>               /tmp/go-link-722109930/000002.o:(set_active)
>>> referenced by win_sys.h:113 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/win_sys.h:113)
>>>               /tmp/go-link-722109930/000002.o:(get_client)

ld: error: undefined symbol: XScreenNumberOfScreen
>>> referenced by pub.h:226 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/pub.h:226)
>>>               /tmp/go-link-722109930/000002.o:(set_active)
>>> referenced by window.h:318 (/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:318)
>>>               /tmp/go-link-722109930/000002.o:(set_active)

ld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
cc: error: linker command failed with exit code 1 (use -v to see invocation)

# github.com/go-vgo/robotgo
In file included from /home/user/go/pkg/mod/github.com/go-vgo/[email protected]/robotgo.go:48:
In file included from /home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/goWindow.h:12:
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:242:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:266:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
/home/user/go/pkg/mod/github.com/go-vgo/[email protected]/window/window.h:281:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
@walterjwhite
Copy link
Author

walterjwhite commented Apr 11, 2025

I have X11 libraries and I initially copied some libs from /usr/local/include directly into /usr/include just to satisfy those errors.

I should also note that if I search for the symbols it is complaining don't exist, I can find them:

grep XScreenNumberOfScreen /usr/local/include -r
/usr/local/include/X11/Xlib.h

I tried setting some flags:

export CGO_CFLAGS="-I/usr/local/include"
export CGO_LDFLAGS="-L/usr/local/include"
export CPPFLAGS="$CPPFLAGS -I/usr/local/include"

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

2 participants
@walterjwhite and others