Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-03

Freepascal on OSX 10.9 Mavericks $LINKLIB gcc broken

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
Now that OSX Mavericks 10.9 is running full speed, it has broken the
{$LINKLIB gcc} compiler directive.
{$LINKLIB c} still WORKS.
But {$LINKLIB gcc} does not.

The reason is that Mavericks does not use GCC any more, it is using clang, a new compiler.

So now Freepascal users need to know how to resolve errors:

Undefined symbols for architecture i386:
"___divdi3", referenced from libmystatic.a,
"___moddi3", referenced from libmystatic.a, etc...

ANybody got ideas?

I tried {$LINKLIB clang}, it does not exist.

Thanks for any ideas,

Marco

Reply by email

Unknown author
to Unknown author

After diving deeply into the dependency tree,

there are 2 libraries that are involved in this particular problem:

/usr/lib/libSystem.B.dylib
/usr/lib/libgcc_s.1.dylib

But I cannot figure out yet how to call up the libgcc_s.1.dylib

{$LINKLIB /usr/lib/gcc [many variations tried] }

The mystery continues....

md

Show quoted text 34 lines
Now that OSX Mavericks 10.9 is running full speed, it has broken the {$LINKLIB gcc} compiler directive. {$LINKLIB c} still WORKS. But {$LINKLIB gcc} does not. The reason is that Mavericks does not use GCC any more, it is using clang, a new compiler. So now Freepascal users need to know how to resolve errors: Undefined symbols for architecture i386: "___divdi3", referenced from libmystatic.a, "___moddi3", referenced from libmystatic.a, etc... ANybody got ideas? I tried {$LINKLIB clang}, it does not exist. Thanks for any ideas, Marco _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Peter Brooks
to Unknown author: Now that OSX Mavericks 10.9 is running full speed, it has broken the {$LINKLIB gcc}…

I'm a bit surprised. As it happens, just this week I compiled the fpc compiler from scratch on Mavericks. It worked perfectly well, and is compiling perfectly well - version 2.6.0.

I was wondering, though, whether there was any enhanced support for features on the Intel 'Sandy-Bridge' and 'Ivy-Bridge' processors - the i5 chips.

Show quoted text 31 lines
Now that OSX Mavericks 10.9 is running full speed, it has broken the {$LINKLIB gcc} compiler directive. {$LINKLIB c} still WORKS. But {$LINKLIB gcc} does not. The reason is that Mavericks does not use GCC any more, it is using clang, a new compiler. So now Freepascal users need to know how to resolve errors: Undefined symbols for architecture i386: "___divdi3", referenced from libmystatic.a, "___moddi3", referenced from libmystatic.a, etc... ANybody got ideas? I tried {$LINKLIB clang}, it does not exist. Thanks for any ideas, Marco _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Jonas Maebe
to Unknown author: After diving deeply into the dependency tree, there are 2 libraries that are involved in…
Show quoted text 8 lines
After diving deeply into the dependency tree, there are 2 libraries that are involved in this particular problem: /usr/lib/libSystem.B.dylib /usr/lib/libgcc_s.1.dylib But I cannot figure out yet how to call up the libgcc_s.1.dylib

Since the library is called libgcc_s, use {$linklib gcc_s}. You don't have to (and shouldn't) explicitly link in libSystem, that's already done by the compiler.

Jonas

Reply by email

Unknown author
to Peter Brooks: I'm a bit surprised. As it happens, just this week I compiled the fpc compiler from…

Peter:

I was surprised too. That is why I broadcast the alarm to the FPC community.

I am running FPC 2.6.2 - Lazarus 1.0.14

Yes, I can recompile FPC from scratch on Mavericks. I can compile perfectly well on Mavericks too.

No, I cannot issue the {$LINKLIB gcc } command on Mavericks OSX 10.9

Have you tried the {$LINKLIB gcc } command?

Anybody else got ideas?

md

