Compilation error in creating shared library via JNI
Hi ALL,
I amin serious trouble with a problem. I am developing a Simulator, a function of which is to decode MPEG-2 Video files in real time and play it as well.I have got a MPEG-2 Decoder implemented in C from an open source and need to integrate with my Simulator which is writtebn in Java. The integration part I am doing via JNI(Java Native Interface). Now I have a bunch of C files in MPEG-2 decoder which are to be compiled during the Execution of the Java Simulator.Can anybody give some idea about how to call multiple C files from the Java Source through JNI at one go? Another problem I am facing is in calling a single C code from the traditional "HelloWorld" Java Code itself. The problem comes when I am trying to compile the shared library between the C native code and Java Code in my Linux Machine...I am getting the following message:
/usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0 : In function '_start' :
/usr/lib/gcc-lib/i386-redhat-linux/2.96/.../../../crt1.0(.text+0x18): undefined reference to 'main'
collect2: ld retrurned 1 exit status
What does the above errot mean? How to rectify it.It will be of great help if you anybody can give me clues.
It means that your compiler options are wrong.
You need to create a shared library.
Instead you are creating an executable, which is not the same as a shared library.
If you search this forum you will find posts with command line options that work.
Similar Messages
-
How create shared Library for JNI
Please tell me how to create a shared Library for vc6.0. I have created <.h> file of java class. Please Help me.
This is a duplicate of
http://forum.java.sun.com/thread.jspa?threadID=676996 -
Gdb error while reading shared library symbols
Build pro*c sample1 on linux platform. Launch 'gdb sample1'. Break on main and run. Gdb fails before it hits the breakpoint: error while reading shared library symbols.
Help anyone?Hi Gschwert,
our developers told me that for X-Code Version 4 you need an additional download. Then, it should also work with Version 4. Here is what they said:
It turned out that Shared Libraries compile fine with XCode 4, it's just that the command line tools that we need for compilation are now an optional download.
From https://developer.apple.com/xcode/
"Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators."
So, this is not well documented we will handle that and let make a correction as soon as possible.
Have a nice day,
Abduelkerim
Sales
NI Germany -
I am getting error while deploying "shared library" to FP-2010
i am getting error while deploying "shared library" to FP-2010
screen shot is also attached
regards
mazhar
Attachments:
error24.JPG 128 KBHi mazhar.ali,
Do you explicitly reference a DLL in your code?
What is the size of your code? (The FP-2010 only has 32 Mbytes of RAM, so if you're trying to deploy and run your code from RAM, this might be something to take into account.) (How Much Memory Does My FieldPoint Controller Have?)
Regards,
Kevin S.
Applications Engineer
National Instruments -
Compilation error while creating procedure
Hi,
I am getting compilation error while creating procedure
CREATE OR REPLACE My_CHANGEDATE IS
error_string VARCHAR2(400) := NULL;
BEGIN
Create table set_temp as select * from set;
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;I have taken your code and cleaned it up to be more readable. Please see the comments in the code.
CREATE OR REPLACE My_CHANGEDATE
IS
error_string VARCHAR2(400) := NULL;
BEGIN
/* The only way to issue DDL in a procedure is to either user
* DBMS_SQL or EXECUTE IMMEDIATE. Creating objects is generally
* not needed or recommended in frequently run code.
Create table set_temp as select * from set;
/* The cursor declarations need to go in the declaration section of the
* procedure (between IS .. BEGIN).
CURSOR c1 is
SELECT a.SETNUM, b.CHANGEDATE from
set a, setsp_t2 b
where a.setnum = b.setnum
and trunc(a.changedate) < trunc(b.CHANGEDATE);
BEGIN /* Where is the END that goes with this begin? */
/* Single record processing is generally not recommended. It is considered a "slow-by-slow" method. */
FOR rec IN c1 LOOP
UPDATE set SET changedate = rec.changedate
WHERE setnum = rec.setnum;
Insert into set_temp select * from set where setnum = rec.setnum;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
error_string := 'My_CHANGEDATE - '||SUBSTR(SQLERRM,1,350);
DBMS_OUTPUT.PUT_LINE(error_string);
RAISE;
END My_CHANGEDATE;My general recommendations are as follows:
1. Remove the CREATE TABLE from the procedure altogether.
2. Don't use reserved words for object names (e.g. SET)
3. Remove the record by record processing and consolidate it to a single UDPATE statement as follows (note untested):
UPDATE set s
SET changedate = (
SELECT CHANGEDATE
FROM SET A
, SETSO_T2 B
WHERE A.SETNUM = B.SETNUM
AND S.SETNUM = A.SETNUM
AND TRUNC(A.CHANGEDATE) < TRUNC(B.CHANGEDATE)
WHERE EXISTS(
SELECT NULL
FROM SET A
WHERE A.SETNUM = S.SETNUM
)HTH! -
TNS-01115: OS error 28 creating shared memory segment of 129 bytes
hi
we are operating a solaris v5.8 with 10 instances of 10.2.0.1 databases running. each with its own listener. the system shmmni=3600 and using ipcs all are being used causing the error TNS-01115: OS error 28 creating shared memory segment of 129 bytes to occur.
The kernal parameters were set to be the same as a similiar server we have with the same configuration and more databases and that box uses only 53 memory segments
Does anyone have any ideas as to what would make this happen?i wish i could. there was one db that was not needed so i just shut it down and stopped the listener. then took an ipcs -m reading. it returned 48 rows, instead of 3603 as it did when this particular db was up. in my haste i removed the db as it was not needed so i no longer have the logs to research. too bad on my part.
well at least i have a fix but have no idea why this happened. thank you for your responses. greatly appreciated. -
ORA-24344: success with compilation error While creating workspace
Hi,
We had an instance with db 9.2.0.5 and HTML DB 1.56.
First we upgraded database to to 10.1.0.4.Then we upgraded HTML DB to 1.6.1(Upgraded html db 1.5 to 1.6, Then applied patch 1.6.1 patch - 4173133)
Logged to the HTML DB as an administrator for creating application developer's workspace. I have got the error "ORA-24344: success with compilation error" while creating the workspace.
We are able to create the workspace successfully on HTML DB 1.5.
Any help is highly appreciated.
Thanks, VenkannaVenkanna - Do you think the workspace creation was at least partly successful? I mean, can you login to it, can you see anything about it in the admin app, etc.? It would be useful to get a list of invalid objects in the new workspace's schema. If there are none, then get a list of invalid objects in FLOWS_010600.
Scott -
Creating a shared library for JNI in windows
I went through the JNi tutorial online and it worked just fine on a Linux computer. Now I'm trying to make do the same tutorial on windows. When I get to the step 4. Create a Shared Library, I'm stuck. I don't know how to create this shared library on windows. It gives an example using Visual C++ but I don't have that. Any tips or advice out there what I should do? Any help would be greatly appreciated.
//mac.java
class mac
public native void getMac();
private native String getLine(String prompt);
static {
System.loadLibrary("myMac");//This is myMac.DLL
/*if generated by borland
System.loadLibrary("mymac");//This is mymac.dll
public static void main(String[] args)
mac mc=new mac();
String input = mc.getLine("Enter Some Thing ");
System.out.println("You Entered " + input);
System.out.println(mc.getMac());
prompt> javac mac.java
prompt> javah -jni mac
Borland compiler
/*mymac.c*/
#include <jni.h>
#include "mac.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_mac_getMac(JNIEnv *env, jobject obj)
printf("I am in getmac dir in mymac.dll (Borland) \n");
return;
JNIEXPORT jstring JNICALL
Java_mac_getLine(JNIEnv *env, jobject obj, jstring enter)
char buf[128];
const char *str = (*env)->GetStringUTFChars(env, enter, 0);
printf("%s", str);
(*env)->ReleaseStringUTFChars(env, enter, str);
scanf("%s", buf);
return (*env)->NewStringUTF(env, buf);
To generate DLL
create bcc32.cfg file in %BORLAND_INSTALL%/BCC5/bin Folder
In the bcc32.cfg file add following code
-I"%BORLAND_INSTALL%\BCC55\include;%JAVA_HOME%\include;%JAVA_HOME%\include\win32"
-L"%BORLAND_INSTALL%\BCC55\lib;%BORLAND_INSTALL%\BCC55\Lib\PSDK;"
i.e the path for borland compiler and java.
now goto prompt and say
prompt>bcc32 -tWM -tWD mymac.c
This will create mymac.lib File
Now say
prompt>implib -c mymac.lib mymac.dll
That's it!!
there you are with dll
Now you can run the mac.class file by using java
VC++
Click File->New->Win32Dynamic-Link Library
Give name and Select
A simple DLL project
You will have
myMac.CPP file
// myMac.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "mac.h"
#include "jni.h" //can copy or give full path
#include <math.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
return TRUE;
JNIEXPORT void JNICALL
Java_mac_getMac(JNIEnv *env, jobject obj)
printf("You are in getMac (VC++) DLL\n");
JNIEXPORT jstring JNICALL
Java_mac_getLine(JNIEnv *env, jobject obj, jstring enter)
char buf[128];
const char *str = env->GetStringUTFChars(enter, 0);
printf("\n%s", str);
env->ReleaseStringUTFChars(enter, str);
scanf("%s", buf);
return env->NewStringUTF(buf);
Hope this is useful
regards
kanad Deshpande -
Linker Error while creating shared object.
While creating shared object we got "file processing error".
Below is our compilation line and the error out put.
==================
/net/icom3/opt//SUNWspro/SC5.0/bin/CC -o fn_ctx_onc_fn_files.so.1 -G -h fn_ctx_onc_fn_files.so.1 -z text -z defs -z combreloc -norunpath -nolib -Qo
ption ld -R/usr/lib/fn pics/FNSP_filesOrgContext_default.o pics/FNSP_filesFlatContext_default.o pics/fnsp_internal_common.o pics/FNSP_nisAddress.o
pics/FNSP_nisOrgContext_default.o pics/FNSP_nisFlatContext_default.o pics/FNSP_hash_function.o pics/FNSP_filesHierContext.o pics/FNSP_filesDotC
ontext.o pics/FNSP_filesFlatContext.o pics/FNSP_filesHUContext.o pics/FNSP_filesWeakSlashContext.o pics/FNSP_filesPrinternameContext.o pics/FNSP_
filesPrinterObject.o pics/FNSP_filesOrgContext.o pics/FNSP_filesImpl.o pics/fnsp_files_internal.o pics/onc_fn_files.o -lnsl -lc -L/user/vts/X
FN_CHECK/jnk/usr/lib/fn -lxfn -lfn_spf -lfnsp -lfn_p
ld: fatal: File processing errors. No output written to fn_ctx_onc_fn_files.so.1
==================================
Thanks in advance.
-Lokesh MSHi,
The maximum length supported by one CHAR type infoobject is 60. Check whether you have assigned more.
If you have to load more length ( more than 60) split the total thing into different infoobjects. Create different infoobjects and split the total thing into them - like 1st 60 char in 1st infoobject, char 61-120 in 2nd infoobject and so on. Then you can again concatenate them.
Thanks,
Indrashis -
Creating shared library of native method implementation using gcc
Hi
I am using Dev-C++ IDE for writing and compiling C Programs. It supports gcc.
I have to build a shared library of a native method implementation using gcc compiler.
In JNI tutorial build script is given for VC++ which is as follows
cl -Ic:\java\include -Ic:\java\include\win32
-LD HelloWorldImp.c -Fehello.dll
Similarly I wanted build script for gcc compiler.
Thanks
ShaileshHere is an example of building a library from one module with CygWin's gcc:
# Must set JAVA_HOME and LIBRARY_MODULE before
gcc -mno-cygwin -D__int64="long long" -I $JAVA_HOME/include/win32 -I $JAVA_HOME/include -shared -Wl,--kill-at -o $LIBRARY_MODULE.dll $LIBRARY_MODULE.c -
Linux Cannot Create Shared Library to call from Labview. Anyone have any ideas?
Hi there. A while back i created a shared library (.dll) to call in labview which works great. Lately i have been using Linux more and more and was hoping to recompile the shared library for use in Linux Labview. My first go I am getting the following error #error "Unknown Linux platform" from the platdefines.h. Evidently it does not like my system. Using QT creator on linux mint 64 bit. Anyone have any ideas on how i can get this working?
thanks so much!I have a few version questions: What version of Windows was this DLL orignally created in? What version of LabVIEW are you using? What version of Linux are you using?
I think you will also find this previous discussion forum thread useful: http://forums.ni.com/t5/LabVIEW/Calling-DLL-on-LabVIEW-for-Linux/td-p/58322 -
Create shared library on external drive from scratch
I have seen many posts about creating shared iTunes libraries on external drives with many different configurations, but mostly with pre-existing libraries. My question is creating the library from scratch. The purpose is obviously to share songs among several computers AND only have one copy of a song as to not take up unnecessary disk space on several computers.
All of our songs are on an external USB hard-drive attached to Airport Xtreme. Every song is in album folder, and every album folder is in an artist folder (very organized). All the artist folders (with their album and then song contents) are in a root folder called "Songs" on the external hard-drive.
We have upgraded our three Macs (iMac, MBP and MacMini) to Leopard and deleted all iTunes folders on each local hard drive (there was nothing in them anyway). We now want to create ONE iTunes folder on the hard drive so that each computer can access it. What are the steps? Here is what I "think" I've learned here on the postings with my questions:
1) First I opened iTunes on my first, main computer (iMac) and went into "Preferences" to change the iTunes music folder to [Ext HD]:iTunes:iTunes Music. The option, "Copy to music folder..." is deselected. (This will also be done on the other computers).
2) Now what to do? I could just move all of my song artist folders with their album subfolders and music files inside them, into the "iTunes Music" folder. But then what do I click to get iTunes to see all the songs and put them in its database? The other option is click "Add to Library" - but then don't I have to select all the individual songs? (I actually tried the latter method and it kept crashing). Can I just move all the folders into [Ext HD}:iTunes:iTunes Music folder and click something to get it to create its database based on all the music files that are now in its subfolders?
3) Next step. I have seen many people write that they then create an "Alias" and put the Alias in their "Music" folder on their LOCAL, computer's hard drive. Could someone now explicitly, step-by-step, describe how this is done? I assume I go to the external hard drive. Am I creating an alias of the entire "iTunes" folder, or of the "iTunes Music" subfolder, or of the library file??? Please answer this specifically.
So now I have "XXX alias" that I copy to my local, computer's hard drive and put it on my desktop. I take out the "....alias" word, and drag it to my local "Music" folder. It asks me to replace the existing folder/file, and I say yes. Correct? And then I do this on all three computers, correct?
4) Finally, after I've done all of this, I still have the following functionality questions -
4a) When we now add to the library, either from a CD or online purchase, ONE copy of the music should go in the "iTunes Music" folder on the external drive, correct?
4b) This system means that all three computers MUST have the same iTunes library, playlists, etc, correct? The downside of this system is that you cannot personalize libraries for each computer and just share the actual music files, correct? (If so, is there another process [steps 1-4 above] that results in a more customizable system where *ONLY ONE COPY* of the actual song file is shared?)
Sorry for the length of the message, and the questions. Truly I have read all the postings but was unable to map out my plan before I go and creating, finally, this one set of music that we can share. In advance, thank you all for your help.I was afraid you'd say that, because I'm a long time Mac guy and I don't have the perfect answer. Have you ever messed with remote desktop? That'd seem to give her full access and control, something I personally wouldn't do, although it may work for you.
Another thought came to me that might work: copy over the complete library to her machine, and then when you do another major shoot, create a new catalog, edit, etc.and then import as catalog to you main one while sending her the new one.
I am sure there are more elegant solutions, but these are a couple of ways. -
Error when creating Logical Port via WSDL on SOAMANAGER
Hi,
When creating Logical Port via WSDL on SOAMANAGER we're getting the following error:
"Uninstantiated object u201Csubject sidl serviceu201D in method IF_SRT_WSP_CONFIG_SIDL~CREATE_CLNT_CFG_FROM_WSDL_D of class CL_SRT_WSP_CONFIG_SIDL".
We're consuming a WS provided by a .NET application.
Our system is ECC 6.0 NW 7.01SP 7.
Anyone have faced this error before?.hI,
Please go through this link , you will get the solution
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/media/uuid/20eb3174-41ab-2a10-a383-907faf60eed3 -
SAP installtion stopped - error cant create shared memory
Dear All,
Greetings!
We are trying to install SAP ECC 6.0 IDES system on Windows 2003 x64 Server and DB2 9.1, during the process of installation - in the step of Start Instance. The sapinst Gives Up! the process since the enqueue server is found in stopped state when the instance tries to start up.
I found the below given error message from the Developer Trace files of the enqueue server.
[Thr 1384] Sat May 09 18:21:13 2009
[Thr 1384] *** ERROR => ShmDelete: Invalid shared memory Key=34. [shmnt.c 719]
[Thr 1384] *** ERROR => ShmCleanup: ShmDelete failed for Key:34. [shmnt.c 793]
[Thr 1384] initialize_global: enqueue server without replication
[Thr 1384] Enqueue: EnqMemStartupAction Utc=1241873473
[Thr 1384] *** ERROR => [CreateOsShm] CreateFileMapping(37,65 KB) failed with Err=5
ERROR_ACCESS_DENIED: Access is denied. [shmnt.c 2174]
[Thr 1384] *** ERROR => ShmCreate: Create (37,67072,1) failed [shmnt.c 506]
To note - we had a virus attack on the server recently and an Anti-Virus tool was used to clean the server, after that I found most of the SAP folders in Read-Only mode.
I suspect any causes of the same for the above mentioned ACCESS_DENIED error. Currently I have allocated 28GB of swap size, but the SAP instance is not able to create a shared memory from the same I hope.
Num
Pagefile
Min.Size
Max.Size
Avail.Max
Curr.Size
1
c:\pagefile.sys
8192000 K
8192000 K
8192000 K
8192000 K
2
e:\pagefile.sys
10485760 K
10485760 K
10485760 K
10485760 K
3
f:\pagefile.sys
10485760 K
10485760 K
10485760 K
10485760 K
Please help me with your suggestions for the workaround,
- How will I be able to enable the swap size of the server to be used by the SAP instance?
- Is this the effect of the anti-virus or an aspect in windows server to change the folders and files to read-only after a virus attack?
I have tried the possibilities of adding more shared memory, removing the shared memory and restarting the OS and assigning back the same, but these dint prove useful.
Kindly help me with your suggestions.
Thank you
Regards,
VineethHi,
I would suggest you to go to run > services.msc
now try to manually stop / start the SAP<SID>_<nr> services. are you able to start it properly? If you get error here, that means SAP services not able to start as it has permission problem.
login with <sid>adm & reregister the service by running sapstartsrv.exe in <drive>:\usr\sap\SID\sys\exe. after you give the parameters and press ok, wait for sometime for the 'success' message.
once its done, then start sap in MMC.
another thread talks about similar kind of problem.
Shared Memory Ceation error when we install NW04S Java Stack.
Regards,
Debasis. -
Got compilation error about 'create instance activity' using file adapter
Hi,
I am creating a very simple bpel process using file adapter. in my 'Receive' activity, I selected 'create instance' , as the tutorial says.
I got this compilation error during deploying.
'Error(31): [Error ORABPEL-10051]: multiple create instance activity [Description]: in line 31 of "D:\OraBPELPM_1\integration\jdev\jdev\mywork\BPELPractices\FileAdapterTest2\FileAdapterTest2.bpel", Conflicting createInstacne="yes". Instance is already created by another activity. [Potential fix]: Remove createInstance="yes" attribute from this activity. '
Several people had the same problem in my team. I wonder if this is a common issue. how to fix it?
Thanks,
KateYou must be having another receive/pick activity within the same process that has "createInstance" set to yes.
Thats why its complaining.
Maybe you are looking for
-
Issue in Reversal of Goods Issue
Hi Experts, I am facing a strange issue during the reversal of a delivery which has a Goods Issue done for it. When I reverse a Goods Issue, I am seeing that the External Delivery Reference field on the Delivery Header (LIKP-LIFEX) is getting cleared
-
A great accessory that does not exist?
This seems so obvious, and so logical that my ignorant butt must be missing something. I've been looking at wireless options and general options for connecting my 5G iPod with my home stereo, car stereo etc. Reading all this about running wireless, h
-
Prime Infrastructure 2.0: Inventory/detailed HW reports customizing
Hello, isn't it possible to run a/one detailed hardware report that includes the chassis information Name, the device name, the chassis serial number? Example: Chassis Information Name Device Hostname Serial Number WS-C3750V2-24PS-S switch1x2 FX31338
-
How can I disable my Ipod Touch that says connect to itunes and it won't let you slide to type in the password?
-
Need to load Firstname,lastname together through control file format
Hi All, I need to load the data like first name,lastname as a single data column for example first name last name Scott tiger i want to load data like scott,tiger as a single data column. like fullname Scott,tiger thanks rioi