source-foundry / ttfautohint-build

Build ttfautohint from source on Linux and macOS platforms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macOS 10.10 ttfautohint build bug (gnulib stddef.h)

chrissimpkins opened this issue Β· comments

-I/Users/travis/ttfautohint-build/local/include -g -O2 conftest.c >&5
conftest.c:145:13: error: use of undeclared identifier 'max_align_t'

Evidently the stddef.h found by the above command does not define
max_align_t, whereas the stddef.h found by the command 'CXX main.o'
in https://travis-ci.org/source-foundry/ttfautohint-build/jobs/269031319#L3401
does define max_align_t. Can you investigate why this is so?
Perhaps CXX uses different -I options, or perhaps stddef.h does not
define max_align_t if C++.

I suspect that the used clang version doesn't activate C11 support by
default, while C++11 is available.

Right now I only have the `stddef.h' file of a later XCode version
(from 2015); however, looking at the copyright notice it seems that it
is unchanged. It contains the following.

  #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
      || (defined(__cplusplus) && __cplusplus >= 201103L)
  typedef long double max_align_t;
  #endif

Chris, do you have a chance to check

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0/include/stddef.h

of an OS X 10.10 Travis run whether the definition is identical?

Full stddef.h header file from $cat /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0/include/stddef.h on Travis OS X 10.10 build.

/*===---- stddef.h - Basic type definitions --------------------------------===
 *
 * Copyright (c) 2008 Eli Friedman
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *===-----------------------------------------------------------------------===
 */

#if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) ||                       \
    defined(__need_size_t) || defined(__need_wchar_t) ||                       \
    defined(__need_NULL) || defined(__need_wint_t)

#if !defined(__need_ptrdiff_t) && !defined(__need_size_t) &&                   \
    !defined(__need_wchar_t) && !defined(__need_NULL) &&                       \
    !defined(__need_wint_t)
#define __STDDEF_H
#define __need_ptrdiff_t
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
/* __need_wint_t is intentionally not defined here. */
#endif

#if defined(__need_ptrdiff_t)
#if !defined(_PTRDIFF_T) || __has_feature(modules)
/* Always define ptrdiff_t when modules are available. */
#if !__has_feature(modules)
#define _PTRDIFF_T
#endif
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#endif
#undef __need_ptrdiff_t
#endif /* defined(__need_ptrdiff_t) */

#if defined(__need_size_t)
#if !defined(_SIZE_T) || __has_feature(modules)
/* Always define size_t when modules are available. */
#if !__has_feature(modules)
#define _SIZE_T
#endif
typedef __SIZE_TYPE__ size_t;
#endif
#undef __need_size_t
#endif /*defined(__need_size_t) */

#if defined(__STDDEF_H)
/* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
 * enabled. */
#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
     !defined(_RSIZE_T)) || __has_feature(modules)
/* Always define rsize_t when modules are available. */
#if !__has_feature(modules)
#define _RSIZE_T
#endif
typedef __SIZE_TYPE__ rsize_t;
#endif
#endif /* defined(__STDDEF_H) */

#if defined(__need_wchar_t)
#ifndef __cplusplus
/* Always define wchar_t when modules are available. */
#if !defined(_WCHAR_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WCHAR_T
#if defined(_MSC_EXTENSIONS)
#define _WCHAR_T_DEFINED
#endif
#endif
typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
#undef __need_wchar_t
#endif /* defined(__need_wchar_t) */

#if defined(__need_NULL)
#undef NULL
#ifdef __cplusplus
#  if !defined(__MINGW32__) && !defined(_MSC_VER)
#    define NULL __null
#  else
#    define NULL 0
#  endif
#else
#  define NULL ((void*)0)
#endif
#ifdef __cplusplus
#if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
namespace std { typedef decltype(nullptr) nullptr_t; }
using ::std::nullptr_t;
#endif
#endif
#undef __need_NULL
#endif /* defined(__need_NULL) */

#if defined(__STDDEF_H)

#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) || __has_feature(modules)
#if defined(_MSC_VER)
typedef double max_align_t;
#elif defined(__APPLE__)
typedef long double max_align_t;
#else
// Define 'max_align_t' to match the GCC definition.
typedef struct {
  long long __clang_max_align_nonce1
      __attribute__((__aligned__(__alignof__(long long))));
  long double __clang_max_align_nonce2
      __attribute__((__aligned__(__alignof__(long double))));
} max_align_t;
#endif
#define __CLANG_MAX_ALIGN_T_DEFINED
#endif
#endif

#define offsetof(t, d) __builtin_offsetof(t, d)
#endif  /* __STDDEF_H */

/* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
__WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
#if defined(__need_wint_t)
/* Always define wint_t when modules are available. */
#if !defined(_WINT_T) || __has_feature(modules)
#if !__has_feature(modules)
#define _WINT_T
#endif
typedef __WINT_TYPE__ wint_t;
#endif
#undef __need_wint_t
#endif /* __need_wint_t */

#endif

@lemzwerg The email download site that you sent the link from requires registration. Mind uploading the file that you would like to build here or push any new script to a new branch in the repository?

You can branch https://github.com/source-foundry/ttfautohint-build/tree/osx10.10-testing and push new commits to build changes. Travis is automated on all branches and will build any branch when new commits are pushed to it.

osx10.10-testing currently only builds OS X 10.10 after the commit that I pushed this morning. The branches off of that for ttfautohint/harfbuzz/freetype still build across all platform versions and cat the config.log files for the respective library/executable build.

https://travis-ci.org/source-foundry/ttfautohint-build is the link to Travis results. Click branches tab to see all branches in the repository.

Happy to help however I can. Let me know what I can do.

I think that I mentioned this before, but you have full admin access on this repository. Treat it as your own, add any collaborators that you need to do any necessary work here. I intend to pull request changes to you for review prior to any further modifications that I make (that aren't directly requested).

(and all pull requests are built on Travis before merge so you can review everything internal or PR'd in from downstream forks before you merge it)...

@chrissimpkins, it is not necessary to register for downloading the file! :-)

Anyway, here it is.

ttfautohint-1.7-dirty.zip

I still have to dig into Travis usage, but this will take time, so I would be glad if you beat me timewise :-)

it is not necessary to register for downloading the file!

It looks like a third party cookie blocker led to this issue. If I accepted it took me to the download prompt. If not, it took me to a signup page.

here it is.

This looks like a new source directory. Confirming that you would like me to push this source and build from it with the same set of environment variables and same configure commands that we were executing with the source that we pulled from the gnu.org hosting site?

I still have to dig into Travis usage

No worries at all. I am more than happy to help. Let me know that I am ok to build with the current approach in the ttfautohint-build.sh install script with the only modification being that we will cd ttfautohint-1.7-dirty into the unpacked source and execute the existing configure command (with all current arguments).

Sorry for the late reply; for some reasons, I didn't receive an e-mail notification of your last comment.

I've now committed a new branch 'osx10.10-testing-temporary' which tests the 'dirty' tarball – and it works! I'll probably release ttfautohint 1.7.1 so that there is one tarball for all platforms.

@lemzwerg

πŸ‘ πŸ‘ πŸ‘

Great! We can update the build script here with the new release version when it is available. Worth pointing the (at least OS X) install from scratch docs here or adding a git clone vs cURL approach to your docs that uses the install script here?

Once v1.7.1 is out and available (with updated build script here) I will add the OS X v10.10 build testing back to the Travis defaults in the master branch. As new OS X (and Travis Ubuntu testing distro) releases become available, I will keep this updated.

@lemzwerg Werner, just confirming that the changes on the Gnu stddef.h side would not be expected to modify this issue in the OS X 10.10 version? I don't believe that this should be the case. Is there still a plan to release a ttfautohint v1.7.1 patch for this issue?

Sorry, I don't understand your first two sentences. Please reformulate.

I would like to wait a bit with release 1.7.1 – maybe more bug reports will come. Is there something urgent?

@lemzwerg no nothing urgent at all. The change that was made on the Gnu side in the stddef.h library file (based upon email chain that I was included in for your bug report) should not influence an old version of OS X (specifically 10.10) should it? I don't believe that there are any further updates to 10.10 that will be released and therefore that change should not fix the problem that we originally identified here correct? The header file seems to be associated with the clang compiler in OS X. Therefore, clang would need to be updated to pick up any stddef.h changes that are released by the Gnu team?

The gnulib fix would make the ttfautohint 1.7 source code compile out of the box on OS X 10.10. However, it would be necessary (a) to update the used gnulib version, and (b) to re-run the bootstrap script to regenerate (and copy) the necessary files.

Meanwhile, the current git version fixes the issue in a different way – eventually, I have to redesign the configuring stuff anyway to avoid mixing C and C++.

got it! ok thanks. was going to push the os x tests back to master if there was a reason to believe that change fixed things without further changes to the build approach.

Closing as this is a dated macOS release. macOS 10.10 is over 4 years old and the last Apple update to 10.10 was nearly two years ago.