FB/Win32/MSYS compilation docs fixed

Forum for discussion about the documentation project.
jonathanbrickman0000
Posts: 189
Joined: Dec 23, 2005 21:16
Location: Topeka, Kansas, USA
Contact:

FB/Win32/MSYS compilation docs fixed

Post by jonathanbrickman0000 »

They appear to be fixed. If anyone finds a problem, please post it here. Also, if anyone knows how to add /mingw/lib to the standard linker path, or could add it to the standard CVS, that would be very helpful!
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Re: FB/Win32/MSYS compilation docs fixed

Post by Sisophon2001 »

jonathanbrickman0000 wrote:<snip> Also, if anyone knows how to add /mingw/lib to the standard linker path, or could add it to the standard CVS, that would be very helpful!
Why do you want to do this? If users have MinGW then it will be in different locations on different computers. Are you concerned with the ld that comes with FB or the ld that comes with MinGW?

If you need to link to extra libraries why not put them in the FB lib directory?

If you want to see the searched paths, run

ld --verbose

I read someplace that the default search paths for ld were set at compile time, but I also noted that we have a file called i386pe.x in our bin directory which being curious about what it was for, I opened, and saw that it appears to be setting a default search path for ld.

I just tried it now, and I can edit this file to add new search paths to the linker, by copying the syntax from ld –-verbose.

Garvan
jonathanbrickman0000
Posts: 189
Joined: Dec 23, 2005 21:16
Location: Topeka, Kansas, USA
Contact:

Post by jonathanbrickman0000 »

Actually, /lib/mingw will be /lib/mingw on any working MSYS installation; gcc/MSYS requires it, and MSYS sets up its own virtual paths (forward slashes only) in addition to Windows-standard. Ditto Cygwin, to an extent differently (no Windows-standard, somewhat different tree, but /lib and /lib/mingw are still there).

fbc is using its own supplied ld, which does not know about the standard MSYS or Cygwin paths.

I found the .x file you pointed out; I think that is the way. It is a standard ld linker script, and so I might be able to add a line to its end to add /lib/mingw (no drive letter, forward-slashes) to the standard Win32 FB ld search path. But I would appreciate it if someone experienced in FB ld scripts would do it and put it in CVS; I studied that script file, and it's a language all its own.
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

Did you look at the paths ld searches using ld --verbose?

This is the default search path of the linker that comes with FreeBASIC.

SEARCH_DIR("/mingw/mingw32/lib"); SEARCH_DIR("/mingw/lib"); SEARCH_DIR("/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

The Script file adds one additional search path.

SEARCH_DIR("lib");

I don’t have any problem building the compiler with MSYS, so what problem are you seeing?

Did you copy libmingwex.a into your FB lib directory?

Garvan
jonathanbrickman0000
Posts: 189
Joined: Dec 23, 2005 21:16
Location: Topeka, Kansas, USA
Contact:

Post by jonathanbrickman0000 »

Garvan, that's it. Easy as pie, works great. I should have thought of that, simply because FBC comes with its own ld.exe. MSYS procedure adjusted; Cygwin shortly.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

I just read the procedures now, and it appears that you are building the compiler before rtlib, which means that the new fbc will still be linked with the old rtlib. If you want to have the latest fbc linked with the latest rtlib, you should build the rtlib first, then the compiler. To be extra safe (in case some part of the rtlib <-> compiler interface changes drastically), you could rebuild the compiler first as is done now, then again after building the new rtlib.
jonathanbrickman0000
Posts: 189
Joined: Dec 23, 2005 21:16
Location: Topeka, Kansas, USA
Contact:

Post by jonathanbrickman0000 »

So should it be something like:

Build rtlib, copy to ~FB/lib
Build rtlibx, copy to ~FB/lib
Build compiler, copy to ~FB/lib

Or should it be...

Build rtlib
Build rtlibx
Build compiler
Copy all three to ~FB/lib

Or some other permutation?
Sisophon2001
Posts: 1706
Joined: May 27, 2005 6:34
Location: Cambodia, Thailand, Lao, Ireland etc.
Contact:

Post by Sisophon2001 »

Always follow the first option, but be careful to have backups of the libraries. The old fbc may be incompatible with the new runtime library or it can fail to compile the new fbc, but this will not happen often.

If you follow the second option, the new compiler gets linked to the old library and you have a hybrid version that may be buggy.

The correct answer may depend on the modifications made since the last compiler update.

Several times I needed to modify the source code downloaded from SF so that I could build an intermediate version that I in then used to compile CVS version.

This game of following the latest build is not always a straight forward one, and it is often not worth the effort, unless you are interested in learning.

For general advice, it is sometimes recommended to build a self compiling compiler three times before use. This process should work out any obvious cyclic bugs, which appear in every second version of a compile.

Garvan

EDIT 2006-05-03:
Re-read my post, and decided it did not say exactly as I intended, so I updated it.
jonathanbrickman0000
Posts: 189
Joined: Dec 23, 2005 21:16
Location: Topeka, Kansas, USA
Contact:

Post by jonathanbrickman0000 »

Thanks, Siso. I referenced your post immediately above in a note at the end of each doc. I'll do better as soon as I am given time.
ici
Posts: 17
Joined: Sep 29, 2006 20:24
Location: Sofia, Bulgaria
Contact:

Post by ici »

Hi all, and especially DrV :)

Please change in CVS Tree, src/rtlib/win32/fb_win32.h, line 80:

Code: Select all

#ifdef TARGET_CYGWIN
typedef _off64_t fb_off_t;
#else
typedef off64_t fb_off_t;
#endif
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

Thanks, updated in CVS.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Post by 1000101 »

In the section titled "Updating the FreeBASIC software installed in MSYS" there is an error. The current line regarding the first of the copies of the newly compiled compiler reads as follows:
wiki wrote:cp -fv ~/fbccvs/FreeBASIC/bin/win32/* /FBbin/win32/bin
It should actually read:
cp -fv ~/fbccvs/FreeBASIC/bin/win32/* /FBbin/bin/win32
ici
Posts: 17
Joined: Sep 29, 2006 20:24
Location: Sofia, Bulgaria
Contact:

Post by ici »

Linux build, required one step more for me on Suse 10.1, after first cvs update
Make rtlib above make install
mkdir -p ../../../../lib/linux
All steps again also: http://www.freebasic.net/forum/viewtopi ... 1934#51934
--edit--
strip debug info from libraries!
--edit--
make clean before second build
wolfman775
Posts: 104
Joined: Apr 30, 2009 15:20
Location: Dumbarton, Scotland

Post by wolfman775 »

I got to make rtlib and just copied and pasted the commands and when it got to autoreconf I got this error:
Wolfman@FM-WIN7-LAPTOP ~/fbccvs
$ cd ~/fbccvs/FreeBASIC/src/rtlib

Wolfman@FM-WIN7-LAPTOP ~/fbccvs/FreeBASIC/src/rtlib
$ autoreconf
11 [main] perl 2292 C:\cygwin\bin\perl.exe: *** fatal error - unable to remap C:\cygwin\lib\perl5\5.10\i686-cygwin\auto\File\Glob\Glob.dll to same address as parent(0xA00000) != 0xA90000
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

If you're trying the MinGW build, then maybe having cygwin tools in your path is causing problems.

Also: if your instructions mention CVS, they're very out of date. FB has been using SVN for a while. Try the wiki:
http://www.freebasic.net/wiki/wikka.php ... SVNCompile
Post Reply