Cross compile Xerces-C

Hallo Guys,

can anyone help me with cross compile the xerces-c 2.6.0 XML Parser with QNX Momentics 6.3.0 on a Win XP PC.

Since my QNX Environment do not have autoconf installed I can not really use the build environment given in the source distribution. I have tried to install cygwin and use its autoconf. But the make files which are generated do not work for the QNX Windows environment.

(Maybe can I install autoconf on my Windows Momentics?)

I also started to build a project with the eclipse IDE but this turns out to be hard work. Furthermore the XML Parser needs iconv an gettext libraries. How I can handle that?

So, please can anyone help me???

If it’s possible, I would suggest you use the self hosted environment. Those 3rd party software build system may not work properly under cross dev env. You may have to manually tweak here and there.

We tried this about a year ago and succeeded (I think). There are a few changes needed…

Firstly, probably best to use the self-hosted machine…

  1. Install the tools (autoconf etc.) from the QNX Open source CD (or from mike.qnx.org.ru/qopencd/index.html, but havn’t tried these personally)

  2. Set the QNX gcc frontend (qcc) to use gcc-3.3:
    $ qcc -V3.3.1,gcc_ntox86_gpp
    $ QCC -V3.3.1,gcc_ntox86_gpp

  3. Ensure that the transcoder is installed - ie. check that the iconv headers exist in /usr/local

  4. Set a few compile variables (replacing versions where appropriate)
    $ export CXXFLAGS=-I/opt/include
    $ export XERCESCROOT=<xerces-c-src_2_6_0>

  5. Configure
    $ cd <xerces-c-src_2_6_0>/src/xercesc
    $ autoconf
    $ ./runCOnfigure -pqnx -cqcc -xQCC -tIconvGNU

  6. Fix a few bugs in <xerces-c-src_2_6_0>/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp
    Or just replace with attached file.

  7. Build:
    $ make

  8. Install
    $ make install
    (NOTE: Some errors are reported when installing, but it appears to have actually worked properly ?!?)

  9. Compile samples
    $ cd /tests
    $ autoconf
    $ ./runConfigure -pqnx -cqcc-xQCC -tIconvGNU -rnone

  10. ensure that /usr/local/lib is in LD_LIBRARY_PATH
    $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

  11. Run tests
    $cd /bin
    $ ./DOMTest

Hopefully there won’t be too many changes since we last tried (havn’t actually used it for quite some time). Thanks to Matt RIdley for actually sorting out the nasty bits.

rf_grover, thanks for your hints. However, you forgot to attach your patched header file. Could you please add it?

D’oh, sorry - I’ll try again. I didn’t read the “allowed” attachements policy…

We’ve tried it with the script above but it needs some adjustments.
Here the correct actions to build Xerces v2.7.0 on QNX Momentics v6.3.0 with SP2 installed.
Install next qpr packages from mike.qnx.org.ru/qopencd:
gettext_x86-0.13-bld2-x86-public.qpr
iconv_x86-1.9.1-x86-public.qpr
m4-1.4.2-x86-public.qpr
perl_x86-5.8.6-x86-public.qpr

  1. Set the QNX gcc frontend (qcc) to use gcc-3.3.5:
    $ qcc -V3.3.5,gcc_ntox86_gpp –set-default
    $ QCC -V3.3.5,gcc_ntox86_gpp –set-default

  2. Ensure that the transcoder is installed - ie. check that the iconv.h file exists in /usr/local/include and libiconv.so* files exist in /usr/local/lib

  3. Set a few compile variables (replacing versions where appropriate)
    $ export CXXFLAGS=-I/usr/local
    $ export XERCESCROOT=<xerces-c-src_2_7_0>

  4. Configure commands in directory <xerces-c-src_2_7_0>/src/xercesc:
    $ autoconf
    $ ./runCOnfigure -pqnx -cqcc -xQCC -tIconvGNU

  5. Replace with the attached file:
    <xerces-c-src_2_7_0>/src/xercesc/util/Transcoders/IconvGNU/IconvGNUTransService.cpp

  6. Build command in directory <xerces-c-src_2_7_0>/src/xercesc:
    $ make

  7. Install command in directory <xerces-c-src_2_7_0>/src/xercesc:
    $ make install

  8. Copy proper runConfigure to tests folder
    $ cp <xerces-c-src_2_7_0>/src/xercesc/runConfigure <xerces-c-src_2_7_0>/tests/.

  9. Configure commands in directory <xerces-c-src_2_7_0>/tests :
    $ autoconf
    $ ./runConfigure -pqnx –cqcc -xQCC -tIconvGNU -rnone

  10. Fix Makefiles in tests and sub folders so that iconv libraries are linked dynamically.
    Add to Makefile: LDFLAGS += -liconv

  11. Ensure that /usr/local/lib is in LD_LIBRARY_PATH
    $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

  12. Build command in directory <xerces-c-src_2_7_0>/tests:
    $ make

  13. Copy xerces libraries to /usr/lib
    $ cp <xerces-c-src_2_7_0>/lib/libxerces* /usr/lib/.

  14. Run tests in directory <xerces-c-src_2_7_0>/bin:
    $ ./DOMTest

Thanks for the update ;-)

I tried to compile xerces on QNX
///////////////////////////////////Traces at the console/////////////////////////////////////////////////////////////

./runConfigure -pqnx -cqcc -xQCC

Generating makefiles with the following options …

Platform: qnx

C Compiler: qcc

C++ Compiler: QCC

Message Loader: inmem

Net Accessor: socket

Transcoder: native

Thread option: pthread

Library type: shared

bitsToBuild option: 32

Extra compile options:

Extra link options:

Extra configure options:

Debug is OFF

checking for gcc… qcc

checking for C compiler default output file name… a.out

checking whether the C compiler works… configure: error: cannot run C compiled programs.

If you meant to cross compile, use `–host’.

See `config.log’ for more details.

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

*******************************config.log file ***********************************************

configure:2060: $? = 0

configure:2083: checking for C compiler default output file name

configure:2110: qcc -w -O -DNDEBUG -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET conftest.c -lsocket >&5

configure:2113: $? = 0

configure:2151: result: a.out

configure:2168: checking whether the C compiler works

configure:2178: ./a.out

./configure: ./a.out: /usr/lib/ldqnx.so.2: bad ELF interpreter: No such file or directory

configure:2181: $? = 126

configure:2190: error: cannot run C compiled programs.

If you meant to cross compile, use `–host’.

I had tried with a demo program with qcc the a.out file is formed but not able to execute it

[hemant@getz ~]$ ./a.out

bash: ./a.out: /usr/lib/ldqnx.so.2: bad ELF interpreter: No such file or directory

tried to change ld libyrary path but still not working any suggestion.