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

adding support for clang compilation in compile.sh #19

Merged
merged 5 commits into from Oct 2, 2014
Merged

adding support for clang compilation in compile.sh #19

merged 5 commits into from Oct 2, 2014

Conversation

jmrenouard
Copy link
Contributor

compile.sh support also clang compilation.

Clang compilation works perfectly.

Howto compile with gcc
./compile.sh or ./compile.sh gcc

Howto compile with clang
./compile.sh clang

@jmrenouard
Copy link
Contributor Author

I have update Install.txt.

Clang is a very good compiler (fast and clean code generated).
MacOs is using CLANG as OS Compiler so whitedb can also be used for Whitedb.

compiler.sh parameter is optionnal. The script version allows to detect earlier missing gcc or clang executable before trying to use it.

@necrophcodr
Copy link
Contributor

I'd like to add that testing this results in the library being built using gcc regardless of parameters, and regardless of gcc being installed.
The problem is here: https://github.com/priitj/whitedb/blob/master/compile.sh#L11

That line is not changed in this commit, and due to the lack of ${COMPILER} variable there, gcc will always be used.

Additionally, the COMPILER variable should have a default value, so as to not result in NO compiler being used (the consequence which can be seen here https://github.com/jmrenouard/whitedb/commit/14d65ee92bf12fdeb0e14da8ff7e4307639730cc#diff-0f8ed536b6067bbcef0adc6e88ab88d5R21 is probably not very useful)

necrophcodr and others added 2 commits October 2, 2014 11:50
Fix compilation not working correctly with other compilers than gcc.
@jmrenouard
Copy link
Contributor Author

Hello,

The last pull request with additional PR from necrophcodr.

It fixes unset COMPILER var issue.

Br.
Jean-Marie RENOUARD

@priitj
Copy link
Owner

priitj commented Oct 2, 2014

IMHO 'compile.sh' will never be portable. It was not meant to, rather the user was meant to edit it to their needs. Still, I'll merge this if you guys feel it makes things more convinient for clang users :-)

Thanks.

priitj added a commit that referenced this pull request Oct 2, 2014
adding support for clang compilation in compile.sh
@priitj priitj merged commit 794fda3 into priitj:master Oct 2, 2014
@priitj
Copy link
Owner

priitj commented Oct 21, 2014

I've noticed that this shell script syntax is rather fragile. It seems to break on a system I'd expect to be quite common, 12.04 Ubuntu LTS.

Rather than attempt to fix this, I'd propose this:

How would you feel about running

CC=clang ./compile.sh

instead? I should have proposed this from the start but was preoccupied with other things and didn't divert much attention here. You can then also export CC=clang and I can add support for this to other shell scripts as well (such as Python/compile.sh, the examples etc).

priitj added a commit that referenced this pull request Oct 23, 2014
Ensure that all compile*.sh scripts use the CC env var (enhances pull request #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.

None yet

3 participants