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

MacOS compiling libast #1483

Open
stevej098 opened this issue Jul 27, 2020 · 0 comments
Open

MacOS compiling libast #1483

stevej098 opened this issue Jul 27, 2020 · 0 comments

Comments

@stevej098
Copy link

stevej098 commented Jul 27, 2020

I mainly use OS/X & since 2017 have been, on and off, trying to build the AST library to experiment with pzip & friends.
I've not been able to build lib/libast needed to build nmake, which is needed to build the rest.

OS vers:

 steve$ sw_vers -productVersion
 10.14.6

I've got homebrew & tried with ggc-9 as well as default clang. both throw the same errors.

Initially I cloned the master branch and had a problem with varargs. The Mac man page noted that "stdarg.h" wasn't backwards compatible, while "varargs.h" was compatible.

I've cloned the "beta" branch and the "varags" fault is gone.

I'm using:

 bin/package make

I'm left with compilation errors in contab.c, generated by script 'conf' from conf.tab. I've tried editing the generated file directly, but it seems rebuilt each run. Files:

src/lib/libast/comp/conf.tab
arch/darwin.i386-64/src/lib/libast/conftab.c

There are the errors I've find- in the conf[] array initialisation, a macro fails because _SC_ has been prefixed to a #define.
I've tried editing the conf.tab, changing the places it might look, but to no avail.
By commenting out the variables in 'conf.tab', I can make 'conftab.c' compile, but this leads to errors later on.

 conftab.c:89:83: error: '_SC_EQUIV_CLASS_MAX' undeclared here (not in a function); did you mean 'EQUIV_CLASS_MAX'?                 
  89 | { "EQUIV_CLASS_MAX", { 0UL, 0 }, { 0UL, 0 }, CONF_LIMIT, CONF_C, 1, CONF_sysconf, _SC_EQUIV_CLASS_MAX },

The config keys failing are in both 'master' and 'beta' are:

  EQUIV_CLASS_MAX, LOGNAME_MAX, 
  PTHREAD_DESTRUCTOR_ITERATIONS, PTHREAD_KEYS_MAX, PTHREAD_STACK_MIN

In 'beta' only, UID_MAX is throwing an error.
It doesn't seem defined in "limits.h" but syslimits.h. I've no idea why it worked in 'master' branch when conf.tab entries seen the same.

 /usr/include/sys/syslimits.h:#define UID_MAX            2147483647U  /* max value for a uid_t (2^31-2) */

With all the failing conf[] entries commented out of conf.tab,
libast does link and produces an 'nmake' executable, but other build tools, like 'cpp' fail with undefined symbols.

 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libast.a(wc.o) has no symbols
 + 1> /dev/null 2>& 1
 mamake [lib/libast]: /Users/steve/src/ast-beta/src/lib/libast/Mamfile: 5063: ast: improper done statement

I note that the project is going forward with "meson" build environment (available with homebrew)
but only for 'ksh', not the rest of the AST tools.

I've read existing issues and found varying comments on building AST under OS/X (now MacOS).
From some I can infer people are building 'ksh' at least on OS/X, but mostly it's "can't make AST build on a Mac"

I've had trouble finding the make files that drive the process and haven't bumbled into anything describing how to follow that chain.

Can anyone suggest how I go forward?
Especially if I find workarounds, how do I submit patches, to whom?

I haven't included the log file, "arch/darwin.i386-64/lib/package/gen/make.out" as it's 40,000+ lines.
Didn't want to swamp this.

Comments on previous issues related to Mac builds:

#42
#42 (comment)
#42 (comment)

#1438 (comment)

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

1 participant