I'm working on some open source code; I have a configure.ac, in which I've added the following:
: ${FFT_MODE=1}
AC_ARG_VAR([FFT_MODE], [1 for fftw3, 2 for kiss_fft])
AC_DEFINE_UNQUOTED([FFTMODE], [$FFT_MODE],
[1 for fftw3, 2 for kiss_fft])
The idea is that (after calling autoconf --install), the user can run e.g. ./configure FFT_MODE=2 to switch modes. Now, I thought it was working - the status check at the end of the configuration file output the correct value, and an if/elif/endif in my code showed the correct block was executing. However - at some point I added an else, and discovered that both the if AND else blocks were running. First I thought my compiler was possessed, then I realized the file was getting loaded twice, and the second time, for some reason, FFTMODE is unset (or set to zero or something). I don't understand how, though. FTR, the check is in a file fsk.h, like so:
#warning before
#if(FFTMODE == 1)
#warning FFTMODE 1
#include <fftw3.h>
#elif(FFTMODE == 2)
#warning FFTMODE 2
#include <kiss_fftr.h>
#else
#warning FFTMODE ???
#error Unsupported FFTMODE
#endif
#warning after
The output of make is as follows:
make all-recursive
make[1]: Entering directory '/home/erhannis/mods/minimodem'
Making all in src
make[2]: Entering directory '/home/erhannis/mods/minimodem/src'
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT minimodem.o -MD -MP -MF .deps/minimodem.Tpo -c -o minimodem.o minimodem.c
In file included from minimodem.c:43:
fsk.h:20:2: warning: #warning before [-Wcpp]
20 | #warning before
| ^~~~~~~
fsk.h:22:2: warning: #warning FFTMODE 1 [-Wcpp]
22 | #warning FFTMODE 1
| ^~~~~~~
In file included from minimodem.c:43:
fsk.h:31:2: warning: #warning after [-Wcpp]
31 | #warning after
| ^~~~~~~
mv -f .deps/minimodem.Tpo .deps/minimodem.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT databits_ascii.o -MD -MP -MF .deps/databits_ascii.Tpo -c -o databits_ascii.o databits_ascii.c
mv -f .deps/databits_ascii.Tpo .deps/databits_ascii.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT databits_binary.o -MD -MP -MF .deps/databits_binary.Tpo -c -o databits_binary.o databits_binary.c
mv -f .deps/databits_binary.Tpo .deps/databits_binary.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT databits_callerid.o -MD -MP -MF .deps/databits_callerid.Tpo -c -o databits_callerid.o databits_callerid.c
mv -f .deps/databits_callerid.Tpo .deps/databits_callerid.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT databits_baudot.o -MD -MP -MF .deps/databits_baudot.Tpo -c -o databits_baudot.o databits_baudot.c
mv -f .deps/databits_baudot.Tpo .deps/databits_baudot.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT baudot.o -MD -MP -MF .deps/baudot.Tpo -c -o baudot.o baudot.c
mv -f .deps/baudot.Tpo .deps/baudot.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT databits_uic.o -MD -MP -MF .deps/databits_uic.Tpo -c -o databits_uic.o databits_uic.c
mv -f .deps/databits_uic.Tpo .deps/databits_uic.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT uic_codes.o -MD -MP -MF .deps/uic_codes.Tpo -c -o uic_codes.o uic_codes.c
mv -f .deps/uic_codes.Tpo .deps/uic_codes.Po
gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -Wall -g -O2 -MT fsk.o -MD -MP -MF .deps/fsk.Tpo -c -o fsk.o fsk.c
In file included from fsk.c:30:
fsk.h:20:2: warning: #warning before [-Wcpp]
20 | #warning before
| ^~~~~~~
fsk.h:28:2: warning: #warning FFTMODE ??? [-Wcpp]
28 | #warning FFTMODE ???
| ^~~~~~~
fsk.h:29:2: error: #error Unsupported FFTMODE
29 | #error Unsupported FFTMODE
| ^~~~~
fsk.h:31:2: warning: #warning after [-Wcpp]
31 | #warning after
| ^~~~~~~
fsk.c: In function ‘fsk_bit_analyze’:
fsk.c:200:10: error: ‘mag_mark’ undeclared (first use in this function)
200 | if ( mag_mark > mag_space ) {
| ^~~~~~~~
fsk.c:200:10: note: each undeclared identifier is reported only once for each function it appears in
fsk.c:200:21: error: ‘mag_space’ undeclared (first use in this function)
200 | if ( mag_mark > mag_space ) {
| ^~~~~~~~~
fsk.c:166:11: warning: unused variable ‘magscalar’ [-Wunused-variable]
166 | float magscalar = 2.0f / (float)bit_nsamples;
| ^~~~~~~~~
fsk.c: In function ‘fsk_detect_carrier’:
fsk.c:628:1: warning: control reaches end of non-void function [-Wreturn-type]
628 | }
| ^
make[2]: *** [Makefile:470: fsk.o] Error 1
make[2]: Leaving directory '/home/erhannis/mods/minimodem/src'
make[1]: *** [Makefile:361: all-recursive] Error 1
make[1]: Leaving directory '/home/erhannis/mods/minimodem'
make: *** [Makefile:302: all] Error 2
So, what's going on? There IS one instance of #undef FFTMODE in config.h.in - but while I can guess that file's for cleaning up after the build is done, the build isn't done yet, so why's it cleaning up the definitions I'm still using?
The source code is at https://github.com/erhannis/minimodem/tree/feature/alternate_fft; the relevant file is src/fsk.h.
I think you're confusing yourself with this idea that the file is getting loaded twice. That doesn't seem to be the case, from the output you show.
Instead, the file is getting loaded one time each, in two different compile commands. Once when compiling minimodem.c and once when compiling fsk.c. Those are totally different compile operations.
In minimodem.c, the value of FFTMODE is 1. In fsk.c, FFTMODE is unset.
This is easily explained: in minimodem.c you #include "config.h" before you #include "fsk.h", and so when fsk.h is parsed you have a value for FFTMODE. In fsk.c you don't #include "config.h", so there is no value for FFTMODE.
If your fsk.h file needs values from config.h, then it may be best to #include "config.h" in fsk.h. If you don't want to do that you need to make sure it's included by all the .c files, before fsk.h.
Related
I applied the 2 patches mentioned by the original author of Delegate 9.9.13 but still encountered another build error as shown below. Could someone suggest a fix for such error. Thanks a lot.
The patches by the original author: Failed compile delegate Raspbian
cc -O2 -x c++ -DQS -I../gen -I../include -c conf.c \
-DADMIN=\"python#dell-e7470\" \
-DADMINPASS=\"\"
conf.c: In function ‘int myid_mainX(int, const char**, FILE*)’:
conf.c:1240:40: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
1240 | int with_gethostbyname2();
| ^~
conf.c:1240:40: note: remove parentheses to default-initialize a variable
1240 | int with_gethostbyname2();
| ^~
| --
conf.c:1240:40: note: or replace parentheses with braces to value-initialize a variable
cc -O2 -x c++ -DQS -I../gen -I../include -c svport.c
cc -O2 -x c++ -DQS -I../gen -I../include -c ddi.c
cc -O2 -x c++ -DQS -I../gen -I../include -c textconv.c
cc -O2 -x c++ -DQS -I../gen -I../include -c script.c
cc -O2 -x c++ -DQS -I../gen -I../include -c param.c
cc -O2 -x c++ -DQS -I../gen -I../include -c env.c
env.c: In function ‘void confCGI(Connection_01*, DYConf*, CLArg*, FILE*, const char*)’:
env.c:2083:15: error: ordered comparison of pointer with integer zero (‘int’ and ‘char*’)
2083 | if( 0 <= esock ){
| ~~^~~~~~~~
make[2]: *** [Makefile.go:754: env.o] Error 1
make[2]: Leaving directory '/home/python/delegate/src'
make[1]: *** [Makefile:376: start0] Error 2
make[1]: Leaving directory '/home/python/delegate/src'
mkmake: ERROR LOG is left at /home/python/delegate/src/mkmake.err
mkmake: ERROR LOG is left at /home/python/delegate/src/mkmake.err
make: *** [Makefile:77: all] Error 2
I'm on a MacOS and when I try to make the file it throws an out of bounds possibility error is there a way to fix this error? I need it to build an os from the MIT OS class.
Source: https://pdos.csail.mit.edu/6.828/2009/tools.html
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_bfd_elf32_i386_vec -DHAVE_i386coff_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR='"/usr/local/bin"' -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT elf32-i386.lo -MD -MP -MF .deps/elf32-i386.Tpo -c -o elf32-i386.lo elf32-i386.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_bfd_elf32_i386_vec -DHAVE_i386coff_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -g -O2 -MT elf32-i386.lo -MD -MP -MF .deps/elf32-i386.Tpo -c elf32-i386.c -o elf32-i386.o
elf32-i386.c:326:15: error: array index 42 is past the end of the array (which contains 34 elements) [-Werror,-Warray-bounds]
return &elf_howto_table[R_386_IRELATIVE];
^ ~~~~~~~~~~~~~~~
elf32-i386.c:37:1: note: array 'elf_howto_table' declared here
static reloc_howto_type elf_howto_table[]=
^
1 error generated.
I am trying to build my own lfs system for Raspberry PI 2.
As a part of it I am trying to compile gcc on Raspberry PI 2, with raspbian as a base operating system.
I could build the binutils using the instructions on lfs development version. But while compiling gcc I am getting below error
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc-5.2.0/gcc -I../../gcc-5.2.0/gcc/. -I../../gcc-5.2.0/gcc/../include -I../../gcc-5.2.0/gcc/../libcpp/include -I/mnt/lfs/sources/gcc-build/./gmp -I/mnt/lfs/sources/gcc-5.2.0/gmp -I/mnt/lfs/sources/gcc-build/./mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpc/src -I../../gcc-5.2.0/gcc/../libdecnumber -I../../gcc-5.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-5.2.0/gcc/../libbacktrace -o except.o -MT except.o -MMD -MP -MF ./.deps/except.TPo ../../gcc-5.2.0/gcc/except.c
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc-5.2.0/gcc -I../../gcc-5.2.0/gcc/. -I../../gcc-5.2.0/gcc/../include -I../../gcc-5.2.0/gcc/../libcpp/include -I/mnt/lfs/sources/gcc-build/./gmp -I/mnt/lfs/sources/gcc-5.2.0/gmp -I/mnt/lfs/sources/gcc-build/./mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpc/src -I../../gcc-5.2.0/gcc/../libdecnumber -I../../gcc-5.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-5.2.0/gcc/../libbacktrace -o explow.o -MT explow.o -MMD -MP -MF ./.deps/explow.TPo ../../gcc-5.2.0/gcc/explow.c
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc-5.2.0/gcc -I../../gcc-5.2.0/gcc/. -I../../gcc-5.2.0/gcc/../include -I../../gcc-5.2.0/gcc/../libcpp/include -I/mnt/lfs/sources/gcc-build/./gmp -I/mnt/lfs/sources/gcc-5.2.0/gmp -I/mnt/lfs/sources/gcc-build/./mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpc/src -I../../gcc-5.2.0/gcc/../libdecnumber -I../../gcc-5.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-5.2.0/gcc/../libbacktrace -o expmed.o -MT expmed.o -MMD -MP -MF ./.deps/expmed.TPo ../../gcc-5.2.0/gcc/expmed.c
../../gcc-5.2.0/gcc/wide-int.h: In function 'long long unsigned int choose_multiplier(long long unsigned int, int, int, long long unsigned int*, int*, int*)':
../../gcc-5.2.0/gcc/wide-int.h:798:57: warning: array subscript is below array bounds [-Warray-bounds]
../../gcc-5.2.0/gcc/wide-int.h:798:57: warning: array subscript is below array bounds [-Warray-bounds]
g++ -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I../../gcc-5.2.0/gcc -I../../gcc-5.2.0/gcc/. -I../../gcc-5.2.0/gcc/../include -I../../gcc-5.2.0/gcc/../libcpp/include -I/mnt/lfs/sources/gcc-build/./gmp -I/mnt/lfs/sources/gcc-5.2.0/gmp -I/mnt/lfs/sources/gcc-build/./mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpfr/src -I/mnt/lfs/sources/gcc-5.2.0/mpc/src -I../../gcc-5.2.0/gcc/../libdecnumber -I../../gcc-5.2.0/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc-5.2.0/gcc/../libbacktrace -o expr.o -MT expr.o -MMD -MP -MF ./.deps/expr.TPo ../../gcc-5.2.0/gcc/expr.c
../../gcc-5.2.0/gcc/expr.c: In function 'void store_constructor(tree, rtx, int, long long int)':
../../gcc-5.2.0/gcc/expr.c:6529:1: internal compiler error: output_operand: invalid shift operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccAUc9Pu.out file, please attach this to your bugreport.
Makefile:1065: recipe for target 'expr.o' failed
make[2]: *** [expr.o] Error 1
make[2]: Leaving directory '/mnt/lfs/sources/gcc-build/gcc'
Makefile:4105: recipe for target 'all-gcc' failed
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory '/mnt/lfs/sources/gcc-build'
Makefile:858: recipe for target 'all' failed
make: *** [all] Error 2
I tried to trace the cause of error by looking at the expr.c file, but could not find issue. I have uploaded the "/tmp/ccAUc9Pu.out" to http://turl.ca/dcfansr
Can someone please help me how to debug the exact cause of issue
I had the same problem after checking all the system requirements were installed by running the version check at http://www.linuxfromscratch.org/lfs/view/stable-systemd/prologue/hostreqs.html and rebooting the system it worked afterwards.
I am trying to compile SVGA source to build for shared-library object.
while compiling i am getting this error
make[1]: Entering directory `/home/manmatha/Downloads/svgalib-1.9.25/utils'
gcc -I../include -I. -MM ../utils/restorefont.c ../utils/convfont.c ../utils/restoretextmode.c ../utils/restorepalette.c ../utils/dumpreg.c >.depend
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restorefont.o restorefont.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restorefont restorefont.o -lvga -lm
chmod 4755 restorefont
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o convfont.o convfont.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o convfont convfont.o -lvga -lm
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restoretextmode.o restoretextmode.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restoretextmode restoretextmode.o -lvga -lm
chmod 4755 restoretextmode
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o restorepalette.o restorepalette.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o restorepalette restorepalette.o -lvga -lm
chmod 4755 restorepalette
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -c -o dumpreg.o dumpreg.c
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o dumpreg dumpreg.o -lvga -lm
chmod 4755 dumpreg
cc -Wall -Wstrict-prototypes -fomit-frame-pointer -O2 -fno-strength-reduce -pipe -I../include -L../sharedlib -s -o gtfcalc -DTESTING_GTF gtf/gtfcalc.c -lvga -lm
gtf/gtfcalc.c:67: error: static declaration of ‘round’ follows non-static declaration
make[1]: *** [gtfcalc] Error 1
make[1]: Leaving directory `/home/manmatha/Downloads/svgalib-1.9.25/utils'
make: *** [textutils] Error 2
Edit::Yes the patch works..But the compilation encounters the next error while compiling the svga_helper.ko module
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:1:26: error: linux/config.h: No such file or directory
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:20:35: error: linux/devfs_fs_kernel.h: No such file or directory
In file included from /home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:42:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h: In function ‘devfs_unregister_chrdev’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/kernel26compat.h:80: error: void value not ignored as it ought to be
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘svgalib_helper_ioctl’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:237: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:242: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:247: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:252: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:258: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:264: warning: cast to pointer from integer of different size
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: (Each undeclared identifier is reported only once
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: error: for each function it appears in.)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:358: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:123: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int, void *, struct pt_regs *)’
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘svgalib_helper_open’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:446: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:446: warning: passing argument 2 of ‘request_irq’ from incompatible pointer type
include/linux/interrupt.h:123: note: expected ‘irq_handler_t’ but argument is of type ‘enum irqreturn_t (*)(int, void *, struct pt_regs *)’
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c: In function ‘init_module’:
/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.c:651: error: implicit declaration of function ‘class_device_create’
make[3]: *** [/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper/main.o] Error 1
make[2]: *** [_module_/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.32-358.0.1.el6.x86_64'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/home/manmatha/Downloads/svgalib-1.9.25/kernel/svgalib_helper'
make: *** [installmodule] Error 2
I think you want to go for a newer version of svgalib. 1.4.3 is pretty old and no longer maintained. If I remember correctly it needed to be patched to work with newer compilers as well.
Try one of the 1.9.x versions from http://svgalib.org/
For later versions, if you get the error:
error: static declaration of 'round' follows non-static declaration
Apply the following patch:
--- svgalib-1.9.25/utils/gtf/gtfcalc.c
+++ svgalib-1.9.25/utils/gtf/gtfcalc.c
## -68,5 +68,5 ##
-static double round(double v)
+double round(double v)
{
return floor(v + 0.5);
}
EDIT:
With your latest compile issue in the svga_helper.ko module, set the NO_HELPER variable to disable building svga_helper.ko. config.h etc. were removed form more recent kernels. From the Readme:
There is a compile time option to return to old behaviour, of using
root privileges to access /dev/mem, instead of svgalib helper. To
compile for this select the NO_HELPER option in Makefile.cfg.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Repeated Multiple Definition Errors from including same header in multiple cpps
I'm hitting the following error when compiling a third-party src:
.libs/lib_udf_la-udf.o:(.rodata+0x240): multiple definition of `SHIFT_TABLE'
.libs/lib_udf_la-hll.o:(.rodata+0x0): first defined here
The project is set up with autotools; my Makefile.ag references the following:
SOURCES = hll.c udf.c udf.h
hll.c references hll.h
udf.c references hll.h
hll.h has some const like this:
hll.h has the #ifndef HLL_H ... #endif thing to avoid double defs
int const SHIFT_TABLE[1024] = {...}
I don't understand why I'm hitting multiple definitions, I'm guessing it has to do with the link step, but it is a long time since I dabbled with C.
Here's the cc/link output for reference:
make[1]: Entering directory `/home/mping/workspace/monetdb/MonetDB-11.13.5/sql/backends/monet5/UDF'
/bin/bash ../../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../.. -I. -I.. -I./.. -I../../../include -I./../../../include -I../../../common -I./../../../common -I../../../storage -I./../../../storage -I../../../server -I./../../../server -I../../../../monetdb5/modules/atoms -I./../../../../monetdb5/modules/atoms -I../../../../monetdb5/modules/kernel -I./../../../../monetdb5/modules/kernel -I../../../../monetdb5/mal -I./../../../../monetdb5/mal -I../../../../monetdb5/modules/mal -I./../../../../monetdb5/modules/mal -I../../../../monetdb5/optimizer -I./../../../../monetdb5/optimizer -I../../../../clients/mapilib -I./../../../../clients/mapilib -I../../../../common/options -I./../../../../common/options -I../../../../common/stream -I./../../../../common/stream -I../../../../gdk -I./../../../../gdk -DLIBUDF -g -O2 -c -o lib_udf_la-hll.lo `test -f 'hll.c' || echo './'`hll.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../.. -I. -I.. -I./.. -I../../../include -I./../../../include -I../../../common -I./../../../common -I../../../storage -I./../../../storage -I../../../server -I./../../../server -I../../../../monetdb5/modules/atoms -I./../../../../monetdb5/modules/atoms -I../../../../monetdb5/modules/kernel -I./../../../../monetdb5/modules/kernel -I../../../../monetdb5/mal -I./../../../../monetdb5/mal -I../../../../monetdb5/modules/mal -I./../../../../monetdb5/modules/mal -I../../../../monetdb5/optimizer -I./../../../../monetdb5/optimizer -I../../../../clients/mapilib -I./../../../../clients/mapilib -I../../../../common/options -I./../../../../common/options -I../../../../common/stream -I./../../../../common/stream -I../../../../gdk -I./../../../../gdk -DLIBUDF -g -O2 -c hll.c -fPIC -DPIC -o .libs/lib_udf_la-hll.o
/bin/bash ../../../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../.. -I. -I.. -I./.. -I../../../include -I./../../../include -I../../../common -I./../../../common -I../../../storage -I./../../../storage -I../../../server -I./../../../server -I../../../../monetdb5/modules/atoms -I./../../../../monetdb5/modules/atoms -I../../../../monetdb5/modules/kernel -I./../../../../monetdb5/modules/kernel -I../../../../monetdb5/mal -I./../../../../monetdb5/mal -I../../../../monetdb5/modules/mal -I./../../../../monetdb5/modules/mal -I../../../../monetdb5/optimizer -I./../../../../monetdb5/optimizer -I../../../../clients/mapilib -I./../../../../clients/mapilib -I../../../../common/options -I./../../../../common/options -I../../../../common/stream -I./../../../../common/stream -I../../../../gdk -I./../../../../gdk -DLIBUDF -g -O2 -c -o lib_udf_la-udf.lo `test -f 'udf.c' || echo './'`udf.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../../.. -I. -I.. -I./.. -I../../../include -I./../../../include -I../../../common -I./../../../common -I../../../storage -I./../../../storage -I../../../server -I./../../../server -I../../../../monetdb5/modules/atoms -I./../../../../monetdb5/modules/atoms -I../../../../monetdb5/modules/kernel -I./../../../../monetdb5/modules/kernel -I../../../../monetdb5/mal -I./../../../../monetdb5/mal -I../../../../monetdb5/modules/mal -I./../../../../monetdb5/modules/mal -I../../../../monetdb5/optimizer -I./../../../../monetdb5/optimizer -I../../../../clients/mapilib -I./../../../../clients/mapilib -I../../../../common/options -I./../../../../common/options -I../../../../common/stream -I./../../../../common/stream -I../../../../gdk -I./../../../../gdk -DLIBUDF -g -O2 -c udf.c -fPIC -DPIC -o .libs/lib_udf_la-udf.o
/bin/bash ../../../../libtool --tag=CC --mode=link gcc -DLIBUDF -g -O2 -module -avoid-version -o lib_udf.la -rpath /usr/local/lib/monetdb5 lib_udf_la-hll.lo lib_udf_la-udf.lo ../../../../monetdb5/tools/libmonetdb5.la ../../../../gdk/libbat.la
libtool: link: gcc -shared -fPIC -DPIC .libs/lib_udf_la-hll.o .libs/lib_udf_la-udf.o -Wl,-rpath -Wl,/home/mping/workspace/monetdb/MonetDB-11.13.5/monetdb5/tools/.libs -Wl,-rpath -Wl,/home/mping/workspace/monetdb/MonetDB-11.13.5/gdk/.libs ../../../../monetdb5/tools/.libs/libmonetdb5.so ../../../../gdk/.libs/libbat.so -O2 -pthread -Wl,-soname -Wl,lib_udf.so -o .libs/lib_udf.so
When you define array int const SHIFT_TABLE[1024] = {...} in the header file. and then you make reference to the header file in 2 c file in the same project It's like of defining the array twice in the 2 c files. and that's the cause of your problem.
Even If you use #ifndef that's will not avoid your preprocess to include the definition in the second C file
From Preprocessor #ifndef:
Standard headers may be included in any order; each may be included
more than once in a given scope, with no effect different from being
included only once
You can check that in the preprocess code you will find that the array is defined twice and that's wrong. you can generate your preprocess code with gcc -E
the #ifndef works only when you check the constant macro in different header files and not in the same header file
To avoid that problem you can define your array in one of the c file. And you define the array as extern in the header file
In one of the C files:
int const SHIFT_TABLE[1024] = {...};
In the header file:
extern int const SHIFT_TABLE[1024];