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

Anacron can not be compiled on musl #50

Closed
BKPepe opened this issue Nov 24, 2019 · 5 comments · Fixed by #64
Closed

Anacron can not be compiled on musl #50

BKPepe opened this issue Nov 24, 2019 · 5 comments · Fixed by #64

Comments

@BKPepe
Copy link
Contributor

BKPepe commented Nov 24, 2019

As in the latest version of cronie 1.5.5, there is enabled Anacron by default, which can not be compiled on musl.

anacron/readtab.c:33:10: fatal error: obstack.h: No such file or directory
 #include <obstack.h>

I solved it by BKPepe@a7eb66a, afterwards more warnings and error appeared:

anacron/readtab.c: In function 'read_tab_line':
anacron/readtab.c:99:21: warning: implicit declaration of function 'obstack_1grow' [-Wimplicit-function-declaration]
      if (0 != prev) obstack_1grow(&input_o, (char)prev);
                     ^~~~~~~~~~~~~
anacron/readtab.c:110:12: warning: implicit declaration of function 'obstack_finish'; did you mean 'obstack_chunk_free'? [-Wimplicit-function-declaration]
     return obstack_finish(&input_o);
            ^~~~~~~~~~~~~~
            obstack_chunk_free
anacron/readtab.c:110:12: warning: return makes pointer from integer without a cast [-Wint-conversion]
     return obstack_finish(&input_o);
            ^~~~~~~~~~~~~~~~~~~~~~~~
anacron/readtab.c: In function 'register_env':
anacron/readtab.c:143:10: warning: implicit declaration of function 'obstack_alloc'; did you mean 'obstack_chunk_alloc'? [-Wimplicit-function-declaration]
     er = obstack_alloc(&tab_o, sizeof(env_rec));
          ^~~~~~~~~~~~~
          obstack_chunk_alloc
anacron/readtab.c:143:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     er = obstack_alloc(&tab_o, sizeof(env_rec));
        ^
anacron/readtab.c:148:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     er->assign = obstack_alloc(&tab_o, var_len + 1 + val_len + 1);
                ^
anacron/readtab.c: In function 'register_job':
anacron/readtab.c:182:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr = obstack_alloc(&tab_o, sizeof(job_rec));
        ^
anacron/readtab.c:191:15: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr->ident = obstack_alloc(&tab_o, ident_len + 1);
               ^
anacron/readtab.c:197:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr->command = obstack_alloc(&tab_o, command_len + 1);
                 ^
anacron/readtab.c: In function 'register_period_job':
anacron/readtab.c:232:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr = obstack_alloc(&tab_o, sizeof(job_rec));
        ^
anacron/readtab.c:252:15: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr->ident = obstack_alloc(&tab_o, ident_len + 1);
               ^
anacron/readtab.c:258:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     jr->command = obstack_alloc(&tab_o, command_len + 1);
                 ^
anacron/readtab.c: In function 'read_tab':
anacron/readtab.c:402:5: warning: implicit declaration of function 'obstack_init' [-Wimplicit-function-declaration]
     obstack_init(&input_o);
     ^~~~~~~~~~~~
anacron/readtab.c:408:2: warning: implicit declaration of function 'obstack_free'; did you mean 'obstack_chunk_free'? [-Wimplicit-function-declaration]
  obstack_free(&input_o, tab_line);
  ^~~~~~~~~~~~
  obstack_chunk_free
anacron/readtab.c: In function 'arrange_jobs':
anacron/readtab.c:444:6: warning: implicit declaration of function 'obstack_grow' [-Wimplicit-function-declaration]
      obstack_grow(&tab_o, &j, sizeof(j));
      ^~~~~~~~~~~~
anacron/readtab.c:448:15: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     job_array = obstack_finish(&tab_o);
               ^
anacron/readtab.c: At top level:
anacron/readtab.c:43:23: error: storage size of 'input_o' isn't known
 static struct obstack input_o;   /* holds input line */
                       ^~~~~~~
anacron/readtab.c:44:23: error: storage size of 'tab_o' isn't known
 static struct obstack tab_o;    /* holds processed data read from anacrontab */
                       ^~~~~
make[4]: *** [Makefile:706: anacron/readtab.o] Error 1

Anyway, when I used --disable-anacron, I am able to compile cronie just fine and it works.

@t8m
Copy link
Member

t8m commented Nov 25, 2019

I would accept PR that would automatically disable anacron (by default, not when explicitly enabled) if there is no obstack.h idetected in configure.

@kadler
Copy link
Contributor

kadler commented Mar 30, 2020

How about including the obstack.h/obstack.c files in the project, as GCC does in libiberty, and building as necessary?

@Kratacoa
Copy link

Is this still an issue as of the recent commits?

@kadler
Copy link
Contributor

kadler commented Jul 30, 2020

I don't see any recent commits that change the obstack code, so I would guess no. Is there something specific you were thinking of @Kratacoa?

@t8m
Copy link
Member

t8m commented Aug 3, 2020

I'd accept any reasonable PR.

@t8m t8m closed this as completed in #64 Aug 3, 2020
t8m pushed a commit that referenced this issue Aug 3, 2020
Neither musl nor AIX (and likely other non-GNU systems) provide the
obstack interface used by anacron. To work around this, include a copy
of obstack.c and obstack.h from libiberty and build them when obstack
support is not detect on the host system.

Fixes #50

Signed-off-by: Kevin Adler <[email protected]>
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

Successfully merging a pull request may close this issue.

4 participants