I'm trying to access this library from my C/C++ codebase and have been unsuccessful so far.
Environment:
Visual Studio 2008 Professional
Windows 7 x64
1. I see `unresolved external symbols` while compiling with my project [1]. I will take a guess at the issue - the following files are included in the package:
sigar-amd64-winnt.dll
sigar-x86-winnt.dll
sigar-x86-winnt.lib
Shouldn't there be a `sigar-amd64-winnt.lib`?
2. I tried to build from the source. I am stuck with the errors listed in [2]. I see the declarations and use of those 2 functions in the codebase, but I do not see their implementations!
3. I tried building the project with Ant. I have no experience with Java or Ant, so please forgive me if I'm doing something very stupid here. I see the error in [3].
[1]
Creating library C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.lib and object C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.exp
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_close referenced in function "public: __cdecl SystemInfo::~SystemInfo(void)" (??1SystemInfo@@QEAA@XZ)
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_cpu_info_list_get referenced in function "public: __cdecl SystemInfo::SystemInfo(void)" (??0SystemInfo@@QEAA@XZ)
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_open referenced in function "public: __cdecl SystemInfo::SystemInfo(void)" (??0SystemInfo@@QEAA@XZ)
6>C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.mexw64 : fatal error LNK1120: 3 unresolved externals
6>Build Time 0:00
6>Build log was saved at "file://C:\Users\RjOllos\Workspace\T834-RO\tmp\Acquisition Server\x64\Release\BuildLog.htm"
6>Acquisition Server - 4 error(s), 0 warning(s)\
[2]
Creating library C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.lib and object C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.exp
3>win32_sigar.obj : error LNK2019: unresolved external symbol sigar_proc_args_wmi_get referenced in function sigar_remote_proc_args_get
3>win32_sigar.obj : error LNK2019: unresolved external symbol sigar_proc_exe_wmi_get referenced in function sigar_proc_exe_get
3>C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.dll : fatal error LNK1120: 2 unresolved externals
[3]
C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java>ant
Buildfile: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build.xml
jni-init:
[mkdir] Created dir: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build\clas
ses
[echo] jni.src=win32, jni.jdk.os=win32, 64-bit
[javac] C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\hyperic_jni\jni-build.x
ml:165: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to fals
e for repeatable builds
[javac] Compiling 6 source files to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\
java\build\classes
[javac] Note: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\hyperic_jni\src\o
rg\hyperic\jni\ArchLoader.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[libarch] amd64-winnt
[echo] java.home=C:\Program Files\Java\jdk1.6.0_24
sigar-version:
[echo] SIGAR git revision exported
version-file:
[echo] cp ./src/org/hyperic/sigar/SigarVersion.java.in -> C:\Users\RjOllos\Downloads\hyperic-si
gar-1.6.4-src\bindings\java\build/./src/org/hyperic/sigar/SigarVersion.java
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src\org\hyperic\sigar
version-file:
[echo] cp ../../src/sigar_version.c.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bi
ndings\java\build/src/sigar_version.c
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
version-file:
[echo] cp ../../src/os/darwin/Info.plist.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-s
rc\bindings\java\build/src/Info.plist
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
version-file:
[echo] cp ../../src/os/win32/sigar.rc.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\
bindings\java\build/src/sigar.rc
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
sigar.rc:
BUILD FAILED
C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build.xml:179: Execute failed: java
.io.IOException: Cannot run program "rc" (in directory "C:\Users\RjOllos\Downloads\hyperic-sigar-1.6
.4-src\bindings\java\build\src"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 23 more
Total time: 2 seconds
Environment:
Visual Studio 2008 Professional
Windows 7 x64
1. I see `unresolved external symbols` while compiling with my project [1]. I will take a guess at the issue - the following files are included in the package:
sigar-amd64-winnt.dll
sigar-x86-winnt.dll
sigar-x86-winnt.lib
Shouldn't there be a `sigar-amd64-winnt.lib`?
2. I tried to build from the source. I am stuck with the errors listed in [2]. I see the declarations and use of those 2 functions in the codebase, but I do not see their implementations!
3. I tried building the project with Ant. I have no experience with Java or Ant, so please forgive me if I'm doing something very stupid here. I see the error in [3].
[1]
Creating library C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.lib and object C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.exp
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_close referenced in function "public: __cdecl SystemInfo::~SystemInfo(void)" (??1SystemInfo@@QEAA@XZ)
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_cpu_info_list_get referenced in function "public: __cdecl SystemInfo::SystemInfo(void)" (??0SystemInfo@@QEAA@XZ)
6>SystemInfo.obj : error LNK2019: unresolved external symbol sigar_open referenced in function "public: __cdecl SystemInfo::SystemInfo(void)" (??0SystemInfo@@QEAA@XZ)
6>C:\Users\RjOllos\Workspace\T834-RO\tmp\runAcq.mexw64 : fatal error LNK1120: 3 unresolved externals
6>Build Time 0:00
6>Build log was saved at "file://C:\Users\RjOllos\Workspace\T834-RO\tmp\Acquisition Server\x64\Release\BuildLog.htm"
6>Acquisition Server - 4 error(s), 0 warning(s)\
[2]
Creating library C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.lib and object C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.exp
3>win32_sigar.obj : error LNK2019: unresolved external symbol sigar_proc_args_wmi_get referenced in function sigar_remote_proc_args_get
3>win32_sigar.obj : error LNK2019: unresolved external symbol sigar_proc_exe_wmi_get referenced in function sigar_proc_exe_get
3>C:\Users\RjOllos\Workspace\T834-RO\tmp\sigar-amd64-winnt.dll : fatal error LNK1120: 2 unresolved externals
[3]
C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java>ant
Buildfile: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build.xml
jni-init:
[mkdir] Created dir: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build\clas
ses
[echo] jni.src=win32, jni.jdk.os=win32, 64-bit
[javac] C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\hyperic_jni\jni-build.x
ml:165: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to fals
e for repeatable builds
[javac] Compiling 6 source files to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\
java\build\classes
[javac] Note: C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\hyperic_jni\src\o
rg\hyperic\jni\ArchLoader.java uses or overrides a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[libarch] amd64-winnt
[echo] java.home=C:\Program Files\Java\jdk1.6.0_24
sigar-version:
[echo] SIGAR git revision exported
version-file:
[echo] cp ./src/org/hyperic/sigar/SigarVersion.java.in -> C:\Users\RjOllos\Downloads\hyperic-si
gar-1.6.4-src\bindings\java\build/./src/org/hyperic/sigar/SigarVersion.java
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src\org\hyperic\sigar
version-file:
[echo] cp ../../src/sigar_version.c.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bi
ndings\java\build/src/sigar_version.c
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
version-file:
[echo] cp ../../src/os/darwin/Info.plist.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-s
rc\bindings\java\build/src/Info.plist
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
version-file:
[echo] cp ../../src/os/win32/sigar.rc.in -> C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\
bindings\java\build/src/sigar.rc
[copy] Copying 1 file to C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build
\src
sigar.rc:
BUILD FAILED
C:\Users\RjOllos\Downloads\hyperic-sigar-1.6.4-src\bindings\java\build.xml:179: Execute failed: java
.io.IOException: Cannot run program "rc" (in directory "C:\Users\RjOllos\Downloads\hyperic-sigar-1.6
.4-src\bindings\java\build\src"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:631)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 23 more
Total time: 2 seconds