Thread overview
Building from source on FreeBSD
Feb 19, 2018
psychoticRabbit
Feb 19, 2018
Jonathan M Davis
Feb 19, 2018
psychoticRabbit
Feb 19, 2018
Seb
Feb 19, 2018
Jonathan M Davis
Feb 20, 2018
psychoticRabbit
Feb 21, 2018
Diederik de Groot
Feb 21, 2018
psychoticRabbit
February 19, 2018
So I finally got around to building from source.

I have builds working just fine on a variety of linux machines, it's just a FreeBSD problem I'm having.

So, on FreeBSD, I can build the dmd directory, and the phobos directory ok.

When building tools directory, most tools get built ok, but the build process stops during something to do with curl..

------------------------------------
> gmake -f posix.mak -j8  (yeah on FreeBSD use gmake not make)
.
..
... (bunch of stuff builds ok.. then this next line)
/usr/bin/ld: cannot find -lcurl
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Error: linker exited with status 1
gmake: *** [posix.mak:77: generated/freebsd/64/dget] Error 1
gmake: *** Waiting for unfinished jobs....
----------------------------

Yes, I do have the FreeBSD curl package installed - curl-7.56.0

Yes, curl is in the path> which curl -> /usr/local/bin/curl

So I can only assume my FreeBSD machine is missing some curl related library/package??

Any help would be appreciated.

February 19, 2018
On Monday, February 19, 2018 11:43:26 psychoticRabbit via Digitalmars-d- learn wrote:
> So I finally got around to building from source.
>
> I have builds working just fine on a variety of linux machines, it's just a FreeBSD problem I'm having.
>
> So, on FreeBSD, I can build the dmd directory, and the phobos directory ok.
>
> When building tools directory, most tools get built ok, but the build process stops during something to do with curl..
>
> ------------------------------------
>
> > gmake -f posix.mak -j8  (yeah on FreeBSD use gmake not make)
>
> .
> ..
> ... (bunch of stuff builds ok.. then this next line)
> /usr/bin/ld: cannot find -lcurl
> cc: error: linker command failed with exit code 1 (use -v to see
> invocation)
> Error: linker exited with status 1
> gmake: *** [posix.mak:77: generated/freebsd/64/dget] Error 1
> gmake: *** Waiting for unfinished jobs....
> ----------------------------
>
> Yes, I do have the FreeBSD curl package installed - curl-7.56.0
>
> Yes, curl is in the path> which curl -> /usr/local/bin/curl
>
> So I can only assume my FreeBSD machine is missing some curl related library/package??
>
> Any help would be appreciated.

I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to the curl library that's there but somehow not succeeding. It's all quite weird. It's been a while since I dug into it though.

- Jonathan M Davis

February 19, 2018
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote:
> I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to the curl library that's there but somehow not succeeding. It's all quite weird. It's been a while since I dug into it though.
>
> - Jonathan M Davis

Thanks for the quick response.

So I took your advice and just commented out (as per below), and now it all builds fine - AFAICT ;-)


-FROM
61:all: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite
76:$(TOOLS) $(DOC_TOOLS) $(CURL_TOOLS) $(TEST_TOOLS): $(ROOT)/%: %.d

-TO
61:all: $(TOOLS) $(ROOT)/dustmite
76:$(TOOLS) $(DOC_TOOLS) $(TEST_TOOLS): $(ROOT)/%: %.d

February 19, 2018
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote:
> On Monday, February 19, 2018 11:43:26 psychoticRabbit via Digitalmars-d- learn wrote:
>> [...]
>
> I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to the curl library that's there but somehow not succeeding. It's all quite weird. It's been a while since I dug into it though.
>
> - Jonathan M Davis

FYI: https://github.com/dlang/tools/pull/316
February 19, 2018
On Monday, February 19, 2018 14:41:21 Seb via Digitalmars-d-learn wrote:
> On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis
>
> wrote:
> > On Monday, February 19, 2018 11:43:26 psychoticRabbit via
> >
> > Digitalmars-d- learn wrote:
> >> [...]
> >
> > I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to the curl library that's there but somehow not succeeding. It's all quite weird. It's been a while since I dug into it though.
> >
> > - Jonathan M Davis
>
> FYI: https://github.com/dlang/tools/pull/316

It looks like that might actually fix the tools build for FreeBSD on my machine if the bit that he currently has versioned for DragonFly is used for FreeBSD as well (and it probably needs to be there for every BSD). I've never understood why the tools repo builds fine for releases but has never built properly for me locally.

- Jonathan M Davis

February 20, 2018
On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote:
> I've never been able to figure this problem out, so I've I always just edited the makefile so that the two programs in CURL_TOOLS aren't built. IIRC, if you use -v to see the full linker command, it's even actually linking to the curl library that's there but somehow not succeeding. It's all quite weird. It's been a while since I dug into it though.
>
> - Jonathan M Davis

ok... so I decided to dig into it a little further.

seems the problem relates to a single line, in dget.d

pragma(lib, "curl");

I just commented out the one line in dget.d, and it all seems to build ok (including dget). So no need to comment out tools in posix.mak anymore.

February 21, 2018
On Tuesday, 20 February 2018 at 03:59:06 UTC, psychoticRabbit wrote:
> On Monday, 19 February 2018 at 12:01:31 UTC, Jonathan M Davis wrote:
>> ....
>
> ok... so I decided to dig into it a little further.
>
> seems the problem relates to a single line, in dget.d
>
> pragma(lib, "curl");
>
> I just commented out the one line in dget.d, and it all seems to build ok (including dget). So no need to comment out tools in posix.mak anymore.

Removing the pragma(lib, "curl") seems to fix the issue on DFly (and FreeBSD). Updated the pull request.
I guess pragma(lib, xxx) needs a little bit of attention to see what causes it not to work.
February 21, 2018
On Wednesday, 21 February 2018 at 11:41:18 UTC, Diederik de Groot wrote:
> Removing the pragma(lib, "curl") seems to fix the issue on DFly (and FreeBSD). Updated the pull request.
> I guess pragma(lib, xxx) needs a little bit of attention to see what causes it not to work.

something to do with this perhaps?

https://stackoverflow.com/questions/23214697/trouble-with-curl-and-pragma

in any case, that line doesn't even need to be there AFAICT.

dget builds and works just fine with it commented out.

I've commented it out on my linux builds too.