Skip to content

Commit

Permalink
Solaris.build fix #3843 and #3643 (#3939)
Browse files Browse the repository at this point in the history
* try fix compilation for solaris

* this commit for issue #3843 and #3643
changes in Types.h allow ignore problem with declaration of std::int8_t. int8_t can be defined as char or signed char. IMHO we need strong types for Poco::Int's

Envelop.cpp contains initializer for EVP_CIPHER_CTX_init, because this function prototype depends on openssl version.

Application.cpp contains includes especial for SOLARIS, for ioctl support

ClassLoaderTest.cpp and SharedLibraryTest.cpp contains changes because loadlibrary(dlopen) doesn't load library from current directory by default

LocalDateTimeTest.cpp contains changes because SOLARIS use std::tm without tm_gmtoff

* fix : define of SOLARIOS OS in LocalDateTimeTest

* remove unnecessary wrapper

* fix output dir for windows build with multi-config build

* try to fix bug with unixodbc version in linux-builds
[read here](microsoft/linux-package-repositories#36)

* try to fix bug with unixodbc version in linux-builds
[read here](microsoft/linux-package-repositories#36)

* fix : warning in main cmake for if-condition for multi-config build
fix : error for linux-gcc-make-cxx20, use --allow-downgrades for unixodbc

* fix : warning for cmake windows builds
revert changes for linux-gcc-make-cxx20

* revert ci.yml, remove unixodbc version

* try re-run build

---------

Co-authored-by: Aleksandar Fabijanic <[email protected]>
  • Loading branch information
bas524 and aleks-f committed Nov 27, 2023
1 parent cb4daf1 commit 35c3753
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
CPPUNIT_IGNORE: class CppUnit::TestCaller<class PathTest>.testFind,class CppUnit::TestCaller<class ICMPSocketTest>.testSendToReceiveFrom,class CppUnit::TestCaller<class ICMPClientTest>.testPing,class CppUnit::TestCaller<class ICMPClientTest>.testBigPing,class CppUnit::TestCaller<class ICMPSocketTest>.testMTU,class CppUnit::TestCaller<class HTTPSClientSessionTest>.testProxy,class CppUnit::TestCaller<class HTTPSStreamFactoryTest>.testProxy
steps:
- uses: actions/checkout@v2
- run: cmake -S. -Bcmake-build -DENABLE_NETSSL_WIN=ON -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_DATA=ON -DENABLE_DATA_ODBC=ON -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_TESTS=ON
- run: cmake -S. -Bcmake-build -DENABLE_NETSSL_WIN=ON -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_DATA=ON -DENABLE_DATA_ODBC=ON -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="/MP /EHsc" -DCMAKE_C_FLAGS=/MP
- run: cmake --build cmake-build --config Release
- run: >-
cd cmake-build;
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
CPPUNIT_IGNORE: class CppUnit::TestCaller<class PathTest>.testFind,class CppUnit::TestCaller<class ICMPSocketTest>.testSendToReceiveFrom,class CppUnit::TestCaller<class ICMPClientTest>.testPing,class CppUnit::TestCaller<class ICMPClientTest>.testBigPing,class CppUnit::TestCaller<class ICMPSocketTest>.testMTU,class CppUnit::TestCaller<class HTTPSClientSessionTest>.testProxy,class CppUnit::TestCaller<class HTTPSStreamFactoryTest>.testProxy
steps:
- uses: actions/checkout@v2
- run: cmake -S. -Bcmake-build -DENABLE_NETSSL_WIN=ON -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_DATA=ON -DENABLE_DATA_ODBC=ON -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_TESTS=ON
- run: cmake -S. -Bcmake-build -DENABLE_NETSSL_WIN=ON -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_DATA=ON -DENABLE_DATA_ODBC=ON -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_TESTS=ON -DCMAKE_CXX_FLAGS="/MP /EHsc" -DCMAKE_C_FLAGS=/MP
- run: cmake --build cmake-build --config Release
- run: >-
cd cmake-build;
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# Windows DLLs are "runtime" for CMake. Output them to "bin" like the Visual Studio projects do.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Reset output dirs for multi-config builds
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib)
endforeach(OUTPUTCONFIG)

# Append our module directory to CMake
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand Down
5 changes: 3 additions & 2 deletions Foundation/include/Poco/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

#include "Poco/Foundation.h"
#include <cstdint>
#include <type_traits>


namespace Poco {


using Int8 = std::int8_t;
using Int8 = std::conditional<std::is_same<signed char, std::int8_t>::value, std::int8_t, signed char>::type;
using UInt8 = std::uint8_t;
using Int16 = std::int16_t;
using UInt16 = std::uint16_t;
Expand All @@ -49,7 +50,7 @@ using UIntPtr = std::uintptr_t;
#if defined(__LP64__)
#define POCO_PTR_IS_64_BIT 1
#define POCO_LONG_IS_64_BIT 1
#if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_AIX || POCO_OS == POCO_OS_QNX
#if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_AIX || POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_SOLARIS
#define POCO_INT64_IS_LONG 1
#endif
#endif
Expand Down
42 changes: 23 additions & 19 deletions Foundation/testsuite/src/ClassLoaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Poco/ClassLoader.h"
#include "Poco/Manifest.h"
#include "Poco/Exception.h"
#include "Poco/Path.h"
#include "TestPlugin.h"


Expand All @@ -39,14 +40,15 @@ void ClassLoaderTest::testClassLoader1()
{
std::string path = "TestLibrary";
path.append(SharedLibrary::suffix());

Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
ClassLoader<TestPlugin> cl;

assertTrue (cl.begin() == cl.end());
assertNullPtr (cl.findClass("PluginA"));
assertNullPtr (cl.findManifest(path));
assertNullPtr (cl.findManifest(libraryPath.toString()));

assertTrue (!cl.isLibraryLoaded(path));
assertTrue (!cl.isLibraryLoaded(libraryPath.toString()));

try
{
Expand All @@ -63,7 +65,7 @@ void ClassLoaderTest::testClassLoader1()

try
{
const ClassLoader<TestPlugin>::Manif& POCO_UNUSED manif = cl.manifestFor(path);
const ClassLoader<TestPlugin>::Manif& POCO_UNUSED manif = cl.manifestFor(libraryPath.toString());
fail("not found - must throw exception");
}
catch (NotFoundException&)
Expand All @@ -80,22 +82,23 @@ void ClassLoaderTest::testClassLoader2()
{
std::string path = "TestLibrary";
path.append(SharedLibrary::suffix());

Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
ClassLoader<TestPlugin> cl;
cl.loadLibrary(path);
cl.loadLibrary(libraryPath.toString());

assertTrue (cl.begin() != cl.end());
assertNotNullPtr (cl.findClass("PluginA"));
assertNotNullPtr (cl.findClass("PluginB"));
assertNotNullPtr (cl.findClass("PluginC"));
assertNotNullPtr (cl.findManifest(path));
assertNotNullPtr (cl.findManifest(libraryPath.toString()));

assertTrue (cl.isLibraryLoaded(path));
assertTrue (cl.manifestFor(path).size() == 3);
assertTrue (cl.isLibraryLoaded(libraryPath.toString()));
assertTrue (cl.manifestFor(libraryPath.toString()).size() == 3);

ClassLoader<TestPlugin>::Iterator it = cl.begin();
assertTrue (it != cl.end());
assertTrue (it->first == path);
assertTrue (it->first == libraryPath.toString());
assertTrue (it->second->size() == 3);
++it;
assertTrue (it == cl.end());
Expand Down Expand Up @@ -162,31 +165,32 @@ void ClassLoaderTest::testClassLoader2()
meta2.destroy(pPlugin);
assertTrue (!meta2.isAutoDelete(pPlugin));

cl.unloadLibrary(path);
cl.unloadLibrary(libraryPath.toString());
}


void ClassLoaderTest::testClassLoader3()
{
std::string path = "TestLibrary";
path.append(SharedLibrary::suffix());

Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
ClassLoader<TestPlugin> cl;
cl.loadLibrary(path);
cl.loadLibrary(path);
cl.unloadLibrary(path);
cl.loadLibrary(libraryPath.toString());
cl.loadLibrary(libraryPath.toString());
cl.unloadLibrary(libraryPath.toString());

assertTrue (cl.manifestFor(path).size() == 3);
assertTrue (cl.manifestFor(libraryPath.toString()).size() == 3);

ClassLoader<TestPlugin>::Iterator it = cl.begin();
assertTrue (it != cl.end());
assertTrue (it->first == path);
assertTrue (it->first == libraryPath.toString());
assertTrue (it->second->size() == 3);
++it;
assertTrue (it == cl.end());

cl.unloadLibrary(path);
assertNullPtr (cl.findManifest(path));
cl.unloadLibrary(libraryPath.toString());
assertNullPtr (cl.findManifest(libraryPath.toString()));
}


Expand Down
4 changes: 4 additions & 0 deletions Foundation/testsuite/src/LocalDateTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,11 @@ void LocalDateTimeTest::testTimezone2()
std::time_t t = ldt.timestamp().epochTime();
std::tm then;
then = *std::localtime(&t);
#if POCO_OS == POCO_OS_SOLARIS
assertTrue((mktime(&then)-t) * 1000 == ldt.tzd());
#else
assertTrue (then.tm_gmtoff == ldt.tzd());
#endif
}
unsetenv("TZ");
}
Expand Down
19 changes: 13 additions & 6 deletions Foundation/testsuite/src/SharedLibraryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CppUnit/TestSuite.h"
#include "Poco/SharedLibrary.h"
#include "Poco/Exception.h"
#include "Poco/Path.h"


using Poco::SharedLibrary;
Expand All @@ -38,10 +39,12 @@ void SharedLibraryTest::testSharedLibrary1()
{
std::string path = "TestLibrary";
path.append(SharedLibrary::suffix());
Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
SharedLibrary sl;
assertTrue (!sl.isLoaded());
sl.load(path);
assertTrue (sl.getPath() == path);
sl.load(libraryPath.toString());
assertTrue (sl.getPath() == libraryPath.toString());
assertTrue (sl.isLoaded());
assertTrue (sl.hasSymbol("pocoBuildManifest"));
assertTrue (sl.hasSymbol("pocoInitializeLibrary"));
Expand Down Expand Up @@ -72,8 +75,10 @@ void SharedLibraryTest::testSharedLibrary2()
{
std::string path = "TestLibrary";
path.append(SharedLibrary::suffix());
SharedLibrary sl(path);
assertTrue (sl.getPath() == path);
Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
SharedLibrary sl(libraryPath.toString());
assertTrue (sl.getPath() == libraryPath.toString());
assertTrue (sl.isLoaded());

GimmeFiveFunc gimmeFive = (GimmeFiveFunc) sl.getSymbol("gimmeFive");
Expand Down Expand Up @@ -105,12 +110,14 @@ void SharedLibraryTest::testSharedLibrary3()

path = "TestLibrary";
path.append(SharedLibrary::suffix());
sl.load(path);
Poco::Path libraryPath = Poco::Path::current();
libraryPath.append(path);
sl.load(libraryPath.toString());
assertTrue (sl.isLoaded());

try
{
sl.load(path);
sl.load(libraryPath.toString());
failmsg("library already loaded - must throw exception");
}
catch (LibraryAlreadyLoadedException&)
Expand Down
4 changes: 4 additions & 0 deletions Util/src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include "Poco/SignalHandler.h"
#include <stdio.h>
#include <sys/ioctl.h>
#if POCO_OS == POCO_OS_SOLARIS
#include <stropts.h>
#include <termios.h>
#endif
#endif
#include "Poco/UnicodeConverter.h"

Expand Down

0 comments on commit 35c3753

Please sign in to comment.