Peter Brooks wrote 44 lines
I'm a bit surprised. As it happens, just this week I compiled the fpc compiler from scratch on Mavericks. It worked perfectly well, and is compiling perfectly well - version 2.6.0. I was wondering, though, whether there was any enhanced support for features on the Intel 'Sandy-Bridge' and 'Ivy-Bridge' processors - the i5 chips. On 10 March 2014 05:32, wrote: > Now that OSX Mavericks 10.9 is running full speed, it has broken the > {$LINKLIB gcc} compiler directive. > > {$LINKLIB c} still WORKS. > But {$LINKLIB gcc} does not. > > The reason is that Mavericks does not use GCC any more, it is using clang, > a new compiler. > > So now Freepascal users need to know how to resolve errors: > > Undefined symbols for architecture i386: > "___divdi3", referenced from libmystatic.a, > "___moddi3", referenced from libmystatic.a, etc... > > ANybody got ideas? > > I tried {$LINKLIB clang}, it does not exist. > > Thanks for any ideas, > > Marco > > > > > > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Peter Brooks
to Unknown author

Why are you wanting to use gcc instead? If I wanted to do this, I'd just replace c with a link to gcc.

Show quoted text 72 lines
Peter: I was surprised too. That is why I broadcast the alarm to the FPC community. I am running FPC 2.6.2 - Lazarus 1.0.14 Yes, I can recompile FPC from scratch on Mavericks. I can compile perfectly well on Mavericks too. No, I cannot issue the {$LINKLIB gcc } command on Mavericks OSX 10.9 Have you tried the {$LINKLIB gcc } command? Anybody else got ideas? md On 3/10/2014 1:03 AM, Peter Brooks wrote: > > I'm a bit surprised. As it happens, just this week I compiled the fpc > compiler from scratch on Mavericks. It worked perfectly well, and is > compiling perfectly well - version 2.6.0. > > I was wondering, though, whether there was any enhanced support for > features on the Intel 'Sandy-Bridge' and 'Ivy-Bridge' processors - the > i5 chips. > > On 10 March 2014 05:32, wrote: >> >> Now that OSX Mavericks 10.9 is running full speed, it has broken the >> {$LINKLIB gcc} compiler directive. >> >> {$LINKLIB c} still WORKS. >> But {$LINKLIB gcc} does not. >> >> The reason is that Mavericks does not use GCC any more, it is using >> clang, >> a new compiler. >> >> So now Freepascal users need to know how to resolve errors: >> >> Undefined symbols for architecture i386: >> "___divdi3", referenced from libmystatic.a, >> "___moddi3", referenced from libmystatic.a, etc... >> >> ANybody got ideas? >> >> I tried {$LINKLIB clang}, it does not exist. >> >> Thanks for any ideas, >> >> Marco >> >> >> >> >> >> >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Unknown author
to Jonas Maebe: Since the library is called libgcc_s, use {$linklib gcc_s}. You don't have to (and…

Jonas,

Unfortunately, your suggestion while appreciated does not work.

For example, the actual function "__divdi3" actually lives in /usr/lib/system/libcompiler_rt.dylib

This library does not exist on Snow Leopard. But it does exist on Mavericks. (I do not have Lion/Mtn Lion available)

{$LINKLIB gcc_s} does not work -> Library NOT found by FPC compiler/linker
{$LINKLIB compiler_rt} does not work -> Library NOT found by FPC
compiler/linker
{$LINKLIB /usr/lib/system/libcompiler_rt.dylib} does not work -> Library
NOT found by FPC compiler/linker
{$LINKLIB /usr/lib/libgcc_s.1.dylib} does not work -> Library NOT found
by FPC compiler/linker
I also tried using:
{$LIBRARYPATH /usr/lib/system}
{$LINKLIB compiler_rt}

So this is more challenging that I originally thought.

Must I go back to Mountain Lion to do OSX development with FPC/Lazarus?

The mystery still continues...

Jonas Maebe wrote 18 lines
On 10 Mar 2014, at 05:15, wrote: > After diving deeply into the dependency tree, > > there are 2 libraries that are involved in this particular problem: > > /usr/lib/libSystem.B.dylib > /usr/lib/libgcc_s.1.dylib > > But I cannot figure out yet how to call up the libgcc_s.1.dylib Since the library is called libgcc_s, use {$linklib gcc_s}. You don't have to (and shouldn't) explicitly link in libSystem, that's already done by the compiler. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Unknown author
to Peter Brooks: Why are you wanting to use gcc instead? If I wanted to do this, I'd just replace c with a…

Peter:

I must use some form of {$LINKLIB gcc}

{$LINKLIB c} still WORKS under OSX 10.9
{$LINKLIB gcc} does not work user OSX 10.9 Mavericks.

"__divdi3" unresolved reference lives in the gcc run time library chain.

md

