Skip to content

Harbour hbmk2 Bug Report in cross-compilation mode #402

@woodhead2019

Description

@woodhead2019

Summary

Component: hbmk2 (Harbour Make Utility)
Version: 3.2.0dev (r2601171121)
Platform: Linux (Cross-compiling to Windows)
Severity: High
Bug Type: Configuration file handling in cross-compilation mode

Description

Absolute path .hbc files are incorrectly treated as source files instead of configuration files when hbmk2 is used in cross-compilation mode, causing compilation errors.

Steps to Reproduce

Environment Setup

export HB_ROOT=$HOME/hb/harbour
export HRB_BIN=$HB_ROOT/bin/linux/gcc
export HB_PLATFORM=win
export HB_COMPILER=mingw64
export HB_CCPREFIX=x86_64-w64-mingw32ucrt-

Test Case 1: Relative Path (Works Correctly)

$HRB_BIN/hbmk2 -ohwb ../../hb/hwgui/hwgui.hbc hwbc.prg -D__GUI -trace -info

Expected: Successful compilation, shows "Processing: ../../hb/hwgui/hwgui.hbc"
Actual: ✅ Works correctly

Test Case 2: Absolute Path (Fails)

$HRB_BIN/hbmk2 -ohwb /home/myname/hb/hwgui/hwgui.hbc hwbc.prg -D__GUI -trace -info

Expected: Successful compilation, shows "Processing: /home/woodhead/hb/hwgui/hwgui.hbc"
Actual: ❌ Error: /home/myname/hb/hwgui/hwgui.hbc(1) Error F0032 Invalid name follows #

Root Cause Analysis

Plugin Extension Registration Bug

In cross-compilation mode, the .hbc extension is incorrectly registered in the plugin extension hash table hbmk[_HBMK_hPLUGINExt]. This causes absolute path .hbc files to match the plugin extension check (line 3716) instead of the .hbc file check (line 3597).

Execution Flow

Relative Path .hbc (Correct):

Line 3597: CASE hb_FNameExt( cParamL ) == ".hbc" → ✅ Match
→ Enter HBC_Find() processing
→ Show "Processing: ../../hb/hwgui/hwgui.hbc"
→ Handle as configuration file

Absolute Path .hbc (Incorrect):

Line 3716: CASE hb_FNameExt( cParamL ) $ hbmk[_HBMK_hPLUGINExt] → ❌ Wrong match
→ Treated as plugin file
→ Skip HBC_Find() processing
→ No "Processing:" output
→ Eventually passed to Harbour compiler as source file

Impact

  • Affected Files: All absolute path .hbc configuration files
  • Platforms: Cross-compilation from Linux to Windows (and likely other cross-compilation scenarios)
  • Workaround: Use relative paths for .hbc files
  • Severity: Prevents proper use of absolute paths in cross-compilation builds

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions