Anyone else compiling OT on Linux 64bit? I ran into some problems
once before, but successfully compiled it. I would like to streamline
the process this time. Most of the issues were related to FPIC and
emerged when compiling the Java API.
Thanks and congrats to Fellow Traveler for recent accomplishments and
media appearances!
-BM
the path should be based on $JDK_HOME , no?
I played around with the fPIC flag for close to 2 days.
Unfortunately, I couldn't find a simple place to add it that seems to
work in a consistent way.
-bm
JDK_HOME and JRE_HOME are Java standards in my understanding... -BM
Another issue :
/usr/lib/jvm/java-6-sun-1.6.0.24/include/jni.h:27: fatal error:
jni_md.h: No such file or directory
requires a change in the include path for $JDK_HOME/include/linux
not sure what the structure looks like on Mac/Windows.
just writing this down here so that someone has some reference if they
attempt something similar.
-bm
Tried setting DYNAMIC_FLAG = -fPIC
Doesn't work. I got this to compile a few weeks ago and I couldn't
find a consistent way to include a new flag in every compilation
statement. Perhaps Fellow Traveler can advise.
the compile error:
/usr/bin/ld: ../xmlrpcpp//libXmlRpc.a(XmlRpcClient.o): relocation
R_X86_64_32 against `.rodata.str1.8' can not be used when making a
shared object; recompile with -fPIC
../xmlrpcpp//libXmlRpc.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
-BM
See this:
https://github.com/FellowTraveler/Moneychanger/wiki/Troubleshooting
OT automatically detects 64bit and builds that way.
The problem is OpenSSL. Even on 64 bit systems, OpenSSL still builds in
32 bit, thus causing link errors with 64 bit OT.
I think solution is to use ./configure on openssl and build it properly
for 64 bit. Then it will link fine with OT.
I haven't really determined what files need -fPIC and which ones
don't. There are innumerable combinations so I don't think the
experimental approach will be too effective here.
> If it is required elsewhere then that is probably not too useful.
>
> Also, regarding the java environment variables, it might well be a
> standard but it isn't set by default on my system. I am not too big on
> java stuff though, so perhaps it is accessible from within java itself
> rather than as a shell environment variable. I don't know. Regardless,
> out of the box, that is not set on Debian.
>
I'm on Ubuntu and it is very similar. Did you install the Sun Linux JDK?
-bm
I did recompile openssl the first time I went through this process with
the "-fPIC shared" flags.
-bm
I could be wrong but...
-fPIC has nothing to do with it.
fPIC is about compiling to account for dynamic libraries.
OT will use fPIC automatically already if it needs to build something in
dynamic mode.
------
What we are talking about here is 64 bit mode. If you are on a 64 bit
machine, OpenSSL will still build in 32 bit mode. You have to EXPLICITLY
configure OpenSSL for 64 bit before you build it.
(and fPIC is not what does that.) The configure script that comes with
openssl has the option I am talking about.
-FT
I could not find any simple instructions for doing this. As far as I
can tell it's not a simple config switch.
could you give me a link with instructions for compiling in 64bit?
-bm
1) cd openssl
2) ./Configure YOUR_PLATFORM_GOES_HERE
For YOUR_PLATFORM_GOES_HERE, use the correct choice from this list:
linux-alpha+bwx-ccc
linux-alpha+bwx-gcc linux-alpha-ccc linux-alpha-gcc linux-aout linux-armv4
linux-elf linux-generic32 linux-generic64 linux-ia32-icc linux-ia64
linux-ia64-ecc linux-ia64-icc linux-ppc linux-ppc64 linux-s390x
linux-sparcv8
linux-sparcv9 linux-x86_64 linux64-sparcv9
3) THEN BUILD OPENSSL. (Probably just type 'make').
FYI, Open-Transactions *definitely* detects 64 bit and builds that way,
but unfortunately, OpenSSL does not. You must explicitly build OpenSSL
for 64 bit, if you run a 64-bit machine, or you WILL DEFINITELY have
linker problems trying to build OT.
-FT
the 'java' target gives me the same exact link error.
/usr/bin/ld: ../xmlrpcpp//libXmlRpc.a(XmlRpcClient.o): relocation
R_X86_64_32 against `.rodata.str1.8' can not be used when making a
shared object; recompile with -fPIC
../xmlrpcpp//libXmlRpc.a: could not read symbols: Bad value
mind you that I DID get it to work prior by making sure everything was
compiled with -fPIC.
-bm
I just did some investigation in the Makefile....
Check out the difference between the RPC target and the Java target:
rpc:
cd xmlrpcpp && $(OT_MAKE)
java:
cd xmlrpcpp && $(OT_MAKE) $(DYNAMIC_FLAG)
As you can see, if you didn't "clean" between builds, then some of the
resulting binaries are dynamic, and some are not. (xmlrpcpp for example.)
THEREFORE: My guess is that it worked correctly when you did "make
rpc", but then you did NOT do a "make clean" before trying "make java".
As a result of that, the XmlRpc files were still built in rpc
(non-dynamic) mode, and thus they were unable to link to the other files
that were built in java (dynamic) mode.
This is why you see the error on the XmlRpc file.
TO FIX, TRY THIS:
cd Open-Transactions && make clean && make java
And tell me if it works, please.
-FT