Static linking issue on Solaris sparc - solaris

Undefined symbols Error while statically linking xerces with application only on solaris sparc, whereas static linking on other platforms(Linux, HP-UX,Solaris-x86) working.
Here are errors.
Undefined first referenced
symbol in file
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::XMLNotationDecl>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(XMLNotationDecl.o)
const xercesc_2_8::XMLAttr*xercesc_2_8::BaseRefVectorOf<xercesc_2_8::XMLAttr>::elementAt(const unsigned)const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(SAX2XMLReaderImpl.o)
void xercesc_2_8::RefHashTableOf<xercesc_2_8::KVStringPair>::put(void*,xercesc_2_8::KVStringPair*const) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(DatatypeValidatorFactory.o)
socket /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(UnixHTTPURLInputStream.o)
xercesc_2_8::SchemaElementDecl*xercesc_2_8::Janitor<xercesc_2_8::SchemaElementDecl>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::ValueVectorOf<xercesc_2_8::DOMNode*>::addElement(xercesc_2_8::DOMNode*const&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(GeneralAttributeCheck.o)
unsigned xercesc_2_8::RefHashTableOf<xercesc_2_8::XercesAttGroupInfo>::getHashModulus()const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(XTemplateSerializer.o)
bool xercesc_2_8::RefHashTableOf<xercesc_2_8::XMLAttDef>::containsKey(const void*const)const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::IdentityConstraintHandler>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(IdentityConstraintHandler.o)
xercesc_2_8::XMLHolder<_pthread_mutex>::~XMLHolder() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(SolarisPlatformUtils.o)
void xercesc_2_8::ValueHashTableOf<unsigned short>::put(void*,const unsigned short&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(GeneralAttributeCheck.o)
void xercesc_2_8::ValueHashTableOf<unsigned>::put(void*,const unsigned&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
xercesc_2_8::RefVectorOf<xercesc_2_8::DOMImplementationSource>::~RefVectorOf() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(DOMImplementationRegistry.o)
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::FieldValueMap>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(FieldValueMap.o)
void xercesc_2_8::Janitor<xercesc_2_8::SchemaAttDef>::orphan() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
xercesc_2_8::SchemaInfo&xercesc_2_8::BaseRefVectorEnumerator<xercesc_2_8::SchemaInfo>::nextElement() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::BaseRefVectorOf<xercesc_2_8::ENameMap>::addElement(xercesc_2_8::ENameMap*const) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TransService.o)

Sachin,can you please provide your link line, as reported by your build system?
This will show what libraries are being used in what order and what flags are being invoked. (I expect this is a CC command, not ld.)
Also to respond to Erik, Solaris 10 does support static linking -- you can link a static library (.a file) with your binary -- what it doesn't support is linking the Solaris system libraries statically. Sachin, from the errors it look like you're linking your own static xerces library against your binary, which is fine in S10.

As far as compiling and linking is concerned, there is no difference between Solaris running on x86 and SPARC. You certainly can build and link with static libraries on Solaris 10 (and 11). One notable exception would be the C library which is only provided as a dynamic library, but the error messages you show are unrelated to libc.

What version of solaris are you using? If it's solaris 10 then you're out of luck, it no longer supports static linking.
See here.

Related

Arduino Linux mint: error: ‘digitalPinToInterrupt’

I wanted to interrupt a simple squared voltage and I was using a common program:
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}
But if I want to verify it with the Arduino Software, this is the error:
interrupt.ino: In function ‘void setup()’:
interrupt.ino:11:53: error: ‘digitalPinToInterrupt’ was not declared in this scope
I already tried adding libraries, which include this command, but I had problems finding them.
I am using Linux mint and the Arduino software version is:
arduino:
Installed: 2:1.0.5+dfsg2-4
Candidate: 2:1.0.5+dfsg2-4
Version table:
*** 2:1.0.5+dfsg2-4 500
And I couldn't install the IDE which I downloaded from https://www.arduino.cc
So this is the version of the package manager in Linux mint.
My question now is, does someone know where to find the libary which includes digitalPinToInterrupt().
There is no libary manager in this version of IDE, so perhaps someone knows how to get a newer version of IDE for Linuxmint.
Thank you
SOLVED
The version 1.8.2 for Linux 64bit on https://www.arduino.cc/en/Main/Software is defective. I found an other one on http://www.arduino.org/downloads.
This version also already includes digitalPinToInterrupt().

Error when calling Native Code using JNI from a Jython module

I am calling a simple HelloWorld program written in C from a Jython module (inside a PyDev project). There is an intermediate Java Class (in a separate Java project) which calls the native code using JNI (Java Native Interface). The native call is successful if I run the Java class directly. But when I call the Java class from my Jython module, I get the following error:
java.lang.UnsatisfiedLinkError: no ctest in java.library.path
I have successfully run several C programs from my Jython module using JNA (Java Native Access). But JNA hits performance (speed) really hard and I want to revisit JNI and fix this problem (also I simply want to know what is going on). The IDE I am using is Eclipse.
Here is the code for the Java class:
package JNIPackage;
public class HelloWorld {
native void helloFromC(); /* (1) */
static {
// Added the line below but still no luck. Was sure this would fix it.
System.setProperty("java.library.path", "/Users/haiderriaz/Desktop/JNI-C");
System.loadLibrary("ctest"); /* (2) */
}
static public void main(String argv[]) {
HelloWorld helloWorld = new HelloWorld();
helloWorld.helloFromC(); /* (3) */
}
}
Running this Java class directly, there is no error and "Hello World" gets printed out. But when I import JNIPackage to my Jython module and then call JNIPackage.HelloWorld, then all of a sudden java can not find ctest. I think this is strange and the problem only exists when calling C code using JNI as opposed to JNA.
Try System.load([full path and filename of ctest]), which works independently from values of LD_LIBRARY_PATH or java.library.path.
To ease user configuration I usually implement my own library-search-mechanism, i.e. make it look for libraries in the working directory and on the classpath too. I know ideologically this is somewhat wrong, but works much smoother for your users. Use java.io.File.exists to confirm the actual location of ctest-file and then use java.io.File.getAbsolutePath() to get the appropriate input for System.load.
System.mapLibraryName(...) can also be useful for this.

Compiling RTX Kernel files using GCC Compiler in Eclipse IDE

We have a project in KEIL IDE for LPC2148 which has RTX kernel programs along with other programs in it, which was compiled by ARM CC.Now we need to change the IDE from KEIL(ARM CC) to Eclipse(GCC). When we tried to compile it in Eclipse GCC Compiler, it is showing errors in RTX_Config.c and RTX_Config.h files. Other files are compiled successfully using GCC compiler. But RTXConfig.c file has compiler specific codes which are not getting compiled by GCC. Is there any solution to compile this project in Eclipse IDE using GCC compiler? Please help me out in this as am a beginner. Thanks in advance
We have some keil specific keywords like irq , __swi, __task , __asm which is compiled successfully by ARM CC (keil), but when we tried to port it to GCC Compiler (Eclipse), This compiler cannot compile these keywords and showing errors.
Is there any way to compile these keil specific keywords in GCC Compiler?
do_software_interrupt, do_irq and do_fiq are interrupt service routines for SWI, IRQ and FIQ respectively. These functions are implemented in c using gcc’s attribute feature. Here is the actual c code containing routines for irq, fiq and software interrupt.
entry.c
void __attribute__((interrupt("IRQ"))) do_irq()
{
//your irq service code goes here
}
void __attribute__((interrupt("FIQ"))) do_fiq()
{
//your fiq service code goes here
}
void __attribute__((interrupt("SWI"))) do_software_interrupt()
{
volatile unsigned int int_num;
asm("LDR r0, [lr, #-4]");
asm("BIC r0, #0xFF000000");
asm("MOV %0, r0":"=r"(int_num):);
//based on int_num, you can determine which system call is called
}
void c_start() {
asm volatile ("SVC 0x5");
while(1){}
}

Opencv2.4.0 with mingw in windows get crashed

I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes.
But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it.
The below is the Sample Code I tried to execute:
#include "highgui.h"
using namespace std;
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg" );
cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
cvShowImage( "Sample", img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Sample" );
}
UPDATE :
I follwed as the steps as moskito-x link to build the opencv and when I press "configure", I get the following error. And my make file is also 35kb in size.
Any suggestions to solve this?
Using the libs in "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib
You can not use the libraries that come with OpenCV-2.4.x.exe.
As some developers in forums and I find out. On some systems, the precompiled libs of "opencv 2.4.x" can not be used.
To compile your own programs, works, but it crashed if you try to run them. Until there are not functioning precompiled libs of "opencv 2.4.x , you have to compile opencv yourself.
Ignore so the folder "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib" completely.
As already pointed out you can't rely on precompiled binaries. I also had a lot of problems and finally ended up with compiling my own binaries. My setup was for Windows7, Eclipse CDT (Juno) and MinGW. You can check my post on Stackoverflow here
I guess this is an error related to memory management. Maybe because your'e releasing the window before the image. But anyhow you should use the OpenCV C++ interface, as this does a lot of stuff automagically. With the C++ Interface your code would look like this:
#include <opencv.hpp>
int main( int argc, char** argv ) {
cv::Mat img = cv::imread("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");
cv::imshow("Sample", img);
cv::waitKey(0);
return 0
}

Why MinGW couldn't find memcpy?

I just installed MinGW + MSYS in Windows XP using graphical installer. Everything seems fine.
However, when I try to build a C++ application using ./configure, make, make install, it shows error message. The following 2 checkings failed:
AC_CHECK_LIB(m, memcpy, [], [AC_MSG_ERROR([error msg])])
AC_CHECK_FUNC(memcpy, [],[AC_MSG_ERROR([error msg])])
Why my MinGW couldn't find memcpy and its library? Can anyone give me suggestion how to fix this error? Thank you.
void * memcpy ( void * destination, const void * source, size_t num );
Copy block of memory, copies the values of num bytes from the location pointed by source directly to the memory block pointed by destination.
For reference please see http://www.cplusplus.com/reference/cstring/memcpy/