-
Notifications
You must be signed in to change notification settings - Fork 94
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
[checkfornan] io.h for windows instead of unistd.h #117
base: master
Are you sure you want to change the base?
Conversation
I am not sure if you need It seems <io.h> is required for MS to find mkstemp; see Should we include this in the test for mkstemp in the cppad_has_mkstemp check in the file
|
I have updated the remaining instances of unistd.h by io.h in 5808656. I'm running make check in the CI to see if there are other errors that I may have missed. |
It seems io.h is the replacement for unistd in windows systems https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c. So normally this should not be compiler dependent. I don't think we need to add !defined(clang) here |
I am not sure if you need It seems <io.h> is required for MS to find mkstemp; see Should we include this in the test for mkstemp in the cppad_has_mkstemp check in the file
|
I closed this bug by mistake and have re-opened it ? I did some testing on windows and could not get it to find mkstemp. Then I realized that the link above for io.h was referring to mktemp which is not the same as mkstemp. It seems windows does not have a verision of he posix routine mkstemp ? |
Does an mkstemp function exist when using your Windows version of the clang compiler ? |
@bradbell I've added the ci with make check for windows and ubuntu with github actions. I think somehow github actions might be disabled on the main repo, I can see the CI run on my fork at https://github.com/proyan/CppAD/actions. |
I see the following errors in the CI https://github.com/Simple-Robotics/pycppad/pull/18/checks?check_run_id=3459595658 : lld-link : error : undefined symbol: omp_set_dynamic [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\a11c_openmp.obj:(bool __cdecl a11c(void))
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(bool __cdecl simple_ad(void))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(bool __cdecl team_create(unsigned __int64))
lld-link : error : undefined symbol: omp_set_num_threads [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\a11c_openmp.obj:(bool __cdecl a11c(void))
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(bool __cdecl simple_ad(void))
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(bool __cdecl simple_ad(void))
>>> referenced 2 more times
lld-link : error : undefined symbol: __kmpc_fork_call [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\a11c_openmp.obj:(bool __cdecl a11c(void))
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(bool __cdecl simple_ad(void))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(bool __cdecl team_work(void (__cdecl *)(void)))
lld-link : error : undefined symbol: __kmpc_for_static_init_4 [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\a11c_openmp.obj:(.omp_outlined.)
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(.omp_outlined.)
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(.omp_outlined.)
lld-link : error : undefined symbol: __kmpc_for_static_fini [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\a11c_openmp.obj:(.omp_outlined.)
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(.omp_outlined.)
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(.omp_outlined.)
lld-link : error : undefined symbol: omp_get_thread_num [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(unsigned __int64 __cdecl `anonymous namespace'::thread_number(void))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(bool __cdecl team_create(unsigned __int64))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(unsigned __int64 __cdecl `anonymous namespace'::thread_num(void))
>>> referenced 2 more times
lld-link : error : undefined symbol: omp_in_parallel [D:\a\pycppad\pycppad\CppAD\build\example\multi_thread\openmp\example_multi_thread_openmp.vcxproj]
>>> referenced by example_multi_thread_openmp.dir\Release\simple_ad_openmp.obj:(bool __cdecl `anonymous namespace'::in_parallel(void))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(bool __cdecl team_create(unsigned __int64))
>>> referenced by example_multi_thread_openmp.dir\Release\team_openmp.obj:(bool __cdecl `anonymous namespace'::in_parallel(void))
>>> referenced 2 more times
Building Custom Rule D:/a/pycppad/pycppad/CppAD/introduction/CMakeLists.txt
introduction.vcxproj -> D:\a\pycppad\pycppad\CppAD\build\introduction\Release\introduction.exe
Begin test group introduction
however, it still says that all tests are passing |
You just need to link against openmp. Depending on the OS/compiler, this might not be needed. |
What do you get when you do the following: |
On my Ubuntu system, I get
I will try on the windows CI. I think the suggestion of justin to link the examples with openmp should be sufficient |
@proyan Try the following:
|
Regarding openmp linking, it seems that with visual studio and clang combination, this is a known issue https://stackoverflow.com/questions/62122247/openmp-linking-errors-in-visual-studio-2019-llvm |
In windows-clang, I get the undefined symbol error from above. On ubuntu it passes |
@proyan It seems to me that there are three different things going on in this pull request:
Perhaps it would be better if we spit it up ? |
I'm okay with reducing the scope of this PR.
Regarding mkstemp, I didn't see the error related to mkstemp in the CI run https://github.com/proyan/CppAD/actions |
I did not realize that |
What is the purpose of the file .github/workflows/ci-windows-clang.yml . |
I fixed |
Looking at It seems the |
The github workflows files are only adding a CI (as seen here: https://github.com/proyan/CppAD/actions) that performs |
You're right, it wasn't correct to add the library linkage like I did. However, I think the CXX_FLAGS are already adding the linking specifications for openmp, so the issue isn't whether openmp can be found, but how to link for the windows+clang case. Could you please have a look at ddc1802? |
It seems to me that the variable
with = CXX should have all the necessary flags for the system ? |
I don't think OpenMP CXX Flags are being correctly fixed based on the compiler/environment types. 2021-08-31T15:15:22.6299194Z lld-link : warning : ignoring unknown argument '-Xclang' [D:\a\CppAD\CppAD\build\test_more\cppad_for_tmb\test_more_cppad_for_tmb.vcxproj]
2021-08-31T15:15:22.6312512Z lld-link : warning : ignoring unknown argument '-fopenmp' [D:\a\CppAD\CppAD\build\test_more\cppad_for_tmb\test_more_cppad_for_tmb.vcxproj]
2021-08-31T15:15:22.6516716Z lld-link : error : undefined symbol: omp_set_dynamic [D:\a\CppAD\CppAD\build\test_more\cppad_for_tmb\test_more_cppad_for_tmb.vcxproj]
2021-08-31T15:15:22.6519205Z >>> referenced by test_more_cppad_for_tmb.dir\Release\multi_atomic_two.obj:(bool __cdecl multi_atomic_two(void))
2021-08-31T15:15:22.6528655Z >>> referenced by test_more_cppad_for_tmb.dir\Release\multi_atomic_three.obj:(bool __cdecl multi_atomic_three(void))
2021-08-31T15:15:22.6530062Z >>> referenced by test_more_cppad_for_tmb.dir\Release\multi_chkpoint_one.obj:(bool __cdecl multi_chkpoint_one(void))
2021-08-31T15:15:22.6533783Z >>> referenced 1 more times I'm out of ideas for how to proceed here. |
I have started a branch for testing ideas related to github actions; see |
Using github actions on macos-latest,(on the actions branch) I get the following message
This indicates that macos is not finding mkstemp. |
I have done a lot of testing and cannot figure out why cmake on the macos-latest platform is not finding mkstemp. Here is a a very similar test script that works in another repository:
On the other hand, for the cppad version of the test (which I expect to be the same), has the following cmake output
TheCppAD actions branch has a version of the test that comments out the
|
@proyan |
Hi Brad, |
config.guess is not a real source file. It is automatically created by the autotools install (which I want to get rid of but coin-or is using). see Would you please merge the current master into your pull and test it so that I can fast forward the merge. When I try to do so, I get an error:
fatal: Not possible to fast-forward, aborting |
@proyan Travis was sold and it appears they are no longer building the CppAD travis file I plan to use github workflows to do a lot more CppAD testing and would like your help in this regard. One big problem I have right now is testing on a ppc64le system; see the build.log for
Do you know how I could get github actions to reproduce this problem ? |
@proyan A friend suggested trying |
Remaining fix from #112