Potential problem in Makefile for libdivecomputer

Pablo Wolter pwolter at gmail.com
Mon Mar 4 12:41:29 PST 2013


Sorry I did post this this late … now we are in 3.0.2 ;-)

Here is the dump of gcc - dump machine command on my Mac:

Pablos-MacBook-Pro:subsurface pwolter$ gcc -dumpmachine
x86_64-apple-darwin12

and this is what UNAME "should" get:

Pablos-MacBook-Pro:subsurface pwolter$ gcc -dumpmachine | grep -E -o "linux|darwin|win"
darwin

So the variable $(UNAME) has "darwin" and NOT Darwin … 

So I thought maybe $(UNAME) is getting translated to "uname" command? I know it's weird but … I renamed the UNAME var to MACH_NAME and run make again … failure finding libdivecomputer … again.

The only solution to overcome this was to change the Makefile line from "darwin" to "Darwin" and voila … I can compile it and install, etc.

This has puzzled me these days …I am reading the make manual to see how I can "print" on the screen some commands to see their values and the comparisons make is doing. I have run make with debug mode but it is not helping too much.

In the meantime I think the "best" solution will be to specifically add libdivecomputer location in the Makefile itself, even after a successful libdivecomputer install, pkg-config cannot find it (even with the PKG_CONFIG_PATH variable set):

Pablos-MacBook-Pro:subsurface pwolter$ pkg-config --cflags libdivecomputer
Package libdivecomputer was not found in the pkg-config search path.
Perhaps you should add the directory containing `libdivecomputer.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libdivecomputer' found

Pablos-MacBook-Pro:subsurface pwolter$ pkg-config --libs libdivecomputer
Package libdivecomputer was not found in the pkg-config search path.
Perhaps you should add the directory containing `libdivecomputer.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libdivecomputer' found

And this is in my case the reason subsurface compilation fails on my machine.

I'll give it another try but also wanted to ask if you know an easy way to test a libdivecomputer install is working? I have MacDive that provides a driver for my dive computer so I'm not sure that my libdivecoputer install is working or not and hence subsurface might be failing.

On Mar 1, 2013, at 4:13 PM, Dirk Hohndel <dirk at hohndel.org> wrote:

> Pablo Wolter <pwolter at gmail.com> writes:
> 
>> I think I found an issue with the manual installation of the libdivecomputer in Mac 10.8.
>> 
>> I got this during the make:
>> 
>> Pablos-MacBook-Pro:subsurface pwolter$ PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
>> Pablos-MacBook-Pro:subsurface pwolter$ echo $PKG_CONFIG_PATH
>> /usr/local/lib/pkgconfig/
>> Pablos-MacBook-Pro:subsurface pwolter$ make
>> updating version.h to 3.0.1-37-g36422d2f9ee1
>> Package libdivecomputer was not found in the pkg-config search path.
>> Perhaps you should add the directory containing `libdivecomputer.pc'
>> to the PKG_CONFIG_PATH environment variable
>> No package 'libdivecomputer' found
>>    CC main.c
>> Package libdivecomputer was not found in the pkg-config search path.
>> Perhaps you should add the directory containing `libdivecomputer.pc'
>> to the PKG_CONFIG_PATH environment variable
>> No package 'libdivecomputer' found
> [...]
>> 
>> I checked the Makefile and found this:
>> 
> [...]
>> else ifeq ($(UNAME), darwin)
> [...]
>> 
>> If you do a "uname" in Mac the name of the Os is Darwin … not darwin … so I changed it to capitol D and it did run make without any issue:
> 
> Yes - but look earlier in the Makefile. We don't run "uname" - we run
> gcc -dumpmachine
> 
> Now it is of course possible that gcc changes in 10.8 (need to reboot
> this system in order to find out - maybe later), but for 10.6 and 10.7
> and the respective versions of Xcode / gcc it certainly is 'darwin'.
> 
> Now one could argue that we should just ignore case :-)
> The fact that your fix works (I can tell - macos.c is being compiled)
> seems to indicate that this may be the way to go... just out of
> curiosity, could you send the output of gcc -dumpmachine ?
> 
>> Pablos-MacBook-Pro:subsurface pwolter$ make
>>    CC profile.c
>>    CC info.c
> [...]
>>    CC gps.c
>>    CC macos.c
>> 
>> Sorry I don't know how to fix the Makefile and submit it but the OS check has to be case insensitive or changed to capitol D in case in Mac the output of the uname command capitalize the first letter all the time.
> 
> git diff
> 
> shows you what you changed
> 
> once you are happy with this do
> 
> git commit -s -a
> 
> this creates a commit with a correct Signed-off-by: line
> 
> git format-patch HEAD^
> 
> creates a patch against the previous version (in a file named
> 0001-<commit subject>.patch
> 
> Send that to the mailing list :-)
> 
> /D


Saludos,

Pablo Wolter
pwolter at gmail.com




More information about the subsurface mailing list