rgburke / wed

wed is a terminal text editor with key bindings commonly used in Windows based editors
GNU General Public License v2.0
77 stars 1 forks source link

Couldn't build on OS X #3

Closed waldyrious closed 8 years ago

waldyrious commented 8 years ago
~/wed$ make
bison -y -d -o config_parse.c config_parse.y
config_parse.y:31.1-5: invalid directive: `%code'
config_parse.y:31.7-14: syntax error, unexpected identifier
make: *** [config_parse.c] Error 1

Any pointers?

rgburke commented 8 years ago

Thanks for trying out wed. I don't have a Mac so I haven't been able to try and build wed on OS X, but I definitely want wed to support it.

Could you paste the output of bison --version or let me know which version of bison you have on your machine?

My guess is that it's an older version of bison which doesn't recognize the %code requires directive. If that's the case then we'll need to update config_parse.y to use an alternative directive instead.

waldyrious commented 8 years ago

Sure!

~$ bison --version
bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
rgburke commented 8 years ago

Thanks for pasting the version info. I've update config_parse.y to work with Bison 2.3 and tested it on my own machine.

Hopefully the build will now work, although if other versions of tools/libraries are also old then other issues may also need to be fixed. Let me know how you get along.

waldyrious commented 8 years ago

Got a bit further :)

~/wed$ make
bison -y -d -o config_parse.c config_parse.y
flex -o config_scan.c config_scan.l
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C lib/libtermkey
cc -c -std=c99 -O2 termkey.c -o termkey.o
cc -c -std=c99 -O2 driver-ti.c -o driver-ti.o
cc -c -std=c99 -O2 driver-csi.c -o driver-csi.o
ar rcs libtermkey.a termkey.o driver-ti.o driver-csi.o
cc -c -std=c99 -Wall -Wextra -pedantic -MMD -MP -O2 -DNDEBUG wed.c -o wed.o
cc -c -std=c99 -Wall -Wextra -pedantic -MMD -MP -O2 -DNDEBUG display.c -o display.o
cc -c -std=c99 -Wall -Wextra -pedantic -MMD -MP -O2 -DNDEBUG buffer.c -o buffer.o
cc -c -std=c99 -Wall -Wextra -pedantic -MMD -MP -O2 -DNDEBUG util.c -o util.o
cc -c -std=c99 -Wall -Wextra -pedantic -MMD -MP -O2 -DNDEBUG input.c -o input.o
input.c:204:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
    clock_gettime(CLOCK_MONOTONIC, &last_draw);
    ^
input.c:204:19: error: use of undeclared identifier 'CLOCK_MONOTONIC'
    clock_gettime(CLOCK_MONOTONIC, &last_draw);
                  ^
input.c:291:23: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &now);
                      ^
input.c:295:27: error: use of undeclared identifier 'CLOCK_MONOTONIC'
            clock_gettime(CLOCK_MONOTONIC, last_draw);
                          ^
1 warning and 3 errors generated.
make: *** [input.o] Error 1
rgburke commented 8 years ago

Thanks for trying and pasting the output. In the end I added OSX to the Travis CI environments wed is built in to help identify all of the build issues, and so I didn't have to ask you to build wed over and over again :smile: . After making a couple of changes wed now builds sucessfully on OSX as shown here.

Hopefully you should now be able to successfully build wed.

One of the steps for building wed on the Travis CI OSX environment included installing PCRE and Source-highlight using Homebrew by running the following commands:

brew update
brew install pcre
brew install source-highlight

I don't know if this is relevant for you but I just thought I'd mention it. Let me know how you get on.

waldyrious commented 8 years ago

Awesome, many thanks! First of all, the build does work :+1:

But yes, I did have to install source-highlight (which requires the pretty large dependency boost -- I wonder if a different lib could be used instead), while pcre was already present as I had needed it previously. I wonder if the makefile could make an early test for the dependencies and print a meaningful error message, rather than the somewhat obscure error I got when I tested this without installing source-highlight --source_highlight.cc:26:10: fatal error: 'srchilite/langdefmanager.h' file not found--, which would have left me unsure of what to do next.

rgburke commented 8 years ago

Great! Thanks for all your help with testing and getting wed to work on OSX.

I agree source-highlight is not ideal. I chose it initially as it supported quite a large number of languages, but the boost dependency is really large and using it requires adding C++ code to wed which is otherwise purely C. My preference for the future is to use the Lua LPeg based lexers from the Scintillua project as vis has done. Lua could also then be used for adding plugin functionality to wed.

I also agree the build process could be more user friendly. I'm thinking that at this point it may be worth writing a configure script to generate a Makefile, which could also then do a build environment check and print helpful error messages.

Thanks for the feedback, if there's anything else you notice or want to suggest then please feel free to let me know.

waldyrious commented 8 years ago

Sure, I'll definitely keep sending suggestions as I use the editor. As for the build process, I like all your ideas outlined above 👍