Peter Brooks wrote 77 lines
Why are you wanting to use gcc instead? If I wanted to do this, I'd just replace c with a link to gcc. On 10 March 2014 16:14, wrote: > Peter: > > I was surprised too. That is why I broadcast the alarm to the FPC > community. > > I am running FPC 2.6.2 - Lazarus 1.0.14 > > Yes, I can recompile FPC from scratch on Mavericks. > I can compile perfectly well on Mavericks too. > > No, I cannot issue the {$LINKLIB gcc } command on Mavericks OSX 10.9 > > Have you tried the {$LINKLIB gcc } command? > > Anybody else got ideas? > > md > > > On 3/10/2014 1:03 AM, Peter Brooks wrote: >> I'm a bit surprised. As it happens, just this week I compiled the fpc >> compiler from scratch on Mavericks. It worked perfectly well, and is >> compiling perfectly well - version 2.6.0. >> >> I was wondering, though, whether there was any enhanced support for >> features on the Intel 'Sandy-Bridge' and 'Ivy-Bridge' processors - the >> i5 chips. >> >> On 10 March 2014 05:32, wrote: >>> Now that OSX Mavericks 10.9 is running full speed, it has broken the >>> {$LINKLIB gcc} compiler directive. >>> >>> {$LINKLIB c} still WORKS. >>> But {$LINKLIB gcc} does not. >>> >>> The reason is that Mavericks does not use GCC any more, it is using >>> clang, >>> a new compiler. >>> >>> So now Freepascal users need to know how to resolve errors: >>> >>> Undefined symbols for architecture i386: >>> "___divdi3", referenced from libmystatic.a, >>> "___moddi3", referenced from libmystatic.a, etc... >>> >>> ANybody got ideas? >>> >>> I tried {$LINKLIB clang}, it does not exist. >>> >>> Thanks for any ideas, >>> >>> Marco >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> fpc-pascal maillist - >>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal >> > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email

Jonas Maebe
to Unknown author: Unfortunately, your suggestion while appreciated does not work. For example, the actual…
Show quoted text 7 lines
Unfortunately, your suggestion while appreciated does not work. For example, the actual function "__divdi3" actually lives in /usr/lib/system/libcompiler_rt.dylib This library does not exist on Snow Leopard. But it does exist on Mavericks. (I do not have Lion/Mtn Lion available)

It's the equivalent of libgcc for LLVM.

Show quoted text 11 lines
{$LINKLIB gcc_s} does not work -> Library NOT found by FPC compiler/linker {$LINKLIB compiler_rt} does not work -> Library NOT found by FPC compiler/linker {$LINKLIB /usr/lib/system/libcompiler_rt.dylib} does not work -> Library NOT found by FPC compiler/linker {$LINKLIB /usr/lib/libgcc_s.1.dylib} does not work -> Library NOT found by FPC compiler/linker I also tried using: {$LIBRARYPATH /usr/lib/system} {$LINKLIB compiler_rt}

I've looked into it. In short:
* make sure you are using FPC 2.6.2 or later.
* do *not* add any linklib statement
* use the compiler command line parameter -WM10.6 (if you want to target minimally Mac OS X 10.6) ... -WM10.9 (if you want to target OS X 10.9)

In long:

In 10.6 and later those symbols are part of the system library (libSystem, which is the same as libc). That means that if you target 10.6 or later, you don't need to explicitly link against libgcc anymore. However, the linker will only get those symbols from libc/libSystem if you target 10.6 or later, because it knows that they are not available on OS versions.

Npw, FPC's default Mac OS X target for Intel is either 10.4 (for i386) or 10.5 (for x86-64). You did not have problems when compiling under 10.6, because
a) under that OS version, gcc was still installed as part of the developer tools
b) this copy of gcc came with a statically linkable version of libgcc (/usr/lib/gcc/powerpc-apple-darwin10/VERSION/libgcc.a) c) FPC's installer asks gcc for the path to this libgcc.a and adds a library search path for it to the default config file

As a result, adding {$linklib gcc} worked to resolve the symbols.

It doesn't work under 10.9, because there is no global gcc installation anymore, and hence no accompanying libgcc.a anywhere.

Now, since Mac OS X 10.4 you can also dynamically link to libgcc instead of statically (the libgcc_s file). Under 10.4 and 10.5, this file still contained the helpers. That's why you have the following files in /usr/lib:

