Nexus Nexus - MATLAB Compatible Computing Platform
← Back to Plans

PHASE2_BUILD_INTEGRATION_STATUS.md

# Phase 2 Build Integration Status

**Date:** 2026-02-06  
**Status:** In Progress - Library Dependency Resolution

## Current Challenge

Compiling Phase 2 test files requires resolving complex library dependencies. The main issue is a circular dependency between:
- `libutil.la` (needs `mach_info` from `libsystem.la`)
- `libsystem.la` (needs `d1mach_` from `libutil.la`)

## Progress Made

### ✅ Successfully Compiled Tests (2/35)
1. `test-blaswrap-complete` - Standalone, no dependencies
2. `test-f77-dummy-main-complete` - Standalone, minimal dependencies

### ⏳ In Progress (1/35)
- `test-lo-utils-complete` - Needs proper library linking order

### Library Dependencies Identified

For `test-lo-utils-complete`, we need:
1. `libutil.la` - Contains functions being tested
2. `libwrappers.la` - Contains `intprops-wrappers` (overflow functions)
3. `libsystem.la` - Contains `mach_info` (float format detection)
4. `libgnu.la` - Base GNU library
5. `-lgfortran` - Fortran runtime (for `d1mach_`)

### Circular Dependency Issue

**Problem:**
- `libutil.la` → needs `mach_info::native_float_format()` from `libsystem.la`
- `libsystem.la` → needs `d1mach_()` from `libutil.la`

**Attempted Solutions:**
1. ✅ Linking libraries in different orders
2. ✅ Linking libraries multiple times
3. ⏳ Need to try: Using `--whole-archive` or library groups
4. ⏳ Need to try: Using the same linking approach as main Octave build

## Next Steps

1. **Examine main build system**
   - Check how `liboctave.la` links these libraries
   - Use the same approach for test compilation

2. **Alternative approaches:**
   - Use `--whole-archive` to force inclusion of all symbols
   - Create a test-specific library that combines dependencies
   - Use `libtool` groups to handle circular dependencies

3. **Simpler tests first:**
   - Focus on tests with fewer dependencies
   - Build up to more complex tests

## Test Files by Dependency Complexity

### Low Complexity (Standalone)
- ✅ `test-blaswrap-complete`
- ✅ `test-f77-dummy-main-complete`

### Medium Complexity (libutil only)
- ⏳ `test-lo-utils-complete` (needs libutil + libwrappers + libsystem)
- ⏳ `test-lo-error-complete` (likely needs libutil)
- ⏳ `test-lo-ieee-complete` (likely needs libutil + libsystem)

### High Complexity (Multiple libraries)
- ⏳ Tests that need array operations
- ⏳ Tests that need interpreter components

## Conclusion

We've made good progress identifying dependencies and understanding the build system. The main remaining challenge is resolving the circular dependency between `libutil` and `libsystem`. Once this is solved, we can compile and run more tests systematically.