Opened 3 weeks ago

Last modified 3 weeks ago

#70812 new defect

ossp-uuid +universal won't build under Sequoia

Reported by: BarneyStratford Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Port: ossp-uuid

Description

The arm64 part of the universal build runs just fine but the x86_64 part does not. Under arm64, ./configure correctly detects ac_cv_va_copy=C99. Under x86_64, the Portfile forces ac_cv_va_copy=yes, which isn't a valid value for the configure script to use. Without forcing ac_cv_va_copy=yes, ./configure correctly detects ac_cv_va_copy=C99 under x86_64 as well and the build runs to completion.

The relevant part of main.log reads:

:info:build libtool: compile:  /usr/bin/clang -I. -I. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -DHAVE_CONFIG_H -Os -arch x86_64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk -pipe -c uuid_str.c  -fno-common -DPIC -o .libs/uuid_str.o
:info:build uuid_str.c:699:5: error: call to undeclared function '__VA_COPY_USE_yes'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   699 |     va_copy(ap_tmp, ap);
:info:build       |     ^
:info:build ./config.h:212:23: note: expanded from macro 'va_copy'
:info:build   212 | #define va_copy(d, s) __VA_COPY_USE(d, s)
:info:build       |                       ^
:info:build ./config.h:217:23: note: expanded from macro '__VA_COPY_USE'
:info:build   217 | #define __VA_COPY_USE __VA_COPY_USE_yes
:info:build       |                       ^
:info:build uuid_str.c:738:9: error: call to undeclared function '__VA_COPY_USE_yes'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build   738 |         va_copy(ap_tmp, ap);
:info:build       |         ^
:info:build ./config.h:212:23: note: expanded from macro 'va_copy'
:info:build   212 | #define va_copy(d, s) __VA_COPY_USE(d, s)
:info:build       |                       ^
:info:build ./config.h:217:23: note: expanded from macro '__VA_COPY_USE'
:info:build   217 | #define __VA_COPY_USE __VA_COPY_USE_yes
:info:build       |                       ^
:info:build 2 errors generated.

I'll attach both config.log files.

Attachments (2)

config.log (57.1 KB) - added by BarneyStratford 3 weeks ago.
uuid-1.6.2-arm64/config.log
config.2.log (134.4 KB) - added by BarneyStratford 3 weeks ago.
uuid-1.6.2-x86_64/config.log

Download all attachments as: .zip

Change History (5)

Changed 3 weeks ago by BarneyStratford

Attachment: config.log added

uuid-1.6.2-arm64/config.log

Changed 3 weeks ago by BarneyStratford

Attachment: config.2.log added

uuid-1.6.2-x86_64/config.log

comment:1 Changed 3 weeks ago by jmroot (Joshua Root)

Cc: kencu MarcusCalhoun-Lopez added
Port: ossp-uuid added; ossp_uuid removed
Summary: ossp_uuid +universal won't build under Sequoiaossp-uuid +universal won't build under Sequoia

comment:2 Changed 3 weeks ago by kencu (Ken)

Forcing ac_cv_va_copy=yes has been in the Portfile for 15 years:

<https://github.com/macports/macports-ports/commit/fad4ce24b13740f00bb10dd4826302d27776fc7a#diff-b85b5f400cccc474bd41bd1bc78f2079713c8ee9b59f91f3a416586fa172ff05R35>

and I simply extended that use a few years ago to add the new arm64 platform <https://github.com/macports/macports-ports/commit/18d8336a2f6c16c5f6cefa0a26d44a240511519a> adding one more entry to fix the failing universal build at that time, which worked well enough up to now.

However, according to to ChatGPT, ac_cv_va_copy=yes was not the right fix.

The error you're encountering is related to the misuse of the `va_copy` macro, which is intended to copy a variable argument list (of type `va_list`). The macro expansion in your case seems problematic, specifically the declaration `__VA_COPY_USE_yes`, which is not recognized as a valid function or macro.

### Here's what's going wrong:
1. The error message indicates that `__VA_COPY_USE_yes` is being used as part of a `va_copy` macro, but it is not defined anywhere.
2. This error arises due to an implicit function declaration issue, which is disallowed in ISO C99 and later standards.

### To fix this issue:

1. **Check the `config.h` file**:  
   The root of the issue lies in the `config.h` file:
   ```c
   #define va_copy(d, s) __VA_COPY_USE(d, s)
   ```
   The macro `__VA_COPY_USE` is incorrectly expanding to `__VA_COPY_USE_yes`, which isn't a valid function.

   You need to either replace this macro with the correct `va_copy` function or adjust how the `__VA_COPY_USE` macro is being defined.

2. **Use standard `va_copy`**:  
   The `va_copy` macro is part of the C99 standard, and its proper usage looks like this:
   ```c
   #ifdef __GNUC__
   #  define va_copy(d,s) __builtin_va_copy(d,s)
   #else
   #  define va_copy(d,s) (d = s)
   #endif
   ```
   If your platform supports `__builtin_va_copy`, you should use it.

3. **Modify the `config.h` definitions**:  
   Check if you can replace:
   ```c
   #define va_copy(d, s) __VA_COPY_USE(d, s)
   ```
   with:
   ```c
   #define va_copy(d, s) __builtin_va_copy(d, s)
   ```
   or another correct variant of `va_copy` for your compiler.

4. **Verify Clang version and target SDK**:  
   You may want to verify the compatibility of the Clang version with the target SDK (`MacOSX15.sdk`) you are compiling against. Certain SDK or compiler version mismatches can lead to incorrect macro expansion or compilation issues.

By resolving the incorrect `__VA_COPY_USE` macro and replacing it with a valid `va_copy` implementation, the errors should be resolved.

Whether it needs a different fix, or any fix at all any more, and what platforms may or may not need the fix to properly build universal will be an interesting project for someone to tackle.

The port has a significant number of installs based on MacPorts' metrics, so I'll leave this for someone to take on who has time to invest in it.

Last edited 3 weeks ago by kencu (Ken) (previous) (diff)

comment:3 Changed 3 weeks ago by kencu (Ken)

Cc: kencu removed
Note: See TracTickets for help on using tickets.