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

Any support for clang ? #61

Open
pkondzior opened this issue Aug 10, 2022 · 4 comments
Open

Any support for clang ? #61

pkondzior opened this issue Aug 10, 2022 · 4 comments

Comments

@pkondzior
Copy link

Hello, very cool project. I've been trying to build this with clang but it seems that this doesn't compile:

/Users/pkondzior/Projects/piranha/src/language_rules.cpp:49:53: error: no matching constructor for initialization of 'const piranha::UnaryOperatorMapping &'
    std::string *rule = m_unaryOperatorRules.lookup({ op, type, false });
                                                    ^~~~~~~~~~~~~~~~~~~
/Users/pkondzior/Projects/piranha/include/language_rules.h:87:12: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided
    struct UnaryOperatorMapping {
           ^
/Users/pkondzior/Projects/piranha/include/language_rules.h:87:12: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 3 were provided
/Users/pkondzior/Projects/piranha/include/language_rules.h:87:12: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 3 were provided
/Users/pkondzior/Projects/piranha/include/key_value_lookup.h:33:42: note: passing argument to parameter 'key' here
@phire
Copy link
Contributor

phire commented Aug 11, 2022

Hopefully should all be fixed by #62, but I don't remember seeing that error.

@pkondzior
Copy link
Author

pkondzior commented Aug 12, 2022

@phire indeed #62 helped a lot in pushing compilation forward. I am building on macOS so I think there are more platform related issues yet to be addressed. So Far I see one with malloc.h not being found. I've work around it by adding:| in standard_allocator this change

#if defined(__MACH__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif

But I am not sure if this is the best approach. Then after retrying build I got this issue:

[ 62%] Building CXX object CMakeFiles/piranha.dir/scanner.auto.cpp.o
/Users/pkondzior/Projects/piranha/build/scanner.auto.cpp:1366:21: error: out-of-line definition of 'LexerInput' does not match any declaration in 'yyFlexLexer'
size_t yyFlexLexer::LexerInput( char* buf, size_t /* max_size */ )
                    ^~~~~~~~~~
/Users/pkondzior/Projects/piranha/build/scanner.auto.cpp:1395:19: error: out-of-line definition of 'LexerOutput' does not match any declaration in 'yyFlexLexer'
void yyFlexLexer::LexerOutput( const char* buf, size_t size )
                  ^~~~~~~~~~~
2 errors generated.
make[2]: *** [CMakeFiles/piranha.dir/scanner.auto.cpp.o] Error 1
make[1]: *** [CMakeFiles/piranha.dir/all] Error 2
make: *** [all] Error 2

But not sure yet what I should do.

@pkondzior
Copy link
Author

Could this be my local bison/flex being misconfigured ?

-- The C compiler identification is AppleClang 13.1.6.13160021
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.13") found components: Interpreter 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found BISON: /opt/homebrew/opt/bison/bin/bison (found version "3.8.2") 
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.79.0/BoostConfig.cmake (found suitable version "1.79.0", minimum required is "1.40") found components: filesystem 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/pkondzior/Projects/piranha/build

@phire
Copy link
Contributor

phire commented Aug 12, 2022

<malloc.h> is non-standard. Don't ifdef it, just replace it with <stdlib.h>

That's a general rule for trying to make cross-platform c++. Always use the standard stuff whenever possible.

Could this be my local bison/flex being misconfigured ?

I don't like how it's pulling flex from /usr/bin/ and bison from /opt/homebrew. Bison seems to be 5 years newer than flex.

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

No branches or pull requests

2 participants