win32 · Шаг 3. Фаза 1 — сборка библиотек (6 штук)

На этом шаге собираются все 6 библиотек (.lib) под 32 бита. Их нужно собрать до любых программ: вьюверы и ядра линкуются с готовыми библиотеками.

Порядок между самими библиотеками не важен — каждая .lib компилируется независимо. Главное — собрать все 6 до начала Фазы 2.

Перед сборкой убедитесь (см. 02-setup-paths.md, раздел 2.4): конфигурация Release, платформа Win32.

КЛЮЧЕВОЕ — точность _real (двойная). До сборки проверьте, что в общем заголовке src\Include\Typerth.h активна двойная точность:

//#define _PREC_FLOAT
#define _PREC_DOUBLE

Тип _real входит в общие структуры (ABI) и в формат файлов поля, поэтому точность должна быть одинаковой у всех библиотек и программ. Сборка во float приводит к ложной «ребристости»/неустойчивости расчёта X‑моды (tmc_rtx) — см. 07-troubleshooting.md, § 7.8 (Баг #11). Это не опция производительности, а условие корректности.


3.0 Общие правки, уже внесённые в проекты библиотек

Эти изменения были сделаны при первой сборке под современным компилятором (toolset v145) и нужны и для win32, и для win64. Они уже применены — пересказаны здесь, чтобы вы понимали, что в проектах не «по умолчанию».

Правки настроек сборки (.vcxproj), не код:

  • Набор инструментов переключён с v100 (VS2010, не установлен) на v145.
  • Подключён build\LibOutput.props (общие пути Include/Lib + вывод в dist\<платформа>\lib).
  • Удалены жёстко прописанные пути E:\WORK, D:\work, Z:\work, d:\tmc\lib.
  • Сняты устаревшие переопределения ObjectFileName / ProgramDataBaseFileName=.\Release/, которые вызывали ошибку C1041 (несколько cl.exe писали в один .pdb).
  • Для complex создан новый complex.vcxproj (старый формат .vcproj от VS2008 сконвертирован, настройки /MT перенесены).

Правки в коде (общие, нужны и для win32) — для совместимости с современным компилятором:

  • С‑1 — конфликт имени ETIME в общем заголовке src\Include\MAINWNDW.H (член enum ST_ITEMS). Современный <errno.h> (UCRT) определяет макрос ETIME, из‑за чего возникали ошибки C2143/C2059. Перед enum добавлено #ifdef ETIME / #undef ETIME / #endif. Имя ETIME используется только в этом enum. Математика не затронута.
  • С‑2 — в src\libs\SFILE95\Sadd.cpp (строка 25) заголовок <error.h> не найден (C1083). Заменено на #include <Error1.h> — там лежат те же #define‑коды ошибок. Математика не затронута.

Эти правки касаются совместимости с компилятором, а не разрядности. На результаты расчётов они не влияют.


3.1 Общая последовательность для каждой библиотеки

Для каждой из 6 библиотек шаги одинаковые:

  1. В Visual Studio: File → Open → Project/Solution… и выбрать файл проекта <Имя>.vcxproj из папки библиотеки (точное имя — в разделах 3.2–3.7 ниже).

Открывайте именно .vcxproj, а НЕ .sln/.vcproj. В папках библиотек рядом лежат старые файлы *.vcproj и *.sln (формат VS2008). Многие .sln ссылаются на устаревший .vcproj — с жёсткими путями (d:\work\lib) и без галочки Build. Если открыть .sln, вы соберёте старый проект и столкнётесь с «Project not selected to build» (раздел 2.5) и .lib в d:\work\lib (раздел 2.3.1). Новый, уже настроенный проект — это <Имя>.vcxproj. 2. Проверить: конфигурация Release, платформа Win32. 3. Build → Build Solution (Сборка → Собрать решение). Если хотите чистую сборку — Build → Rebuild Solution (Пересобрать решение). 4. Дождаться сообщения Build: 1 succeeded, 0 failed в окне Output. 5. Убедиться, что файл .lib появился в dist\win32\lib.

Если в Output появилось Skipped Build … Project not selected to build (Build: … 1 skipped) — проект не отмечен на сборку. Включите галочку Build в Configuration Manager: см. 02-setup-paths.md, раздел 2.5.

Меню Build → Build Solution
Меню Build → Build Solution
Окно Output: «Build: 1 succeeded, 0 failed»
Окно Output: «Build: 1 succeeded, 0 failed»

3.2 sfile95.lib

  • Папка: src\libs\SFILE95
  • Проект (открывать этот файл): SFILE95.vcxproj
  • Заголовки берутся из src\Include (через Common.props)
  • Результат: dist\win32\lib\sfile95.lib

Соберите по последовательности из 3.1.


3.3 complex.lib

  • Папка: src\libs\complex
  • Проект (открывать этот файл): complex.vcxproj
  • Результат: dist\win32\lib\complex.lib

3.4 exprint.lib

  • Папка: src\libs\exprint
  • Проект (открывать этот файл): exprint.vcxproj
  • Результат: dist\win32\lib\exprint.lib

Эта библиотека использует исходники из соседних папок src\libs\Expr и src\libs\Inter (на них ссылается exprint.vcxproj). Они уже на месте.


3.5 TMCLibError.lib

  • Папка: src\libs\TMCLibError
  • Проект (открывать этот файл): TMCLibError.vcxproj
  • Результат: dist\win32\lib\TMCLibError.lib

3.6 prepr.lib

  • Папка: src\libs\PREPR
  • Проект (открывать этот файл): Prepr.vcxproj
  • Результат: dist\win32\lib\prepr.lib

3.7 TMCIndan.lib

  • Папка: src\libs\TMCIndan
  • Проект (открывать этот файл): TMCIndan.vcxproj
  • Результат: dist\win32\lib\TMCIndan.lib

3.8 Проверка Фазы 1

Откройте папку <КОРЕНЬ>\dist\win32\lib. В ней должны лежать все 6 файлов:

sfile95.lib
complex.lib
exprint.lib
TMCLibError.lib
prepr.lib
TMCIndan.lib

Если все 6 на месте — Фаза 1 завершена. Переходите к 04-build-viewers.md.

Предупреждения компилятора при сборке библиотек (C4996 небезопасные CRT, C4267 size_t→short, C4700 неинициализированная переменная) — это легаси‑шум, на сборку и на расчёты они не влияют.

win32 · Step 3. Phase 1 — building the libraries (6 of them)

In this step all 6 libraries (.lib) are built for 32 bits. They must be built before any programs: the viewers and kernels link against the finished libraries.

The order among the libraries themselves does not matter — each .lib compiles independently. The main thing is to build all 6 before Phase 2 begins.

Before building, make sure (see 02-setup-paths.md, section 2.4): configuration Release, platform Win32.

KEY — _real precision (double). Before building, verify that in the shared header src\Include\Typerth.h double precision is active:

//#define _PREC_FLOAT
#define _PREC_DOUBLE

The _real type is part of the shared structures (ABI) and of the field file format, so the precision must be the same across all libraries and programs. Building in float leads to a false "rippling"/instability of the X-mode computation (tmc_rtx) — see 07-troubleshooting.md, § 7.8 (Bug #11). This is not a performance option but a correctness condition.


3.0 Common changes already made to the library projects

These changes were made during the first build under the modern compiler (toolset v145) and are needed for both win32 and win64. They are already applied — restated here so you understand that the projects are not "default".

Build-settings changes (.vcxproj), not code:

  • The toolset was switched from v100 (VS2010, not installed) to v145.
  • build\LibOutput.props is attached (shared Include/Lib paths + output to dist\<platform>\lib).
  • Hard-coded paths E:\WORK, D:\work, Z:\work, d:\tmc\lib were removed.
  • Obsolete overrides ObjectFileName / ProgramDataBaseFileName=.\Release/ were removed; they caused error C1041 (several cl.exe writing into one .pdb).
  • For complex, a new complex.vcxproj was created (the old .vcproj format from VS2008 was converted, the /MT settings carried over).

Code changes (shared, needed for win32 too) — for compatibility with the modern compiler:

  • C-1 — a name conflict for ETIME in the shared header src\Include\MAINWNDW.H (a member of enum ST_ITEMS). The modern <errno.h> (UCRT) defines the macro ETIME, which caused C2143/C2059 errors. Before the enum, #ifdef ETIME / #undef ETIME / #endif was added. The name ETIME is used only in this enum. The math is not affected.
  • C-2 — in src\libs\SFILE95\Sadd.cpp (line 25) the header <error.h> was not found (C1083). Replaced with #include <Error1.h> — it holds the same #define error codes. The math is not affected.

These changes concern compiler compatibility, not bitness. They do not affect the computation results.


3.1 The common sequence for each library

For each of the 6 libraries the steps are the same:

  1. In Visual Studio: File -> Open -> Project/Solution… and select the project file <Name>.vcxproj from the library folder (the exact name is in sections 3.2–3.7 below).

Open exactly the .vcxproj, NOT the .sln/.vcproj. In the library folders there are old files *.vcproj and *.sln (VS2008 format). Many .sln files reference the obsolete .vcproj — with hard paths (d:\work\lib) and without the Build checkbox. If you open the .sln, you build the old project and run into "Project not selected to build" (section 2.5) and a .lib in d:\work\lib (section 2.3.1). The new, already configured project is <Name>.vcxproj. 2. Check: configuration Release, platform Win32. 3. Build -> Build Solution. If you want a clean build — Build -> Rebuild Solution. 4. Wait for the message Build: 1 succeeded, 0 failed in the Output window. 5. Make sure the .lib file appeared in dist\win32\lib.

If the Output shows Skipped Build … Project not selected to build (Build: … 1 skipped) — the project is not marked to build. Enable the Build checkbox in Configuration Manager: see 02-setup-paths.md, section 2.5.

The Build -> Build Solution menu
The Build -&gt; Build Solution menu
Output window: "Build: 1 succeeded, 0 failed"
Output window: &quot;Build: 1 succeeded, 0 failed&quot;

3.2 sfile95.lib

  • Folder: src\libs\SFILE95
  • Project (open this file): SFILE95.vcxproj
  • Headers are taken from src\Include (via Common.props)
  • Result: dist\win32\lib\sfile95.lib

Build following the sequence in 3.1.


3.3 complex.lib

  • Folder: src\libs\complex
  • Project (open this file): complex.vcxproj
  • Result: dist\win32\lib\complex.lib

3.4 exprint.lib

  • Folder: src\libs\exprint
  • Project (open this file): exprint.vcxproj
  • Result: dist\win32\lib\exprint.lib

This library uses sources from the neighboring folders src\libs\Expr and src\libs\Inter (referenced by exprint.vcxproj). They are already in place.


3.5 TMCLibError.lib

  • Folder: src\libs\TMCLibError
  • Project (open this file): TMCLibError.vcxproj
  • Result: dist\win32\lib\TMCLibError.lib

3.6 prepr.lib

  • Folder: src\libs\PREPR
  • Project (open this file): Prepr.vcxproj
  • Result: dist\win32\lib\prepr.lib

3.7 TMCIndan.lib

  • Folder: src\libs\TMCIndan
  • Project (open this file): TMCIndan.vcxproj
  • Result: dist\win32\lib\TMCIndan.lib

3.8 Verifying Phase 1

Open the folder <ROOT>\dist\win32\lib. It must contain all 6 files:

sfile95.lib
complex.lib
exprint.lib
TMCLibError.lib
prepr.lib
TMCIndan.lib

If all 6 are in place, Phase 1 is complete. Proceed to 04-build-viewers.md.

Compiler warnings while building the libraries (C4996 unsafe CRT, C4267 size_t->short, C4700 uninitialized variable) are legacy noise; they do not affect the build or the computations.