All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
building OCaml-3.08.2 on interix
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login  |
|
|
building OCaml-3.08.2 on interix - Jan. 31, '05, 7:02:27 PM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
Hi,
I've been trying to build OCaml-3.08.2 on interix. It is not currently supported by the OCaml guys on interix, but I have been able to build successfully on one of my interix instances (I have it on two PCs). I'm trying to build on the other instance and I get an error that seems like a problem with interix, not OCaml (since I could build on the other instance successfully).
I also think the problem is related to interix because the only mention of a similar problem I've found on the net is on the interix forum with respect to ftp 3.4b's initial release version (the forum topic).
Can anybody point me in the right direction to getting my OCaml build to work right again?
Thanks,
Kelly Leahy
|
|
|
RE: building OCaml-3.08.2 on interix - Jan. 31, '05, 7:25:44 PM
|
|
|
Rodney
Posts: 3143
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
So you have two machines with additional packages from here (/Tools).
Do both machines have the same packages or different?
|
|
|
RE: building OCaml-3.08.2 on interix - Jan. 31, '05, 7:31:45 PM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
On the first machine, I didn't install packages using pkgadd (I didn't know it existed until I set up the other machine). Mostly, I just tar x'ed the packages into /usr/local and set up the LD_LIBRARY_PATH, MANPATH, and PATH appropriately. On the second machine I have the following packages installed:
bash-3.0.0.2-bin Version 3.0.0.2 of bash for Interix 3.5.
catman-1.6-bin Version 1.6 of catman for Interix 3.5.
cvs-1.12.9.2-bin Version 1.12.9.2 of cvs for Interix 3.5.
emacs-21.2-bin Version 21.2 of emacs for Interix 3.5.
env_cflags_gcc-1.0.1-bin Version 1.0.1 of env_cflags_gcc for Interix 3.5.
env_cppflags_local-1.2-bin Version 1.2 of env_cppflags_local for Interix 3.5.
env_cppflags_ssl-1.1-bin Version 1.1 of env_cppflags_ssl for Interix 3.5.
env_ldflags_local-1.0.2-bin Version 1.0.2 of env_ldflags_local for Interix 3.5.
env_ldflags_ssl-1.0.1-bin Version 1.0.1 of env_cflags_gcc for Interix 3.5.
env_ldlibrarypath_local-1.0.1-bin Version 1.0.1 of env_ldlibrarypath_local for Interix 3.5.
env_ldlibrarypath_ssl-1.0.1-bin Version 1.0.1 of env_cflags_gcc for Interix 3.5.
env_manpath_local-1.0.1-bin Version 1.0.1 of env_manpath_local for Interix 3.5.
env_manpath_localshare-1.0.1-bin Version 1.0.1 of env_manpath_localshare for Interix 3.5.
env_manpath_ssl-1.0.1-bin Version 1.0.1 of env_manpath_ssl for Interix 3.5.
env_path_local-1.0.1-bin Version 1.0.1 of env_path_local for Interix 3.5.
ftp-3.4b-bin Version 3.4b of ftp for Interix 3.5.
gettext-0.14.1.7-bin Version 0.14.1.7 of gettext for Interix 3.5.
glib-2.4.0.3-bin Version 2.4.0.3 of glib for Interix 3.5.
gmake-3.80.1-bin Version 3.80.1 of gmake for Interix 3.5.
groff-1.17.2.2-bin Version 1.17.2.2 of groff for Interix 3.5.
gzip-1.2.4b-bin Version 1.2.4b of gzip for Interix 3.5.
jpeg-6b.3-bin Version 6b.3 of jpeg for Interix 3.5.
libcrypt-1.2.4-bin Version 1.2.4 of libcrypt for Interix 3.5.
libiconv-1.9.2.3-bin Version 1.9.2.3 of libiconv for Interix 3.5.
libncurses-5.4-bin Version 5.4 of libncurses for Interix 3.5
libpng-1.2.7-bin Version 1.2.7 of libpng for Interix 3.5.
ls-1.1-bin Version 1.1 of ls for Interix 3.5.
openssh-3.9.0.1.4-bin Version 3.9.0.1.4 of openssh for Interix 3.5.
openssl-0.9.7d.3-bin Version 0.9.7d.2 of openssl for Interix 3.5.
pax-1.5.1-bin Version 1.5.1 of pax for Interix 3.5.
pkg-1.8-bin Version 1.8 of pkg for Interix 3.5.
pkgconfig-0.15.0.1-bin Version 0.15.0.1 of pkgconfig for Interix 3.5.
stat-1.0.2-bin Version 1.0.2 of stat for Interix 3.5.
syslogd-1.1-bin Version 1.1 of syslogd for Interix 3.5.
tiff-3.5.7.5-bin Version 3.5.7.5 of tiff for Interix 3.5.
vim-6.3-bin Version 6.3 of vim for Interix 3.5.
which-2.16-bin Version 2.16 of which for Interix 3.5.
zlib-1.1.4e-bin Version 1.1.4e of zlib for Interix 3.5.
I just thought that maybe you would have an idea how to resolve the __pctype_used missing symbol problem with libc.so.3.5
Did I forget to mention that in the original post? If so, I'm sorry.
|
|
|
RE: building OCaml-3.08.2 on interix - Jan. 31, '05, 10:42:49 PM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
ok...
I've managed to get my OCaml distribution built by linking with static libraries and removing the -ldl link library reference. I'm not sure why this fixes the problem (actually I understand why it fixes it, but I can't figure out why the problem only occurred on one of my two machines).
Anyway, thanks for listening.
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 2:12:39 AM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
I found another solution. It seems that libc.so.3.5 contains a undefined symbol reference to __pctype_used. It also seems that this symbol is only defined by libcompat30.a and libc.a. I created a .so for libcompat30 (there wasn't one, which I found a bit weird) and voila, it worked! Of course, I had to add a -lcompat30 to my link command in OCaml's build Makefile, but that was easy.
Kelly
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 10:29:20 AM
|
|
|
markfunk
Posts: 629
Joined: Mar. 31, '03,
Status: offline
|
You may think it works .....
I'm not sure this will work. I could be wrong. I'm not sure.
Well, I'm pretty sure this solution is very risky.
The pctype_used is a very special and fragile
variable that is used to test whether or not your binary contains
incompatible code from earlier versions of Interix libraries
or object code compiled in an Interix 3.0 or Interix 2.2 environment.
This variable is used in setlocale(). And if the wrong version
of pctype_used variable is linked into your binary, then setlocale() may
terminate your program with a warning
(ie. it may trigger a false alarm in a pure Interix 3.5 environment)
The code was never designed for libcompat30 to be made into a .so.
There was a reason why this code never made it into libc.so.
(you'll notice these object files _are_ in libc.a)
There was no testing done to determine what the linker will do
with the contents of this .so file. In fact, I'm not sure we did any testing
with dynamic builds.
We knew exactly what the linker behaviour was when these object files
were in a .a archive.
What you need to do is ensure "libcompat30.a" is the very last archive
to be linked in when ld is invoked. This isn't usually easy to do.
However, there is another solution: but only if you can guarantee
that NO object files built using Interix 3.0 (or Interix 2.2) are
linked into your binary. (ie you are using sources compiled in Interix 3.5
environment).
The solution is: create a global variable in your code
extern int _pctype_used = 0;
(or you could extract the pctype_used.o from the libcompat30.a and
use that.)
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 11:02:56 AM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
Thanks markfunk.
You seem to have a pretty good handle on this problem (much better than anything I could find anywhere on the internet, for certain!). Can you tell me what is actually wrong with the link options in my build that would cause this problem to manifest itself? Is it something in the code, not the link options?
I can understand (sortof) that the symbol is not defined in libc, but why do other programs link successfully, but this particular one doesn't? Is it calling some functions that are in .o's (in the .so) that it shouldn't be, and cause the undefined symbol to manifest itself?
Thanks,
Kelly
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 7:46:01 PM
|
|
|
markfunk
Posts: 629
Joined: Mar. 31, '03,
Status: offline
|
My guess is that your program is calling setlocale().
That's the only object file that references this symbol.
There's probably nothing wrong with your link options.
It is just that no one (at Microsoft) tested building a dynamic binary
(ie using the gcc that ships with SFU3.5) with source code that
that uses setlocale().
The more correct way to fix this is to change the default gcc
link parameters so that libcompat30.a is add to the very end
of the ld command line (you can see what gcc does by using the -v option)
I suppose if you put libcompat30.a as the very last argument on your
link/gcc command line, it should work too.
Just as long as you are building dynamic binaries. (gcc defaults to this
mode in SFU3.5)
If you're building static binaries, you don't want to do this
since gcc will be linking with libc.a and the pctype_used code is
already in libc.a.
This was not a problem in SFU3.0 since the default behaviour of
Interix gcc was to build static binaries - not dynamic.
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 7:52:09 PM
|
|
|
kellyleahy
Posts: 6
Joined: Jan. 31, '05,
Status: offline
|
Thanks for the more detailed explanation.
This is probably a dumb question, but I'm not so familiar with default gcc options. Is there a file or environ variable somewhere that I need to edit to add -lcompat30 to the default libs, or is this in the build (Makefile)?
Also, is there someplace that I should report this oversight to MS, so that it can be fixed in the future?
Kelly
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 1, '05, 8:03:54 PM
|
|
|
markfunk
Posts: 629
Joined: Mar. 31, '03,
Status: offline
|
quote:
You seem to have a pretty good handle on this problem
Only because I wrote this code (in a previous life) :->
As far as I know, there is no gcc "config" file that can be tweeked
by us to get this right. But I haven't used gcc in a long time
so I could be wrong.
(Well, you could take the gcc source code from the CD and tweek
the right file and rebuild/relink it. But its probably not worth it)
Try the simple approach and add libcompat30.a in your Makefile for now.
If you wanted to post a bug report on the Microsoft public newsgroup
microsoft.public.servicesforunix.general
This is a place that should be watched by SFU devs.
They may also be watching here too.
Or you could contact Microsoft PSS (support) and file a bug.
Or sometimes Rodney will forward the problem to Microsoft.
(This is very likely, given that Rodney just tripped over the
same problem in "ddd" from the Tool Warehouse. He may experiment
with gcc and come up with a diff. solution)
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 2, '05, 1:24:47 AM
|
|
|
Rodney
Posts: 3143
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
Microsoft is aware of this problem. I ran into it fairly early on
with the 3.5 release. I never heard anything back about its status.
It's just damned weird to run an application just fine on one machine
and not on another (given all configurations the same on the two machines).
The "short & painless" fix is to just link static when you run into this
(as you/kellyleahy discovered).
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 2, '05, 10:00:48 AM
|
|
|
markfunk
Posts: 629
Joined: Mar. 31, '03,
Status: offline
|
Ah-hah !!
There may be a hack you can try.
In the file /opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/specs
go to line 54 which says "-lgcc"
Change this to "-lgcc -lcompat30"
Make sure you remove your /usr/lib/libcompat30.so
I think this should work.
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 11, '05, 10:56:38 AM
|
|
|
Rodney
Posts: 3143
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
I've recently just used this method to relink ddd which was
exhibiting the same problem. It seems to work without problems.
Thanks to Mark for thinking for this idea.
I'm thinking I'll make this patch as a package of it's own. This
should help people nervous about doing this themselves and/or
more accurate. I'll post in Announce and here when I have it ready.
Comments are welcome of course.
|
|
|
RE: building OCaml-3.08.2 on interix - Feb. 11, '05, 11:25:51 AM
|
|
|
Rodney
Posts: 3143
Joined: Jul. 9, '02,
From: /Tools lab
Status: online
|
Okay, I've made it as a package now.
It'll get Announced in a few minutes and up on the web page later.
To install do:
pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/gcc_3.3_patch-current-bin.tgz
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|