lrwxr-xr-x 1 root wheel 17 Oct 22 22:20 /usr/lib/libgcc_s.1.dylib@ -> libSystem.B.dylib
-rwxr-xr-x 1 root wheel 30984 Oct 23 21:09 /usr/lib/libgcc_s.10.5.dylib* lrwxr-xr-x 1 root wheel 19 Oct 23 21:09
/usr/lib/libgcc_s.10.4.dylib@ -> libgcc_s.10.5.dylib

The latter two are compatibility files for programs that were previously compiled with Mac OS X 10.4 or 10.5 as target. On those systems (and in those SDKs), libgcc_s.dylib was a symbolic link to libgcc_s.10.4.dylib resp. libgcc_s.10.5.dylib). As a result, programs compiled against those SDKs and linking to libgcc_s.dylib, would record libgcc_s.10.4.dylib resp. libgcc_s.10.5.dylib as the real library name in the binary, and will still work even though there's no libgcc_s.dylib anymore.

This means that you can still explicitly link your programs against them by adding {$linklib gcc_s.10.5} to your program. Unless you still want to support 10.5 or 10.4, using -WM10.6 or higher is probably better though (this parameter tells the compiler/linker that you targeting Mac OS X 10.6 and later, and hence the required symbols will be taken from libSystem).

Jonas

Reply by email

Unknown author
to Jonas Maebe

Jonas:

Where in Lazarus 1.0.14 do I put in the compiler command line option? -WM10.9

Project Options->Compiler Options->Compilation->Compiler->Command-> $(CompPath) -WM10.9

And when I use this setting -WM10.9, this means that I can only execute the resulting binary on Mavericks and above?

But if I use -WM10.6, then this means that I am targeting for Snow Leopard 10.6 and above?

Thank you for breaking this down today.

Cheers,

md

Jonas Maebe wrote 31 lines
On 10 Mar 2014, at 19:07, wrote: > Unfortunately, your suggestion while appreciated does not work. > > For example, the actual function "__divdi3" actually lives in > /usr/lib/system/libcompiler_rt.dylib > > This library does not exist on Snow Leopard. But it does exist on > Mavericks. (I do not have Lion/Mtn Lion available) It's the equivalent of libgcc for LLVM. > {$LINKLIB gcc_s} does not work -> Library NOT found by FPC > compiler/linker > {$LINKLIB compiler_rt} does not work -> Library NOT found by FPC > compiler/linker > {$LINKLIB /usr/lib/system/libcompiler_rt.dylib} does not work -> > Library NOT found by FPC compiler/linker > {$LINKLIB /usr/lib/libgcc_s.1.dylib} does not work -> Library NOT > found by FPC compiler/linker > > I also tried using: > {$LIBRARYPATH /usr/lib/system} > {$LINKLIB compiler_rt} I've looked into it. In short: * make sure you are using FPC 2.6.2 or later. * do *not* add any linklib statement * use the compiler command line parameter -WM10.6 (if you want to target minimally Mac OS X 10.6) ... -WM10.9 (if you want to target OS X 10.9)

Reply by email

Mattias Gaertner
to Unknown author
Show quoted text 6 lines
Jonas: Where in Lazarus 1.0.14 do I put in the compiler command line option? -WM10.9 Project Options->Compiler Options->Compilation->Compiler->Command

No, that's the path to the compiler, no extra options.

-WM10.9

Extra options are called "custom options":
Project Options->Compiler Options->Compilation->Other->Custom options

And when I use this setting -WM10.9, this means that I can only execute the resulting binary on Mavericks and above?

Yes.

But if I use -WM10.6, then this means that I am targeting for Snow Leopard 10.6 and above?

Yes.

Mattias

Reply by email

Unknown author
to Mattias Gaertner

You FPC/lazarus guys ROCK.

md

Mattias Gaertner wrote 30 lines
On Mon, 10 Mar 2014 20:18:38 -0400 "" wrote: > Jonas: > > Where in Lazarus 1.0.14 do I put in the compiler command line option? > -WM10.9 > > Project Options->Compiler Options->Compilation->Compiler->Command No, that's the path to the compiler, no extra options. > -WM10.9 Extra options are called "custom options": Project Options->Compiler Options->Compilation->Other->Custom options > And when I use this setting -WM10.9, this means that I can only execute > the resulting binary on Mavericks and above? Yes. > But if I use -WM10.6, then this means that I am targeting for Snow > Leopard 10.6 and above? Yes. Mattias _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email