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

Problems building #3

Open
sebastian-davidson opened this issue Nov 5, 2024 · 2 comments
Open

Problems building #3

sebastian-davidson opened this issue Nov 5, 2024 · 2 comments

Comments

@sebastian-davidson
Copy link

I tried compiling this program at first just by running make. The Makefile failed to compile it, because GCC said there was a problem in the HOST macro:

<command-line>: error: ‘compiled’ undeclared here (not in a function)
version.c:3:12: note: in expansion of macro ‘HOST’
    3 | char *host=HOST;
      |            ^~~~
<command-line>: error: expected ‘,’ or ‘;’ before ‘:’ token
version.c:3:12: note: in expansion of macro ‘HOST’
    3 | char *host=HOST;
      |            ^~~~
<command-line>: error: stray ‘\’ in program
version.c:3:12: note: in expansion of macro ‘HOST’
    3 | char *host=HOST;
      |            ^~~~
<command-line>: error: stray ‘\’ in program
version.c:3:12: note: in expansion of macro ‘HOST’
    3 | char *host=HOST;
      |            ^~~~

I changed the flag to -DHOST="\"$(shell cat .host)\"" instead, and then that error went away. So, I tried again.

However, then I ran into a long list of linker errors (which I won't list unless you ask), entirely consisting of multiple definitions of global variables: hd, tl, files, current_file, tag, buf, and commandmode.

Am I doing something wrong when compiling, or does this program need to be updated so as not to have multiple definitions?

@ncihnegn
Copy link
Owner

ncihnegn commented Nov 5, 2024

Try the cmake build please.

@sebastian-davidson
Copy link
Author

Okay, so now I've done this:

$ mkdir build
$ cmake -G "Unix Makefiles" -S . -B build
$ cd build
$ make

It fails to build due to what looks like two errors in the file reduce.c:

[  6%] Building C object CMakeFiles/just.dir/just.c.o
[ 13%] Linking C executable just
[ 13%] Built target just
[ 20%] Building C object CMakeFiles/menudriver.dir/menudriver.c.o
[ 26%] Linking C executable miralib/menudriver
[ 26%] Built target menudriver
[ 33%] Building C object CMakeFiles/mira.dir/big.c.o
[ 40%] Building C object CMakeFiles/mira.dir/cmbnms.c.o
[ 46%] Building C object CMakeFiles/mira.dir/data.c.o
[ 53%] Building C object CMakeFiles/mira.dir/lex.c.o
[ 60%] Building C object CMakeFiles/mira.dir/reduce.c.o
/home/sebastian/Build/miranda/reduce.c: In function ‘outf’:
/home/sebastian/Build/miranda/reduce.c:260:15: error: implicit declaration of function ‘fileno’; did you mean ‘fileinfo’? [-Wimplicit-function-declaration]
  260 |     if(isatty(fileno(s_out)))setbuf(s_out,NULL); /*for unbuffered tty output*/
      |               ^~~~~~
      |               fileinfo
/home/sebastian/Build/miranda/reduce.c: In function ‘reduce’:
/home/sebastian/Build/miranda/reduce.c:1716:24: error: implicit declaration of function ‘fdopen’; did you mean ‘fopen’? [-Wimplicit-function-declaration]
 1716 |             fp=(FILE *)fdopen(fd[0],"r"),
      |                        ^~~~~~
      |                        fopen
/home/sebastian/Build/miranda/reduce.c:1716:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1716 |             fp=(FILE *)fdopen(fd[0],"r"),
      |                ^
/home/sebastian/Build/miranda/reduce.c:1717:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 1717 |             fp_a=(FILE *)fdopen(fd_a[0],"r");
      |                  ^
make[2]: *** [CMakeFiles/mira.dir/build.make:132: CMakeFiles/mira.dir/reduce.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/mira.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

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