adobe / XMP-Toolkit-SDK

The XMP Toolkit allows you to integrate XMP functionality into your product or solution
BSD 3-Clause "New" or "Revised" License
197 stars 78 forks source link

Can not compile/link simplest test on Ubuntu 18 (how to use UNIX_ENV, XMP_DynamicBuild and so on) #38

Open AlexImagineComm opened 3 years ago

AlexImagineComm commented 3 years ago

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:

  1. Interface which contains ALL files from the /public/include directory: image
  2. Lib/x64 which contains dynamic *.so (only) files built into the /public/libraries/i80386linux_x64/release image 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.
  3. 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: image

Can you please provide command line to compile and link this simple file ? I see many variables were defined in the /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

AlexImagineComm commented 3 years ago

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 ?