Open codygman opened 10 years ago
That error typically means that you do not have some key libraries installed; in this case, Xss. I'm not sure what you need to do to get it (I've never really understood how package management works for Macs), so I can't give you much more help than that, sorry. I don't really think at the moment that this is a problem with the Haskell bindings.
I hit the same issue here while trying out arbtt. Perhaps the X11 package description should state that it won't build on mac/windows.
Is there really no way to install the Xss library on OSX? (I believe this is the X screensaver library.) If not, I suppose we could try to support a cabal flag or similar that would rip the screensaver support out. But I'd really, really prefer not to do that: letting the API of a package depend on flags is very bad practice, not least because there's no way for downstream packages to depend on particular build flags.
I have succeeded to install X11 on OS X:
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11
Thanks @adamse, it works for me!
The same, thank you @adamse !
@adamse thanks dude!
I can't see when this issue was closed [oh: 2014/4/21], but I respectfully disagree that it's resolved. The X11 package on hackage gives the impression of being cross-platform, so its description should include or point to any special steps required to install it.
I agree that instructions should be given on how to install on Mac OS. I had to do a bunch of Web searching to reach this page with the workaround someone contributed.
What would be the best place to put installation instructions for OS X? In the readme? In a separate INSTALL
file? Perhaps in the cabal-file description?
I have succeeded to install X11 on OS X:
Using X11 from http://xquartz.macosforge.org/landing/ Running: LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11
Worked for me on OS X Yosemite, thanks!
Another data point, for me LIBRARY_PATH
wasn't enough. This worked for me:
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH CPPFLAGS="-I/opt/X11/include" LDFLAGS="-L/opt/X11/lib" cabal install X11
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH CPPFLAGS="-I/opt/X11/include" LDFLAGS="-L/opt/X11/lib" cabal install X11
I needed this too (building for Yosemite)
I would also add that the above is correct when using bash, commands are different when using tcsh.
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11
that worked for me thanks!
I just ran into this, and @nkpart's incantation worked for me - thanks. @adamse I think the best place to put OSX-specific instructions would be in all of the places that installation instructions relevant to any other platform go. I would probably start on the page on the xmonad site here where it references "Notes for Debian / Ubuntu", "Notes for Ubuntu", etc., like "Notes for OSX"?
I have just pushed a branch named osx-pkgconfig
. In this branch, I've walked through the output of pkg-config --list-all
on my system and added anything that looked relevant to the pkgconfig-depends
field in the cabal file. I would appreciate some testing by somebody who has an OSX machine and for whom the master
branch doesn't build as described in this issue:
cabal install X11
work (obviously without additional LIBRARY_PATH
hacks)?pkgconfig-depends
field that works?Even having an answer to (1) without (2) would be a great help -- I can make a more careful pass at picking relevant packages if it looks like this idea has any chance of working at all.
@dmwit if no one will give you a feedback, please ping me at the end of next week, I'll try to provide info you asked.
Hi Daniel
Thanks for this (and for yeganesh!).
I launched a fresh shell without any PKG_CONFIG_PATH
environment set, and commented out extra-include-dirs
and extra-lib-dirs
in my ~/.cabal/config
cloned this repo, checked out out your new branch, cabal sandbox init
-ed, and...
Configuring X11-1.6.1.2...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for X... libraries /usr/X11/lib, headers /usr/X11/include
checking whether -R must be followed by a space... neither works
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking whether to build Xinerama... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking X11/extensions/Xinerama.h usability... yes
checking X11/extensions/Xinerama.h presence... yes
checking for X11/extensions/Xinerama.h... yes
checking X11/extensions/Xrandr.h usability... yes
checking X11/extensions/Xrandr.h presence... yes
checking for X11/extensions/Xrandr.h... yes
checking whether to build XScreenSaver... yes
checking X11/extensions/scrnsaver.h usability... yes
checking X11/extensions/scrnsaver.h presence... yes
checking for X11/extensions/scrnsaver.h... yes
checking whether to include X.org keysyms... yes
checking X11/keysym.h usability... yes
checking X11/keysym.h presence... yes
checking for X11/keysym.h... yes
checking X11/DECkeysym.h usability... yes
checking X11/DECkeysym.h presence... yes
checking for X11/DECkeysym.h... yes
checking X11/Sunkeysym.h usability... yes
checking X11/Sunkeysym.h presence... yes
checking for X11/Sunkeysym.h... yes
checking X11/ap_keysym.h usability... yes
checking X11/ap_keysym.h presence... yes
checking for X11/ap_keysym.h... yes
checking X11/HPkeysym.h usability... yes
checking X11/HPkeysym.h presence... yes
checking for X11/HPkeysym.h... yes
checking X11/XF86keysym.h usability... yes
checking X11/XF86keysym.h presence... yes
checking for X11/XF86keysym.h... yes
checking X11/keysymdef.h usability... yes
checking X11/keysymdef.h presence... yes
checking for X11/keysymdef.h... yes
checking X11/cursorfont.h usability... yes
checking X11/cursorfont.h presence... yes
checking for X11/cursorfont.h... yes
configure: creating ./config.status
config.status: creating config.mk
config.status: creating X11.buildinfo
config.status: creating include/HsX11Config.h
config.status: creating include/X11_extras_config.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Building X11-1.6.1.2...
Preprocessing library X11-1.6.1.2...
In file included from AP.hsc:166:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
In file included from DEC.hsc:111:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
In file included from HP.hsc:504:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
In file included from Sun.hsc:236:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
In file included from XF86.hsc:775:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
In file included from XorgDefault.hsc:10047:
In file included from include/HsAllKeysyms.h:48:
/usr/X11/include/X11/HPkeysym.h:58:9: warning: '_HPKEYSYM_H' is used as a header guard here, followed by #define of a different macro [-Wheader-guard]
#ifndef _HPKEYSYM_H
^~~~~~~~~~~
/usr/X11/include/X11/HPkeysym.h:60:9: note: '_HPKEYSYM' is defined here; did you mean '_HPKEYSYM_H'?
#define _HPKEYSYM
^~~~~~~~~
_HPKEYSYM_H
1 warning generated.
[ 1 of 28] Compiling Graphics.X11.Xlib.Internal ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Internal.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Internal.o )
[ 2 of 28] Compiling Graphics.X11.Types ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Types.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Types.o )
Graphics/X11/Types.hsc:61:1: Warning: Tab character
[ 3 of 28] Compiling Graphics.X11.Xlib.Types ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Types.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Types.o )
[ 4 of 28] Compiling Graphics.X11.Xlib.Display ( Graphics/X11/Xlib/Display.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Display.o )
[ 5 of 28] Compiling Graphics.X11.Xlib.Event ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Event.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Event.o )
[ 6 of 28] Compiling Graphics.X11.Xlib.Screen ( Graphics/X11/Xlib/Screen.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Screen.o )
[ 7 of 28] Compiling Graphics.X11.Xlib.Window ( Graphics/X11/Xlib/Window.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Window.o )
[ 8 of 28] Compiling Graphics.X11.Xlib.Context ( Graphics/X11/Xlib/Context.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Context.o )
[ 9 of 28] Compiling Graphics.X11.Xlib.Color ( Graphics/X11/Xlib/Color.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Color.o )
[10 of 28] Compiling Graphics.X11.Xlib.Font ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Font.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Font.o )
Graphics/X11/Xlib/Font.hsc:23:1: Warning: Tab character
(...warning repeats many times...)
Graphics/X11/Xlib/Font.hsc:189:1: Warning: Tab character
[11 of 28] Compiling Graphics.X11.Xlib.Cursor ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Cursor.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Cursor.o )
[12 of 28] Compiling Graphics.X11.Xlib.Atom ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Atom.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Atom.o )
[13 of 28] Compiling Graphics.X11.Xlib.Region ( Graphics/X11/Xlib/Region.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Region.o )
[14 of 28] Compiling Graphics.X11.Xlib.Image ( Graphics/X11/Xlib/Image.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Image.o )
[15 of 28] Compiling Graphics.X11.Xlib.Misc ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Misc.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Misc.o )
Graphics/X11/Xlib/Misc.hsc:698:10: Warning:
Orphan instance: instance Default VisualInfo
To avoid this
move the instance declaration to the module of the class or of the type, or
wrap the type with a newtype and declare the instance on the new type.
[16 of 28] Compiling Graphics.X11.Xrandr ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xrandr.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xrandr.o )
[17 of 28] Compiling Graphics.X11.ExtraTypes.AP ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/AP.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/AP.o )
[18 of 28] Compiling Graphics.X11.ExtraTypes.DEC ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/DEC.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/DEC.o )
[19 of 28] Compiling Graphics.X11.ExtraTypes.HP ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/HP.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/HP.o )
[20 of 28] Compiling Graphics.X11.ExtraTypes.Sun ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/Sun.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/Sun.o )
[21 of 28] Compiling Graphics.X11.ExtraTypes.XF86 ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/XF86.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/XF86.o )
[22 of 28] Compiling Graphics.X11.ExtraTypes.XorgDefault ( dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/XorgDefault.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes/XorgDefault.o )
[23 of 28] Compiling Graphics.X11.ExtraTypes ( Graphics/X11/ExtraTypes.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/ExtraTypes.o )
Graphics/X11/ExtraTypes.hs:16:1: Warning: Tab character
(...warning repeats many times...)
Graphics/X11/ExtraTypes.hs:25:1: Warning: Tab character
[24 of 28] Compiling Graphics.X11.Xlib ( Graphics/X11/Xlib.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib.o )
Graphics/X11/Xlib.hs:23:1: Warning: Tab character
(...warning repeats many times...)
Graphics/X11/Xlib.hs:47:1: Warning: Tab character
[25 of 28] Compiling Graphics.X11.Xlib.Extras ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Extras.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xlib/Extras.o )
[26 of 28] Compiling Graphics.X11.Xinerama ( dist/dist-sandbox-c01c888e/build/Graphics/X11/Xinerama.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/Xinerama.o )
[27 of 28] Compiling Graphics.X11.XScreenSaver ( dist/dist-sandbox-c01c888e/build/Graphics/X11/XScreenSaver.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11/XScreenSaver.o )
[28 of 28] Compiling Graphics.X11 ( Graphics/X11.hs, dist/dist-sandbox-c01c888e/build/Graphics/X11.o )
ld: library not found for -lXss
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Now, if I leave the following...
extra-include-dirs:/opt/X11/include
extra-include-dirs:/opt/X11/include/X11
extra-lib-dirs:/opt/X11/lib
in my ~/.cabal/config
, it builds fine. So I'm inclined to think that a potentially 'canonical' way of resolving this is to tackle it from the cabal config file. (Yes, I have two extra-include-dirs
; I'm sure there's a nicer way of doing it but ...dirs:/foo:/bar
didn't work and I was tired!)
Lemme know if there's anything further that I can do...
Gehrddammit, it looks like my email reply mussed up the formatting.
Okay, so essentially no change, which sucks since it means this approach is almost certainly not going to work.
...but I'm not going to put a hard-coded path like /opt/X11
into the cabal file. That just ain't right. If you know of a command that reliably points at /opt/X11
I will look into doing some configure
hacking.
Note to future self: it looks like one of the results of running configure
is to instantiate X11.buildinfo.in
to X11.buildinfo
, which is in cabal format and is then used by later cabal phases. Should be pretty easy to extend that template to have the appropriate extra fields.
Just to clarify: I'm not suggesting that the relevant paths be added into the X11 cabal file, I'm suggesting that the project take every opportunity to tell those using OSX to add the paths to their ~/.cabal/config
. I think, in the absence of a permanent fix, that this is about as good as it will get in the interim.
The correct answer here is that, since configure found the libraries in /usr/X11/lib, it should be adding -L/usr/X11/lib to LDFLAGS.
@geekosaur I believe my comment about X11.buildinfo
is actually the correct way to add -L
flags, rather than LDFLAGS
(as configure
actually has no way to affect the environment of the build step). However, your suggestion that configure
has already found the right location (and just hasn't passed it on properly) is an interesting one, and I'll look into it.
(Just be mindful that OSX, in its infinite wisdom, symlinks /usr/X11
to /opt/X11
.)
It's right in the configure log in the initial report:
checking for X... libraries /usr/X11/lib, headers /usr/X11/include
Since configure has determined that (and this is correct on OS X, at least from 10.7 on), configure should be telling the rest of the build.
@larryhynes, while that is true, it's not really relevant; /usr/X11
works fine and configure is clearly finding it and successfully using it. It's just not bothering to tell the actual build.
LIBRARY_PATH=/opt/X11/lib:$LIBRARY_PATH cabal install X11
Works on El Capitan. Thanks
link add -L/opt/X11/lib -lX11
For building with stack on OS X, install XQuartz and put the following in your ~/.stack/config.yaml
:
extra-lib-dirs:
- /opt/X11/lib
extra-include-dirs:
- /opt/X11/include
Ran into this today trying to install xmonad on OS X for the 1st time (though I've used xmonad on other operating systems like Linux in the past but just used the package manager to install it rather than cabal-install).
Thanks to @adamse for the fix to the -lXss issue! That combined with https://wiki.haskell.org/Xmonad/Using_xmonad_on_Apple_OSX#Modern_installation_instructions helped me get xmonad working on OS X High Sierra.
error:
full log below