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

Unable to build with alternative lex implementation #121

Open
firasuke opened this issue Nov 17, 2024 · 5 comments
Open

Unable to build with alternative lex implementation #121

firasuke opened this issue Nov 17, 2024 · 5 comments

Comments

@firasuke
Copy link

Hey there,

Thank you for your time and effort!

I am trying to build kbd on a system that uses reflex as its default lex implementation, and it's failing with the following error:

 ...
  LEX      analyze.c                                                                                                                                                          
invalid option: --header-file=/tmp/kbd-2.6.4/src/libkeymap/analyze.hflex [options] [file ...]                                                                   
                                                                                                                                                                              
Options:                                                                                                                                                                      
 ...

It appears that the lex implementation I am using does not support the following flag --header-file which is only supported by flex.

Is the flag AM_LFLAGS = --header-file=$(CURDIR)/analyze.h used in src/libkeymap/Makefile.am needed for the correct building of kbd?

Thanks in advance!

@legionus
Copy link
Owner

@firasuke This option is used to set the name of the header file. The option can be dropped and the lex option can be used within the file. Tell me if the following patch works for you.

diff --git a/src/libkeymap/Makefile.am b/src/libkeymap/Makefile.am
index 097ea5c4..fa399aec 100644
--- a/src/libkeymap/Makefile.am
+++ b/src/libkeymap/Makefile.am
@@ -69,7 +69,6 @@ noinst_LTLIBRARIES = libkeymap.la
 endif
 
 AM_YFLAGS = -Wno-yacc
-AM_LFLAGS = --header-file=$(CURDIR)/analyze.h
 BUILT_SOURCES = parser.c analyze.c parser.h analyze.h $(ksyms_gen_headers)
 CLEANFILES += $(BUILT_SOURCES)
 
diff --git a/src/libkeymap/analyze.l b/src/libkeymap/analyze.l
index 614077b6..acc1b51c 100644
--- a/src/libkeymap/analyze.l
+++ b/src/libkeymap/analyze.l
@@ -27,6 +27,7 @@ int stack_pop(struct lk_ctx *ctx, void *scanner);
 %option noinput
 %option noyy_top_state
 
+%option header-file="analyze.h"
 %option extra-type="struct lk_ctx *"
 
 %{

@legionus
Copy link
Owner

Unfortunately I didn't find support for header-file option in reflex code. So, it is unlikely that my patch would be useful. It seams that reflex doesn't have a way to ask for a header to be created.

@firasuke
Copy link
Author

Thank you for your time.

I still haven't tried the patch yet, but will report back if it fixed the issue.

Yeah header-file is missing in reflex. I have opened an issue in the relative upstream repository, and Mr. Thomas is looking into it as well.

@firasuke
Copy link
Author

It still is not working. I am receiving the following error:

make[3]: Entering directory 'kbd-2.6.4/src/libkeymap'
  LEX      analyze.c
"kbd-2.6.4/src/libkeymap/analyze.l", line 17: unrecognized '%' directive
"kbd-2.6.4/src/libkeymap/analyze.l", line 18: bad character: #
"kbd-2.6.4/src/libkeymap/analyze.l", line 18: unknown error processing section 1
"kbd-2.6.4/src/libkeymap/analyze.l", line 18: bad character: "
"kbd-2.6.4/src/libkeymap/analyze.l", line 18: bad character: .
"kbd-2.6.4/src/libkeymap/analyze.l", line 18: bad character: "
"kbd-2.6.4/src/libkeymap/analyze.l", line 20: name defined twice
"kbd-2.6.4/src/libkeymap/analyze.l", line 21: bad character: }
"kbd-2.6.4/src/libkeymap/analyze.l", line 23: unrecognized %option: reentrant
"kbd-2.6.4/src/libkeymap/analyze.l", line 24: unrecognized %option: bison-bridge
"kbd-2.6.4/src/libkeymap/analyze.l", line 32: unrecognized %option: header-file
"kbd-2.6.4/src/libkeymap/analyze.l", line 33: unrecognized %option: extra-type
m

@legionus
Copy link
Owner

@firasuke why should it be otherwise if no one has done anything on the reflex or kbd side ?

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