Mailing List picongpu-users@hzdr.de Message #54
From: Dr. Ajit Upadhyay <ajitup@rrcat.gov.in>
Subject: Re: [PIConGPU-Users] [PIConGPU-Users] [PIConGPU-Users] [PIConGPU-Users] PIConGPU compilation -lpthread error
Date: Thu, 28 Apr 2016 16:26:06 +0530
To: <picongpu-users@hzdr.de>
Dear Rene,

I edited the ~/src/picongpu/CMakeLists.txt

cmake_minimum_required(VERSION 2.8.5)
##########################################
# Project
##########################################
project(PIConGPU2_full_build)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
    find_package(Threads REQUIRED)
    set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
    set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "install
prefix" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

add_subdirectory("${CMAKE_SOURCE_DIR}/src/picongpu"
"${CMAKE_BINARY_DIR}/build_picongpu")


Now, It does not create CMakeError.log file, but still gives those source
"build source directory" errors and says that

-- Configuring incomplete, errors occurred!
See also "/home/ajitup/build/CMakeFiles/CMakeOutput.log".

I am attaching the output log file.

regards,
ajit



> ---------------------------- Original Message ----------------------------
> Subject: Re:  [PIConGPU-Users] [PIConGPU-Users] [PIConGPU-Users]
> [PIConGPU-Users] PIConGPU compilation -lpthread error
> From:    René Widera <r.widera@hzdr.de>
> Date:    Thu, April 28, 2016 2:46 pm
> To:      picongpu-users@hzdr.de
> --------------------------------------------------------------------------
>
> Dear Ajit,
>
> it looks like that both issues are independent.
>
> pthread issue:
> - the linker needs to know that you need libpthread.so
> - please add `-lpthread` to your linker command or add in CMakeLists.txt
> ```CMAKE
> find_package(Threads REQUIRED)
> set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
> #...
> target_link_libraries(
>      PROJECTNAME
>      ${LIBS})
> ```
>
> picongpu issue:
>
> Your log shows this:
> ```
> CMake Error at CMakeLists.txt:38 (add_subdirectory):
>    The binary directory
>      /home/ajitup/build/build_picongpu
>    is already used to build a source directory.  It cannot be used to
> build
> source directory
>      /home/ajitup/code.PIConGPU/picongpu-master/src/picongpu
> ```
> - it looks like cmake asume that the source code of PICoNGPU is in
> `~/code.PIConGPU` and not in `$PICSRC` which points to `~/src/picongpu`
> - please run the following commands and send use the output
>    - `cmake --version`
>    - `cd ~/src/picongpu`
>    - `git status`
>    - `git checkout HEAD .`
>    - `cd ~/build`
>    - `rm -r ../build/*`
>    - `echo $PICSRC`
>    - `ls ~/paramSets/case001`
>    - `$PICSRC/configure ~/paramSets/case001`
>    - `make`
>
> best,
>
> René
>
> On 28.04.2016 06:10, Dr. Ajit Upadhyay wrote:
>> Dear Axel,
>>
>> I have been following your suggestion.
>> Every time, I use a script to build which has
>>
>> rm -fR ~/build
>> mkdir ~/build
>> cd ~/build
>> $PICSRC/configure ~/paramSets/case001
>>
>> So there is no question of any outdated build residing inside the build
>> directory.
>> As before every build attempt, the build directory is re-created.
>> It could be some other issue, which I am not able to find out.
>>
>> Also, could pthread_create error be due to cuda-7.5 and gcc-4.8 and
>> glibc?
>> Today, I will try with cuda-7.0 and same version of gcc and glibc and
>> let you know.
>>
>> Regards,
>> Ajit
>>
>>
>>
>> -----Original Message-----
>> From: picongpu-users@hzdr.de [mailto:picongpu-users@hzdr.de] On Behalf
>> Of Huebl, Axel
>> Sent: Wednesday, April 27, 2016 8:43 PM
>> To: picongpu-users@hzdr.de
>> Subject: Re: [PIConGPU-Users] [PIConGPU-Users] PIConGPU compilation
>> -lpthread error
>>
>> Dear Ajit,
>>
>> looks like an older, outdated build using CMake resides inside build/
>> Just remove it like this:
>>
>> cd $HOME/build
>> rm -rf ../build/*
>>
>> $PICSRC/configure ~/paramSets/case001
>> make -j install
>>
>>
>> Best,
>> Axel
>>
>> On 27.04.2016 12:35, Dr. Ajit Upadhyay wrote:
>>> Dear René,
>>>
>>> Thanks for such a prompt reply. The log files, I sent were from the
>>> release-0.1.2 branch. However, I did try "master"  as well, but the
>>> error
>>> remains same.
>>>
>>> $PICSRC/configure ~/paramSets/case001
>>>
>>> in release-0.1.2 branch as well as master branch gives following
>>> error:-
>>>
>>>
>>> CMake Error at CMakeLists.txt:38 (add_subdirectory):
>>>    The binary directory
>>>      /home/ajitup/build/build_picongpu
>>>    is already used to build a source directory.  It cannot be used to
>>> build
>>> source directory
>>>      /home/ajitup/code.PIConGPU/picongpu-master/src/picongpu
>>> Specify a unique binary directory name.
>>>
>>> CMake Error at CMakeLists.txt:38 (add_subdirectory):
>>>    The binary directory
>>>      /home/ajitup/build/build_picongpu
>>>    is already used to build a source directory.  It cannot be used to
>>> build
>>> source directory
>>>      /home/ajitup/code.PIConGPU/picongpu-master/src/picongpu
>>>    Specify a unique binary directory name.
>>>
>>>
>>> Whereas, there is no quota set by HPC system and I am able to
>>> write/create
>>> a file/folder in ~/build directory. my PICSRC is ~/src/picongpu and I
>>> build the code in ~/build directory. Further error is in CMakeError.log
>>> :
>>>
>>>
>>> Determining if the pthread_create exist failed with the following
>>> output:
>>> Change Dir: /home/ajitup/build/CMakeFiles/CMakeTmp
>>>
>>> Run Build Command:"/usr/bin/gmake" "cmTC_d035f/fast"
>>> /usr/bin/gmake -f CMakeFiles/cmTC_d035f.dir/build.make
>>> CMakeFiles/cmTC_d035f.dir/build
>>> gmake[1]: Entering directory '/home/ajitup/build/CMakeFiles/CMakeTmp'
>>> Building C object CMakeFiles/cmTC_d035f.dir/CheckSymbolExists.c.o
>>> /usr/bin/cc    -fPIC    -o
>>> CMakeFiles/cmTC_d035f.dir/CheckSymbolExists.c.o
>>>    -c /home/ajitup/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
>>> Linking C executable cmTC_d035f
>>> /usr/local/bin/cmake -E cmake_link_script
>>> CMakeFiles/cmTC_d035f.dir/link.txt --verbose=1
>>> /usr/bin/cc  -fPIC     CMakeFiles/cmTC_d035f.dir/CheckSymbolExists.c.o
>>> -o
>>> cmTC_d035f -rdynamic
>>> CMakeFiles/cmTC_d035f.dir/CheckSymbolExists.c.o: In function `main':
>>> CheckSymbolExists.c:(.text+0x1b): undefined reference to
>>> `pthread_create'
>>> collect2: error: ld returned 1 exit status
>>> CMakeFiles/cmTC_d035f.dir/build.make:97: recipe for target 'cmTC_d035f'
>>> failed
>>> gmake[1]: *** [cmTC_d035f] Error 1
>>> gmake[1]: Leaving directory '/home/ajitup/build/CMakeFiles/CMakeTmp'
>>> Makefile:126: recipe for target 'cmTC_d035f/fast' failed
>>> gmake: *** [cmTC_d035f/fast] Error 2
>>>
>>> File /home/ajitup/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
>>> /* */
>>> #include <pthread.h>
>>>
>>> int main(int argc, char** argv)
>>> {
>>>    (void)argv;
>>> #ifndef pthread_create
>>>    return ((int*)(&pthread_create))[argc];
>>> #else
>>>    (void)argc;
>>>    return 0;
>>> #endif
>>> }
>>>
>>>
>>> I have attached some test files which I compiled to check for
>>> pthread_create function using    $cc -lpthread ***.c -o ***.out
>>> and they compiled. A search for libpthread shows it in /lib as well as
>>> /lib64 in system-root. I have gcc 4.8.5, and cuda 7.5. I did try dev
>>> branch, but as you suggested it will require enabling c++11 support.
>>> The
>>> error in dev branch is:
>>>
>>> Please enable C++11 with `-std=c++11` or `-DCMAKE_CXX_STANDARD=11`
>>> when
>>> compiling with nvcc 7.5
>>>
>>> I will try adding c++11 support and let you know, but the
>>> CMakeError.log
>>> shows lpthread issue even in dev branch.
>>>
>>> regards,
>>> ajit
>>>
>>> Attachements:  Cmake log files for release-branch
>>>                 test codes for lpthread
>>>                 CMakeLists.txt from release-0.1.2
>>>
>>>
>>>> ---------------------------- Original Message
>>>> ----------------------------
>>>> Subject: Re: Help on PIConGPU?
>>>> From:    René Widera <r.widera@hzdr.de>
>>>> Date:    Wed, April 27, 2016 2:14 pm
>>>> To:      "Dr. Ajit Upadhyay" <ajitup@rrcat.gov.in>
>>>> ------------------------------------------------------------------
>>>> Dear Dr. Ajit Upadhyay,
>>>>
>>>> thank you for participate our project PIConGPU.
>>>>
>>>> Please subscribe at our mailing list [1] for future issues with
>>>> picongpu. The mailing list helps the community if other run in equal
>>>> issues.
>>>>
>>>> Currently I have only looked very fast to your problem, I will take a
>>>> deeper analysis tomorrow.
>>>> Which version of PIConGPU you used? master or dev
>>>> For cuda 7.5 please switch to `dev` because as I remember we need to
>>>> enable C++11 for cuda 7.5 else PIConGPU will not compile and the
>>>> master
>>>> is not C++11 compatible.
>>>> Please keep in mind that the branch `dev` is our working branch and
>>>> interfaces can be changed.
>>>> There will be a new release in one or two weeks available.
>>>>
>>>> I looked first at your file `build_output_shell` and found the error
>>>> ```
>>>> CMake Error at CMakeLists.txt:38 (add_subdirectory):
>>>>     The binary directory
>>>>       /home/ajitup/build/build_picongpu
>>>> ```
>>>> This looks like you are not allowed to create directories in
>>>> `~/build`.
>>>> Maybe your HPC System set a quota for your home directory which
>>>> results
>>>> in the case that no new files can be created. Could you please check
>>>> this behavior.
>>>>
>>>> pthread issue:
>>>>
>>>> Could you please provide me with the cmake script and all needed
>>>> files.
>>>> It looks like the linker flag `lpthread` is missing in your example.
>>>>
>>>> If some of the issues are solved till tomorrow please give me a
>>>> feedback.
>>>>
>>>> btw: please skip the `Dr.` before my name but I would be glad to get a
>>>> honorary degree ;-)
>>>>
>>>> best regards,
>>>> René
>>>>
>>>> [1]
>>>> https://github.com/ComputationalRadiationPhysics/picongpu/tree/dev#users
>>>>
>>>> On 27.04.2016 09:43, Dr. Ajit Upadhyay wrote:
>>>>> Dear Dr. René Widera,
>>>>>
>>>>> I downloaded the release-0.1.2 branch of code and tried to compile it
>>> on a HP Z840 (Intel Xeon E5-2630v3 2.4 1866 8C x 2, 128GB memory)
>>> workstation with two Nividia Quadro 4200 GPUs (compatible with CUDA).
>>> The OS on my workstation is openSuSe Leap 42.1 with cuda-7.5. I have
>>> tested some examples from the nvidia-cuda library and they are working
>>> fine.
>>>>>
>>>>> I have compiled all the libraries required by PIConGPU successfully
>>>>> and
>>> placed them as per the instructions in /picongpu/src/install.md file.
>>> However, when I try to compile the code itself, it gives a strange
>>> error> of pthread_create function (please look at the attached
>>> CMakeError.log).
>>>>>
>>>>> I did check that the relevant library is in its place
>>>>> (/lib/libpthread-2.19.so, glibc-2.19-19.1_x86_64). I did google for
>>>>> the
>>> error but could not resolve this issue as the problem seems to be with
>>> "configure" script of the picongpu code.
>>>>>
>>>>> I made a test program from CMakeError.log file and compiled it
>>> separately and it compiles (please have a look at pthread_check_log, a
>>> few lines of code are listed and it compiles all these which uses this
>>> function). I have attached  the output dumped on the linux-terminal in
>>> file build_output_shell. Other files created by cmake are also
>>> attached.
>>>>>
>>>>> Could you please point out where is the fault in my setup of this
>>>>> code
>>>>> or what should I do to run this code.
>>>>>
>>>>> Regards,
>>>>>
>>>>>
>>>>> #############################################################
>>>>> This message is sent to you because you are subscribed to
>>>>>    the mailing list <picongpu-users@hzdr.de>.
>>>>> To unsubscribe, E-mail to: <picongpu-users-off@hzdr.de>
>>>>> To switch to the DIGEST mode, E-mail to
>>>>> <picongpu-users-digest@hzdr.de>
>>>>> To switch to the INDEX mode, E-mail to <picongpu-users-index@hzdr.de>
>>>>> Send administrative queries to  <picongpu-users-request@hzdr.de>
>>>>>
>>
>
> --
> René Widera
> Abteilung Laser-Teilchenbeschleunigung (FWKT)
> Helmholtz-Zentrum Dresden-Rossendorf
> Tel: +49 (0351) 260 3543
> r.widera@hzdr.de
> http://www.hzdr.de
>
> Vorstand: Prof. Dr. Dr. h. c. Roland Sauerbrey,
>            Prof. Dr. Dr. h. c. Peter Joehnk
> Vereinsregister: VR 1693 beim Amtsgericht Dresden
>
> #############################################################
> This message is sent to you because you are subscribed to
>   the mailing list <picongpu-users@hzdr.de>.
> To unsubscribe, E-mail to: <picongpu-users-off@hzdr.de>
> To switch to the DIGEST mode, E-mail to <picongpu-users-digest@hzdr.de>
> To switch to the INDEX mode, E-mail to <picongpu-users-index@hzdr.de>
> Send administrative queries to  <picongpu-users-request@hzdr.de>
>
>
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster