Can not compile/link simplest test on Ubuntu 18 (how to use UNIX_ENV, XMP_DynamicBuild and so on)
AlexImagineComm opened this issue · 1 comments
Here's the simplest cpp file I wanted to compile with XMP Toolkit test.cpp:
#include "iostream"
#include <string>
/*
#define XMP_DynamicBuild 1
//#define ENABLE_CPP_DOM_MODEL 1
#define UNIX_ENV 1
#define XMP_64 1
#define __LITTLE_ENDIAN__ 1
*/
#define XMP_INCLUDE_XMPFILES 1
// Must be defined to instantiate template classes
#define TXMP_STRING_TYPE std::string
// Ensure XMP templates are instantiated
#include "XMP.incl_cpp"
// Provide access to the API
#include "XMP.hpp"
int main(void)
{
std::cout << "Started to init SXMPMeta"<<std::endl;
bool metaInitialized = SXMPMeta::Initialize();
std::cout << "Finished to init SXMPMeta " << metaInitialized<<std::endl;
std::cout << "Started to init SXMPFiles" <<std::endl;
bool filesInitialized = SXMPFiles::Initialize();
std::cout << "Finished to init SXMPFiles " << filesInitialized;
bool success = metaInitialized && filesInitialized;
std::cout << "Done both:" << success;
return 0;
}
I put in the same directory the following files:
- Interface which contains ALL files from the <xmp-toolkit-sdk-2020.1>/public/include directory:
- Lib/x64 which contains dynamic *.so (only) files built into the <xmp-toolkit-sdk-2020.1>/public/libraries/i80386linux_x64/release
All I wanted is compile this test.cpp file and see that both SXMPMeta and SXMPFiles were initialized successfully using libXMPCore.so and libXMPFiles.so. - Here's the command line:
version: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
g++ *.cpp -fpermissive -std=c++0x -I/home/ubuntu/tmp/test/Interface -std=c++0x -L/home/ubuntu/tmp/test/Lib/x64/ -static -o testXMP
Hundreds of errors were printed out:
Can you please provide command line to compile and link this simple file ? I see many variables were defined in the <xmp-toolkit-sdk-2020.1>/samples/build/cmake , like compiler arguments:
-fPIC
-Wno-multichar
-funsigned-char
-m64
-fexceptions
-Wformat
-Wformat-security
-Wall
-Wno-reorder
-std=c++0x
-Os
some variable were defined:
-DENABLE_CPP_DOM_MODEL=1
-DUNIX_ENV=1
-DXMP_64=1
-DXMP_StaticBuild=1
-D__LITTLE_ENDIAN__=1
There is nothing about it in the XMPProgrammerGuide. The provided sample (ReadingXMP ) seems to use only the static libs.
Regards
Alex
One more question about using the Linux build.
In every example provided in the sample/source directory I see the following initialization of the SXMPFiles::Initialize:
XMP_OptionBits options = 0;
#if UNIX_ENV
options |= kXMPFiles_ServerMode;
#endif
SXMPFiles::Initialize ( options );
It works, but ifI try to initialize the same library using:
XMP_OptionBits options = 0;
SXMPFiles::Initialize ( options );
or
SXMPFiles::Initialize ( );
It always fails in Linux, but works in Windows. Please provide additional information - should I ALWAYS use
options |= kXMPFiles_ServerMode;
for Linux ?