Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fatal error: math.h no such file or directory #3017

Merged
merged 1 commit into from
Feb 26, 2019

Conversation

winksaville
Copy link
Contributor

@winksaville winksaville commented Feb 21, 2019

This fixes #3016 by adding lines back introduced in PR #824. This code conditionally added llvm include directory only if it wasn't already included. These lines were a small part of PR #2976 which adds LLVM 7.0.1 compatibility.

@SeanTAllen
Copy link
Member

Thanks @winksaville. Can you amend your commit to be meaningful for what is fixed without having to look at the issue tracker? Referring back to the issue is fine, but "Fix issue #3016" won't be helpful in the future when bisecting to find problems, which for example I just did to find the fix to #3015. Meaningful commit comments helped me narrow down where to look quite a lot and I had to dig through 2 years of commits. Thanks.

@winksaville winksaville changed the title Fix issue #3016 Fix fatal error: math.h no such file or directory Feb 21, 2019
@winksaville
Copy link
Contributor Author

Your are correct, my commit message was poor, I've changed the title and commit message, let me know if you'd like something more/different.

@jemc
Copy link
Member

jemc commented Feb 21, 2019

Sorry I regressed #824, but my change that you're reverting was solving a real problem that I encountered when trying to work on this. See my commit message for details:
ad22b15

Is it possible to keep the fix from #824 while using cflags instead of includedir? As I mentioned in my commit message, includedir only lists one include dir, while cflags lists them all, which is important in some cases such as those I mentioned in the commit message.

@winksaville
Copy link
Contributor Author

Sorry I regressed #824, but my change that you're reverting was solving a real problem that I encountered when trying to work on this. See my commit message for details:
ad22b15

Is it possible to keep the fix from #824 while using cflags instead of includedir? As I mentioned in my commit message, includedir only lists one include dir, while cflags lists them all, which is important in some cases such as those I mentioned in the commit message.

Nothing is impossible, its just software, I'll see what I can do.

@winksaville
Copy link
Contributor Author

Changed the code back to using --cflags and it uses a loop to handle multiple directories.

@winksaville
Copy link
Contributor Author

Bummer, seems my use of "[[" "]]" doesn't work with ubuntu, looking into it.

@winksaville
Copy link
Contributor Author

The problem is ubuntu default SHELL is dash not bash, changed to using grep.

Makefile-ponyc Outdated

# Enable for testing
#.PHONY: done
#done:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this in? If so, can you expand the comment to describe what it is testing and when you'd want to use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be used when enabling line 444:

# Used for testing
#llvm.cflags := -I/usr/include -march=x86-64  -I  /sec/time -I /usr/local/include -I   /3/4 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/xyz/abc

I could remove both or add a documentation like:

# Enable the "done:" target for testing when the commented out line above is enabled:
# llvm.cflags := -I/usr/include -march=x86-64 ....

On the face of it, its easier to remove both. Its too bad we don't have any good way to test Makefiles. So what do you prefer, or maybe something else?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest removing both, but I'd also be okay with keeping them if you add the comment explaining it.

This fixes ponylang#3016 by conditionally adding llvm include directories
in a loop.
@winksaville
Copy link
Contributor Author

@jemc and I talked on slack and decided to remove the "test" code.

@jemc
Copy link
Member

jemc commented Feb 25, 2019

Thank you for the extra work!

Copy link
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge when CI passes.

@jemc jemc merged commit 5facf1e into ponylang:master Feb 26, 2019
@SeanTAllen
Copy link
Member

This breaks building on FreeBSD.

@SeanTAllen
Copy link
Member

Huh, well it broke one FreeBSD vm I am using but not another. Good times!

@winksaville
Copy link
Contributor Author

@SeanTAllen , where can I find the build breakage, I'm not familiar where/how the FreeBSD builds are built? Is there a slack conversation about this?

@winksaville
Copy link
Contributor Author

@SeanTAllen , where can I find the build breakage, I'm not familiar where/how the FreeBSD builds are built? Is there a slack conversation about this?

To answer my own question, the conversation on slack is here and the build breakage is here

@SeanTAllen
Copy link
Member

The breakage in the VMs I've tried that are available for vagrant is that:

echo "-I/usr/local/llvm60/include -O2 -pipe -DNDEBUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fPIC -Werror=date-time -Werror=unguarded-availability-new -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -O2 -pipe -DNDEBUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" | grep -oE -- '(^| )-I\s*\S+'

Doesn't work on FreeBSD for unknown reasons. It returns nothing.

@winksaville
Copy link
Contributor Author

The breakage in the VMs I've tried that are available for vagrant is that:

echo "-I/usr/local/llvm60/include -O2 -pipe -DNDEBUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -fPIC -Werror=date-time -Werror=unguarded-availability-new -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion -fcolor-diagnostics -ffunction-sections -fdata-sections -O2 -pipe -DNDEBUG -fstack-protector -isystem /usr/local/include -fno-strict-aliasing -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" | grep -oE -- '(^| )-I\s*\S+'

Doesn't work on FreeBSD for unknown reasons. It returns nothing.

Is the above from lines 439 440:

llvm.get_include_dirs := "echo '$(llvm.cflags)' | grep -oE -- '(^| )-I\s*\S+' | sed 's/^\s*-I\s*//'"
llvm.include_dirs := $(shell sh -c $(llvm.get_include_dirs))

I ask because your "echo" above seems to be mssing the | sed ... .

I'd like to add some $(warnings ...) to see first hand what is happening and see if we should make additional changes. Do you want me to look at llvm 6 or just llvm 7?

@SeanTAllen
Copy link
Member

SeanTAllen commented Feb 28, 2019

I broke it down to what would actually be failing. On the BSD vms I used, for no apparent reason that grep returned nothing. So it didn't matter that there was no sed.

You can give it a try in this BSD vm using Vagrant:

https://app.vagrantup.com/generic/boxes/freebsd12

It works in Cirrus-Ci for reasons unknown to me and it works with the same version of Grep (at least according to the version numbers) on MacOS.

So, ¯_(ツ)_/¯.

@winksaville winksaville deleted the fix-3016 branch March 1, 2019 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fatal error: math.h: No such file or directory
3 participants