291 <code>ldd</code> can be used to verify that all dependent libraries 292 have been satisfied, and all externs can be found. 293 If <code>ldd</code> says anything is missing, it is very likely that the JVM will also 294 be unable to load this library. 295 This usually means that you missed some <code>-l<i>name</i></code> 296 options when building the library, or perhaps forgot a <code>-R path</code> 297 option that tells the library where to look for libraries at runtime. 298 </li> 299 300 <h3> Linux </h3> 301 302 <li> 303 On Linux, using the gcc version 3.2, 304 the typical compile and link command lines might look something like: 305 <br> 306 For X86: 307 <br> 308 <code><ul> 309 gcc -O2 -fPIC -pthread -DLINUX -c <i>*.c</i> 310 <br> 311 gcc -z defs -static-libgcc -shared -mimpure-text -o <i>libXXX.so *.o</i> -lc 312 </code></ul> 313 <br> 314 For AMD64: 315 <br> 316 <code><ul> 317 gcc -O2 -fPIC -pthread -DLINUX -D_LP64=1 -c <i>*.c</i> 318 <br> 319 gcc -z defs -static-libgcc -shared -mimpure-text -o <i>libXXX.so *.o</i> -lc 320 </code></ul> 321 <br> 322 </li> 323 324 <li> 325 MT-Safe, Position Independent: 326 Use <code>-fPIC -pthread</code>. 327 </li> 328 329 <li> 330 Agent Demo Code: Needs -DLINUX 331 </li> 332 333 <li> 334 Register Usage: Use <code>-fno-omit-frame-pointer</code>. 335 <br> 336 It is important that these libraries have frame pointer register usage, see the above comments on the Solaris 337 <code>-xregs=no%frameptr</code> 338 option. 339 </li> 340 341 <li> 342 Library: Use -static-libgcc -mimpure-text. 343 <br> 344 When building the shared library (-shared option), this option 345 allows for maximum portability of the library between different 346 flavors of Linux. 347 The problem we have seen with Linux is that we cannot depend 348 on a compatible shared gcc library existing on all the versions of 349 Linux we can run on. 350 By doing this static link, the version script becomes more 351 important, making sure you don't expose any extern symbols 352 you didn't intend to. 353 </li> 354 355 <li> 356 Dependencies: Use <code>ldd -r <i>LibraryName</i></code>. 357 <br> 358 Provides the same checking as Solaris (see above). 359 </li> 360 361 <h3> Windows </h3> 362 | 291 <code>ldd</code> can be used to verify that all dependent libraries 292 have been satisfied, and all externs can be found. 293 If <code>ldd</code> says anything is missing, it is very likely that the JVM will also 294 be unable to load this library. 295 This usually means that you missed some <code>-l<i>name</i></code> 296 options when building the library, or perhaps forgot a <code>-R path</code> 297 option that tells the library where to look for libraries at runtime. 298 </li> 299 300 <h3> Linux </h3> 301 302 <li> 303 On Linux, using the gcc version 3.2, 304 the typical compile and link command lines might look something like: 305 <br> 306 For X86: 307 <br> 308 <code><ul> 309 gcc -O2 -fPIC -pthread -DLINUX -c <i>*.c</i> 310 <br> 311 gcc -z defs -static-libgcc -shared -o <i>libXXX.so *.o</i> -lc 312 </code></ul> 313 <br> 314 For AMD64: 315 <br> 316 <code><ul> 317 gcc -O2 -fPIC -pthread -DLINUX -D_LP64=1 -c <i>*.c</i> 318 <br> 319 gcc -z defs -static-libgcc -shared -o <i>libXXX.so *.o</i> -lc 320 </code></ul> 321 <br> 322 </li> 323 324 <li> 325 MT-Safe, Position Independent: 326 Use <code>-fPIC -pthread</code>. 327 </li> 328 329 <li> 330 Agent Demo Code: Needs -DLINUX 331 </li> 332 333 <li> 334 Register Usage: Use <code>-fno-omit-frame-pointer</code>. 335 <br> 336 It is important that these libraries have frame pointer register usage, see the above comments on the Solaris 337 <code>-xregs=no%frameptr</code> 338 option. 339 </li> 340 341 <li> 342 Library: Use -static-libgcc. 343 <br> 344 When building the shared library (-shared option), this option 345 allows for maximum portability of the library between different 346 flavors of Linux. 347 The problem we have seen with Linux is that we cannot depend 348 on a compatible shared gcc library existing on all the versions of 349 Linux we can run on. 350 By doing this static link, the version script becomes more 351 important, making sure you don't expose any extern symbols 352 you didn't intend to. 353 </li> 354 355 <li> 356 Dependencies: Use <code>ldd -r <i>LibraryName</i></code>. 357 <br> 358 Provides the same checking as Solaris (see above). 359 </li> 360 361 <h3> Windows </h3> 362 |