fix(platform): Fixes to compile with emscripten 3.1.5 (fixes #2707) (#4318)

* fix(platform): Fixes to compile with emscripten 3.1.5 on Ubuntu 22.04 #2707

* enh(Platform): add test check with emscripten on Linux
This commit is contained in:
Matej Kenda 2023-12-07 01:48:14 +01:00 committed by GitHub
parent e868ecb247
commit 35e1490b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 8 deletions

View File

@ -123,6 +123,24 @@ jobs:
PWD=`pwd`
ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)"
linux-emscripten-cmake:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: sudo apt -y update && sudo apt -y install cmake ninja-build emscripten
- run: emcmake cmake -H. -B cmake-build -DENABLE_ACTIVERECORD_COMPILER=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=off && emmake cmake --build cmake-build --target all -j4
# TODO: How to run unit tests in emscripten?
# - uses: ./.github/actions/retry-action
# with:
# timeout_minutes: 90
# max_attempts: 3
# retry_on: any
# command: >-
# cd cmake-build &&
# sudo -s
# PWD=`pwd`
# ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)"
linux-gcc-make-cross-armhf:
runs-on: ubuntu-22.04
steps:

View File

@ -61,13 +61,16 @@
#elif defined(__NACL__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_NACL
#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(EMSCRIPTEN)
#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(__EMSCRIPTEN__)
#define POCO_OS_FAMILY_UNIX 1
#if defined(__ANDROID__)
#define POCO_OS POCO_OS_ANDROID
#else
#define POCO_OS POCO_OS_LINUX
#endif
#if defined(__EMSCRIPTEN__)
#define POCO_EMSCRIPTEN
#endif
#elif defined(__APPLE__) || defined(__TOS_MACOS__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS_FAMILY_BSD 1
@ -142,7 +145,7 @@
#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
#define POCO_ARCH POCO_ARCH_ALPHA
#define POCO_ARCH_LITTLE_ENDIAN 1
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(EMSCRIPTEN)
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(POCO_EMSCRIPTEN)
#define POCO_ARCH POCO_ARCH_IA32
#define POCO_ARCH_LITTLE_ENDIAN 1
#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64)

View File

@ -364,7 +364,9 @@ ThreadImpl::TIDImpl ThreadImpl::currentTidImpl()
long ThreadImpl::currentOsTidImpl()
{
#if POCO_OS == POCO_OS_LINUX
#if defined(POCO_EMSCRIPTEN)
return ::pthread_self();
#elif POCO_OS == POCO_OS_LINUX
return ::syscall(SYS_gettid);
#elif POCO_OS == POCO_OS_MAC_OS_X
return ::pthread_mach_thread_np(::pthread_self());

View File

@ -34,7 +34,7 @@ class MongoDB_API MessageHeader
/// MongoDB request or response message.
{
public:
static const unsigned int MSG_HEADER_SIZE = 16;
static constexpr Int32 MSG_HEADER_SIZE = 16;
enum OpCode
{

View File

@ -1512,7 +1512,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
#include <ifaddrs.h>
#endif
#include <net/if.h>
#ifndef POCO_NO_LINUX_IF_PACKET_H
#if !defined(POCO_NO_LINUX_IF_PACKET_H) && !defined(POCO_EMSCRIPTEN)
#include <linux/if_packet.h>
#endif
#include <net/if_arp.h>
@ -1543,7 +1543,7 @@ static NetworkInterface::Type fromNative(unsigned arphrd)
}
}
#if POCO_OS != POCO_OS_ANDROID
#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN)
void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
{
@ -1552,7 +1552,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
impl.setAdapterName(iface->ifa_name);
impl.setPhyParams();
#ifndef POCO_NO_LINUX_IF_PACKET_H
#if !defined(POCO_NO_LINUX_IF_PACKET_H)
if (iface->ifa_addr->sa_family == AF_PACKET)
{
struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr;
@ -1602,7 +1602,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl)
NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly)
{
#if POCO_OS != POCO_OS_ANDROID
#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN)
FastMutex::ScopedLock lock(_mutex);
Map result;
unsigned ifIndex = 0;