[openamq-dev] porting to Ubuntu

Nick Levine ndl at ravenbrook.com
Wed Aug 22 13:37:20 CEST 2007


   >   ld -shared -o libamq.so -luuid -lm -whole-archive libamq_common.a  \
   >     libamq_operate.a libamq_server.a libamq_wireapi.a libapr.a \
   >     libaprutil.a libasl.a libicl.a libipr.a libpcre.a libsfl.a libsmt3.a \
   >     libsmt.a libzip.a /usr/lib/libexpat.so.1 /usr/lib/libcrypt.a

   That explains it ...

   All code going into a shared library has to be compiled with -fPIC,
   otherwise bad things happen, especially if the library uses static
   variables which is the case here (s_os_active_thread_count).

Right. This looks utterly plausible.

   > I don't know. Machine isn't mine, it's remote to me (I access it via
   > ssh). What's the incantation for finding out?

   cat /proc/cpuinfo, but it's not relevant since I can see that it's
   the .so that's causing the problem.

OK, but for the record:

  processor	: 0
  vendor_id	: AuthenticAMD
  cpu family	: 15
  model		: 65
  model name	: Dual-Core AMD Opteron(tm) Processor 2214 HE
  stepping	: 2
  cpu MHz		: 2200.212
  cache size	: 1024 KB
  fdiv_bug	: no
  hlt_bug		: no
  f00f_bug	: no
  coma_bug	: no
  fpu		: yes
  fpu_exception	: yes
  cpuid level	: 1
  wp		: yes
  flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow up pni cx16 lahf_lm ts fid vid ttp tm stc
  bogomips	: 4426.96
  clflush size	: 64


   >    4) Does our standard client code work correctly? e.g. Can you
   >    run "amq_server" and "amq_client" with no parameters against
   >    it?
   > 
   > Yes, and amq_shell

   Just to confirm 100% that it *is* the .so, can you try manually
   linking amq_client against the .so rather than the static
   libraries? You can get the link command by doing "c -v -L
   amq_client" in the OpenAMQ-XXX/clients directory. Take out the .a
   files and specify the full path to your shared library.

   I'd expect it to not work ...

   Once we confirm that this is the case, we can look at a temporary
   solution to make the shared library work for you.

I had problems communicating with gcc via the "c" script, so after
watching what "c" did I invoked gcc directly:

  nick at nick:~/openamq-src/OpenAMQ-1.2c1/OpenAMQ-1.2c1/clients$ gcc  -g -O -Wall -pthread  amq_client.o -o amq_client -Wl,--start-group  -lm  -Wl,--end-group -L. -L/tmp -L/home/nick/lib -lm -lamq -ldl
  nick at nick:~/openamq-src/OpenAMQ-1.2c1/OpenAMQ-1.2c1/clients$ ./amq_client
  ./amq_client: error while loading shared libraries: libamq.so: cannot open shared object file: No such file or directory
  nick at nick:~/openamq-src/OpenAMQ-1.2c1/OpenAMQ-1.2c1/clients$ LD_LIBRARY_PATH=/tmp ./amq_client
  13:29:42: I: opened 1 connection to OpenAMQ Server/1.2c1
  13:29:42: I: (1) sending 1 messages to server...
  nick at nick:~/openamq-src/OpenAMQ-1.2c1/OpenAMQ-1.2c1/clients$ LD_LIBRARY_PATH=/tmp ldd amq_client
	  linux-gate.so.1 =>  (0xffffe000)
	  libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7f20000)
	  libamq.so => /tmp/libamq.so (0xb7a96000)
	  libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7a91000)
	  libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7a7a000)
	  libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7939000)
	  /lib/ld-linux.so.2 (0xb7f50000)
	  libuuid.so.1 => /lib/libuuid.so.1 (0xb7936000)
	  libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb7916000)
  nick at nick:~/openamq-src/OpenAMQ-1.2c1/OpenAMQ-1.2c1/clients$

Not a hopeful sign?

-nick




More information about the openamq-dev mailing list