Skip to content

Cross complilation of bundle libevent for windows uses wrong compiler #114

@dirk-zimoch

Description

@dirk-zimoch

Bug Description

I am cross compiling on RHEL8 for windows-x64 using the MSVC 2019 compiler in wine.

However, when building the bundled libevent using make -C pvxs/bundle libevent.windows-x64, the build uses the host gcc instead of the Microsoft compiler in wine as configured in EPICS base:

$ make -C pvxs/bundle libevent.windows-x64
make: Entering directory '/home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle'
mkdir -p /home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle/O.windows-x64
make -C /home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle/O.windows-x64 -f /home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle/Makefile TOP=../.. T_A=windows-x64 libevent.windows-x64
make[1]: Entering directory '/home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle/O.windows-x64'
cmake  -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_INSTALL_PREFIX:PATH="/home/zimoch/epics/epics-base-7.0/bundle/usr/windows-x64" -DEVENT__DISABLE_OPENSSL=ON -DEVENT__DISABLE_MBEDTLS=ON -DEVENT__DISABLE_REGRESS=ON -DEVENT__DISABLE_SAMPLES=ON -DEVENT__DISABLE_TESTS=ON -DEVENT__DISABLE_BENCHMARK=ON -DCMAKE_MACOSX_RPATH=ON -DCMAKE_SKIP_INSTALL_RPATH=OFF -DCMAKE_MODULE_PATH:DIR="/home/zimoch/epics/epics-base-7.0/modules/pvxs/bundle/cmake" -DCMAKE_MAKE_PROGRAM="make" -DCMAKE_BUILD_TYPE=RELEASE -DEVENT__LIBRARY_TYPE=SHARED  ../libevent
-- The C compiler identification is GNU 8.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Git: /usr/bin/git (found version "2.43.5") 
[...]

The produced include files are unusable for the cross build, leading to the following compiler error:

cl -EHsc -GR           -DUSE_TYPED_RSET -wd4800 -wd4275 -DPVXS_API_BUILDING -DPVXS_ENABLE_EXPERT_API -DNOMINMAX -D_WIN32_WINNT=_WIN32_WINNT_VISTA     -nologo -FC -D__STDC__=0 -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE    -Ox -GL -Oy-   -W3 -w44355 -w44344 -w44251 -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING          -MD -DEPICS_BUILD_DLL -DEPICS_CALL_DLL -TP   -I. -I../O.Common -I. -I. -I../os/WIN32 -I../os/default -I.. -I/home/zimoch/epics/epics-base-7.0/include/compiler/msvc -I/home/zimoch/epics/epics-base-7.0/include/os/WIN32 -I/home/zimoch/epics/epics-base-7.0/include -I/home/zimoch/epics/epics-base-7.0/include/compiler/msvc -I/home/zimoch/epics/epics-base-7.0/include/os/WIN32 -I/home/zimoch/epics/epics-base-7.0/include        -I/home/zimoch/epics/epics-base-7.0/bundle/usr/windows-x64/include -c ../describe.cpp
describe.cpp
Z:\home\zimoch\epics\epics-base-7.0\bundle\usr\windows-x64\include\event2\event.h(198): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory

Also, the libraries installed in bundle/usr/windows-x64/lib/ are *.so files, clearly for Linux and not for Windows.

Expected behavior

The bundle build should use the compiler as defined in EPICS base for the cross architecture in use, not the host compiler.

Information (please complete the following):

  • PVXS Version or Git commit ID: commit e8f6b5c00
  • EPICS Base Version: 7.0.9
  • libevent Version: from bundle
  • EPICS_HOST_ARCH: RHEL8-x86_64 (a.k.a. linux-x86_64)
  • EPICS Target Arch. : windows-x64
  • Host OS: RHEL8
  • Target OS: Windows
  • Compiler version: Should be "Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30148 for x64" but isn't.

Additional context
My CONFIG.Linux.windows-x64, included by CONFIG.RHEL8-x86_64.windows-x64:

include $(CONFIG)/os/CONFIG.windows-x64.windows-x64

VALID_BUILDS = Ioc Command

MSVC_VERSION ?= 2019
PATH := /opt/wine-msvc-$(MSVC_VERSION)/bin/x64:$(PATH)
export WINE ?= wine64
export WINEPREFIX = $(HOME)/.wine-$(EPICS_HOST_ARCH)
export WINEDEBUG := err-all,warn-all,fixme-all$(WINEDEBUG:%=,%)
export WINEDLLOVERRIDES := mscoree,mshtml=$(WINEDLLOVERRIDES:%=,%)
export WINEPATH := $(WINEPATH:%=%;)$(abspath $(INSTALL_BIN))

We have installed MSVC in /opt/wine-msvc-$(MSVC_VERSION) and have wrapper scripts calling wine for the compiler cl, the linker, etc.

Metadata

Metadata

Assignees

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