shaunluke
Posts: 9
Joined: Thu Jun 25, 2020 4:57 am

MAKE errors

Sat Jul 11, 2020 7:01 am

I'm trying to use Linux Joystick Mapper to remap mouse buttons to controller buttons. Specifically for use with DOSBox

I've followed the instructions in Retropie posts and https://www.petrockblock.com/forums/top ... r-in-kodi/

I've copied the contents of the unzipped joymap-0.4.2 folder obtained from https://sourceforge.net/projects/linuxjoymap/files/# to /home/pi/joymap with WinSCP

When I execute "make" in that folder with Putty, I get the following errors. I'm afraid I'm no Linux expert so would appreciate any advice. (Were I on an IBM mainframe I'd assume I was trying to compile into a PDS with incorrect record/block size, but here I'm lost ;)

pi@retropie:~/joymap $ make
cc -Wall -Werror -g -c -o mapparser.o mapparser.c
mapparser.c: In function ‘parse_valuepairs’:
mapparser.c:540:50: error: ‘%s’ directive writing up to 255 bytes into a region of size 238 [-Werror=format-overflow=]
sprintf(message, "Unexpected token "%s"", key.value);
^~ ~~~~~~~~~
mapparser.c:540:13: note: ‘sprintf’ output between 20 and 275 bytes into a destination of size 256
sprintf(message, "Unexpected token "%s"", key.value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapparser.c:529:49: error: ‘%s’ directive writing up to 255 bytes into a region of size 243 [-Werror=format-overflow=]
sprintf(message, "Unknown key "%s"", key.value);
^~ ~~~~~~~~~
mapparser.c:529:17: note: ‘sprintf’ output between 15 and 270 bytes into a destination of size 256
sprintf(message, "Unknown key "%s"", key.value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapparser.c:536:54: error: ‘%s’ directive writing up to 255 bytes into a region of size 238 [-Werror=format-overflow=]
sprintf(message, "Unexpected token "%s"", value.value);
^~ ~~~~~~~~~~~
mapparser.c:536:17: note: ‘sprintf’ output between 20 and 275 bytes into a destination of size 256
sprintf(message, "Unexpected token "%s"", value.value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mapparser.c: In function ‘parse_lines’:
mapparser.c:885:54: error: ‘%s’ directive writing up to 255 bytes into a region of size 238 [-Werror=format-overflow=]
sprintf(message, "Unexpected token "%s"", t.value);
^~ ~~~~~~~
mapparser.c:885:17: note: ‘sprintf’ output between 20 and 275 bytes into a destination of size 256
sprintf(message, "Unexpected token "%s"", t.value);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: mapparser.o] Error 1

Appreciate any light you can shed. Thank you.

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: MAKE errors

Sat Jul 11, 2020 7:27 am

From a cursory glance, it looks as though all the message buffers are defined as 256 characters, but sometimes the messages are too long to fit in that.

I got it to compile by changing all occurrences of "char message[256]" to "char message[512]" and "char msg[256]" to char "msg[512]". They probably didn't all need to be changed.

Just because I got it to compile with now errors, doesn't mean it works. I haven't tested it. ;-)

Code: Select all

rpdom@raspberrypi:~/joymap-0.4.2 $ make
cc -Wall -Werror -g   -c -o programparser.o programparser.c
cc -Wall -Werror -g   -c -o validkeys.o validkeys.c
cc -Wall -Werror -g   -c -o events.o events.c
cc -Wall -Werror -g   -c -o vm.o vm.c
cc -Wall -Werror -g   -c -o devices.o devices.c
cc -Wall -Werror -g   -c -o config.o config.c
cc -g -o loadmap loadmap.o dictionary.o mapparser.o programparser.o validkeys.o events.o vm.o devices.o config.o
cc -Wall -Werror -g   -c -o reserve_js.o reserve_js.c
cc -g -o reserve_js reserve_js.o config.o
rpdom@raspberrypi:~/joymap-0.4.2 $
Unreadable squiggle

shaunluke
Posts: 9
Joined: Thu Jun 25, 2020 4:57 am

Re: MAKE errors

Sat Jul 11, 2020 7:43 am

Thanks for the quick reply.

I just actually managed to resolve this. There is a note in the makefile file "# Disable -Werror if there are compile errors ". I removed -Werror and now it compiles and executes fine

Now just got to get it to work with DOSBox ;)

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: MAKE errors

Sat Jul 11, 2020 8:53 am

shaunluke wrote:
Sat Jul 11, 2020 7:43 am
Thanks for the quick reply.

I just actually managed to resolve this. There is a note in the makefile file "# Disable -Werror if there are compile errors ". I removed -Werror and now it compiles and executes fine

Now just got to get it to work with DOSBox ;)
Yes, you can just tell it to ignore the errors (which shouldn't be there in the first place). It will produce code that will work (probably - most of the time).
Unreadable squiggle

jahboater
Posts: 5759
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: MAKE errors

Sat Jul 11, 2020 9:37 am

rpdom wrote:
Sat Jul 11, 2020 8:53 am
shaunluke wrote:
Sat Jul 11, 2020 7:43 am
I just actually managed to resolve this. There is a note in the makefile file "# Disable -Werror if there are compile errors ". I removed -Werror and now it compiles and executes fine
Yes, you can just tell it to ignore the errors (which shouldn't be there in the first place). It will produce code that will work (probably - most of the time).
+1
Its a bit like disconnecting the oil warning light in your car when it comes on, instead of stopping and adding some oil to the engine :)

By the way, its a C program error (a poorly written C program), nothing to do with make.
Pi4 8GB running PIOS64

shaunluke
Posts: 9
Joined: Thu Jun 25, 2020 4:57 am

Re: MAKE errors

Sat Jul 11, 2020 10:46 am

jahboater wrote:
Sat Jul 11, 2020 9:37 am
rpdom wrote:
Sat Jul 11, 2020 8:53 am
shaunluke wrote:
Sat Jul 11, 2020 7:43 am
I just actually managed to resolve this. There is a note in the makefile file "# Disable -Werror if there are compile errors ". I removed -Werror and now it compiles and executes fine
Yes, you can just tell it to ignore the errors (which shouldn't be there in the first place). It will produce code that will work (probably - most of the time).
+1
Its a bit like disconnecting the oil warning light in your car when it comes on, instead of stopping and adding some oil to the engine :)

By the way, its a C program error (a poorly written C program), nothing to do with make.
I'm sure you're right, and not something I would do in an environment/language I'm proficient or indeed employed in.
Not sure I'm going to be able to use this joystick mapper anyway as there doesn't appear to be any way to convince DOSBox to load a 3rd joystick i.e. the virtual joystick, js2, that the utility creates, along with my Thrustmaster and arcade controller PCB if indeed that is how it is supposed to work. There's nothing docementing how DOSBox works with the Linux Joystick Mapper so this is all very much trial and error

Thanks for the help

Return to “Troubleshooting”