-
Notifications
You must be signed in to change notification settings - Fork 97
Don't use hardcoded include/link paths #701
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
Don't use hardcoded include/link paths #701
Conversation
silverjam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just added this change to enable building on Mac since neither Nixpkgs nor vanilla Mac would build without this (previously it would build w/o this change). We need to find a solution for all platforms. Sorry for the breaking change... I thought other platforms would just ignore the extra include path?
|
Ah ok, in that case we can just wrap it up in an if(APPLE). Unfortunately the buildroot crosscompiler throws an error when passing -L/usr/local/lib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this also broke for me when trying to build, maybe the suggestion captures @woodfell's idea?
[100%] Linking C shared library libsbp.so
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '-L/usr/local/lib'
| target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/) | ||
| else() | ||
| target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/ /usr/local/include/) | ||
| target_include_directories(test_libsbp PRIVATE ${PROJECT_SOURCE_DIR}/include/libsbp/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm need to comment on a separate line..
| C_STANDARD 99 | ||
| C_STANDARD_REQUIRED ON) | ||
|
|
||
| if(MSVC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would likely solve the issue on PBR(P) side
| if(MSVC) | |
| if(MSVC OR CROSS_COMPILING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether any other compiler would also break, so I've made a change to only add /usr/local/* on apple platforms
silverjam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
successfully ran make c on my mac with this branch 🎉
/usr/local/(include|lib) are hardcoded in to the cmake system. This throws an error when trying to cross compile using buildroot. These paths should not be needed anyway.