www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - FreeBSD compile issue

reply "Tyler" <sprizzer gmail.com> writes:
Hi,
    I need to compile a D program in FreeBSD. I've followed the 
FreeBSD instructions. So far, dmd is creating the obj file, but 
there appears to be a problem with the linker. The error messages 
are very cryptic. I was hoping someone might have an idea what 
they mean and what I'm doing wrong here.

<CODE>
$ more hello.d
import std.stdio;

int main(string[] args)
{
     writefln("Hello World\n");
         return 0;
}
$ uname -a

14:37:25 UTC 2009     
root logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
$
$
$ dmd hello.d
/home/jordantk/dmd2/freebsd/bin32/../lib32/libphobos2.a(thread_105_713.o)(.text.thre
d_entryPoint+0xf3): 
In function `thread_entryPoint':
: undefined reference to `__pthread_cleanup_push_imp'
/home/jordantk/dmd2/freebsd/bin32/../lib32/libphobos2.a(thread_105_713.o)(.text.threa
_entryPoint+0x17b): 
In function `thread_entryPoint':
: undefined reference to `__pthread_cleanup_pop_imp'
--- errorlevel 1
$
</CODE>
Mar 27 2014
next sibling parent Martin Nowak <code dawg.eu> writes:
On 03/27/2014 03:29 PM, Tyler wrote:
 Hi,
     I need to compile a D program in FreeBSD. I've followed the FreeBSD
 instructions. So far, dmd is creating the obj file, but there appears to
 be a problem with the linker. The error messages are very cryptic. I was
 hoping someone might have an idea what they mean and what I'm doing
 wrong here.

 <CODE>
 $ more hello.d
 import std.stdio;

 int main(string[] args)
 {
      writefln("Hello World\n");
          return 0;
 }
 $ uname -a

 UTC 2009 root logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
 $
 $
 $ dmd hello.d
 /home/jordantk/dmd2/freebsd/bin32/../lib32/libphobos2.a(thread_105_713.o)(.text.thread_entryPoint+0xf3):
 In function `thread_entryPoint':
 : undefined reference to `__pthread_cleanup_push_imp'
 /home/jordantk/dmd2/freebsd/bin32/../lib32/libphobos2.a(thread_105_713.o)(.text.thread_entryPoint+0x17b):
 In function `thread_entryPoint':
 : undefined reference to `__pthread_cleanup_pop_imp'
 --- errorlevel 1
 $
 </CODE>
Can you check, whether dmd is explicitly linking with -pthread? It might an issue of libkse vs. libthr? https://github.com/freebsd/freebsd/blob/0680c1f5fe159bba69a242568af0db7d7dc15a79/lib/libthr/thread/thr_clean.c#L49 We're building the binary releases on FreeBSD 8.4, so upgrading might help too.
Mar 27 2014
prev sibling parent reply "Joakim" <joakim airpost.net> writes:
On Thursday, 27 March 2014 at 14:29:25 UTC, Tyler wrote:
 Hi,
    I need to compile a D program in FreeBSD. I've followed the 
 FreeBSD instructions. So far, dmd is creating the obj file, but 
 there appears to be a problem with the linker. The error 
 messages are very cryptic. I was hoping someone might have an 
 idea what they mean and what I'm doing wrong here.

 <CODE>
 $ more hello.d
 import std.stdio;

 int main(string[] args)
 {
     writefln("Hello World\n");
         return 0;
 }
 $ uname -a

 14:37:25 UTC 2009     
 root logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
That is a very old FreeBSD release. dmd from ports doesn't even compile for anything less than FreeBSD 8. I suggest you at least upgrade to 7-stable, better another release branch completely.
Mar 27 2014
parent reply "Tyler" <sprizzer gmail.com> writes:
Thanks for the info. The issue is a FreeBSD 6.2 system that 
unfortunately can't be upgraded. Do you think it will run if it's 
compiled on an x86 FreeBSD 8.4 system and moved to the 6.2 system?

-Tyler

On Thursday, 27 March 2014 at 18:16:18 UTC, Joakim wrote:
 On Thursday, 27 March 2014 at 14:29:25 UTC, Tyler wrote:
 Hi,
   I need to compile a D program in FreeBSD. I've followed the 
 FreeBSD instructions. So far, dmd is creating the obj file, 
 but there appears to be a problem with the linker. The error 
 messages are very cryptic. I was hoping someone might have an 
 idea what they mean and what I'm doing wrong here.

 <CODE>
 $ more hello.d
 import std.stdio;

 int main(string[] args)
 {
    writefln("Hello World\n");
        return 0;
 }
 $ uname -a

 14:37:25 UTC 2009     
 root logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
That is a very old FreeBSD release. dmd from ports doesn't even compile for anything less than FreeBSD 8. I suggest you at least upgrade to 7-stable, better another release branch completely.
Mar 31 2014
parent "Joakim" <joakim airpost.net> writes:
On Monday, 31 March 2014 at 12:02:43 UTC, Tyler wrote:
 Thanks for the info. The issue is a FreeBSD 6.2 system that 
 unfortunately can't be upgraded. Do you think it will run if 
 it's compiled on an x86 FreeBSD 8.4 system and moved to the 6.2 
 system?
No idea, all I know is that dmd in ports was disabled on FreeBSD/7 years ago: http://svnweb.freebsd.org/ports?view=revision&revision=267685 Maybe you can patch dmd or whatever else is necessary to get it working on older FreeBSD versions.
Apr 01 2014