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

can not compile example standalone #582

Closed
dannielliu opened this issue Oct 17, 2019 · 5 comments · Fixed by #585
Closed

can not compile example standalone #582

dannielliu opened this issue Oct 17, 2019 · 5 comments · Fixed by #585
Labels

Comments

@dannielliu
Copy link

Dear Markus,

When I try to compile the example OpticalSurface standalone, some problem happen. Here is the information.

Thank you!
Dong LIU

  • OS version: SLC6
  • Compiler version: GCC 6.2
  • DD4hep version: github master branch
  • Reproduced by: copy the example "OpticalSurface" to a test directory, then "mkdir build & cd build", try to configure it "cmake ..", then problem happens
  • Output:

-- Including DD4hepBuild.cmake
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /software/STCF/gcc620-install/bin/gcc
-- Check for working C compiler: /software/STCF/gcc620-install/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /software/STCF/gcc620-install/bin/g++
-- Check for working CXX compiler: /software/STCF/gcc620-install/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX_FLAG_WORKS__Wall
-- Performing Test CXX_FLAG_WORKS__Wall - Success
-- Performing Test CXX_FLAG_WORKS__Wextra
-- Performing Test CXX_FLAG_WORKS__Wextra - Success
-- Performing Test CXX_FLAG_WORKS__pedantic
-- Performing Test CXX_FLAG_WORKS__pedantic - Success
-- Performing Test CXX_FLAG_WORKS__Wshadow
-- Performing Test CXX_FLAG_WORKS__Wshadow - Success
-- Performing Test CXX_FLAG_WORKS__Wformat_security
-- Performing Test CXX_FLAG_WORKS__Wformat_security - Success
-- Performing Test CXX_FLAG_WORKS__Wno_long_long
-- Performing Test CXX_FLAG_WORKS__Wno_long_long - Success
-- Performing Test CXX_FLAG_WORKS__Wdeprecated
-- Performing Test CXX_FLAG_WORKS__Wdeprecated - Success
-- Performing Test CXX_FLAG_WORKS__fdiagnostics_color=auto
-- Performing Test CXX_FLAG_WORKS__fdiagnostics_color=auto - Success
-- Performing Test CXX_FLAG_WORKS_FTLS_global_dynamic
-- Performing Test CXX_FLAG_WORKS_FTLS_global_dynamic - Success
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- |++> OpticalSurfaces: ROOT version:
-- |++> Building optical surface test
-- |++> dd4hep_configure_output: CMAKE_INSTALL_PREFIX is /home/liud/stcf/example/OpticalSurfaces1.10.3 - overwrite with -D CMAKE_INSTALL_PREFIX
-- |++> Building Plugin: OpticalSurfacesExample
-- |++> Setting up test environment for OpticalSurfaces: Testing: Setup:TRUE With Tests(TRUE): DIRS: OpticalSurfaces
-- Configuring done
CMake Error at /ustcfs/bes3user/2013/liud/software/DD4hep/DD4hep1.10.3/cmake/DD4hepBuild.cmake:616 (add_library):
Target "OpticalSurfacesExample" links to target "DD4hep::DDCore" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
CMakeLists.txt:31 (dd4hep_add_plugin)

CMake Error at /ustcfs/bes3user/2013/liud/software/DD4hep/DD4hep1.10.3/cmake/DD4hepBuild.cmake:616 (add_library):
Target "OpticalSurfacesExample" links to target "DD4hep::DDCond" but the
target was not found. Perhaps a find_package() call is missing for an
IMPORTED target, or an ALIAS target is missing?
Call Stack (most recent call first):
CMakeLists.txt:31 (dd4hep_add_plugin)

-- Generating done

@andresailer
Copy link
Member

Probably the examples/OpticalSurfaces/CMakeLists.txt just needs

find_package(DD4hep REQUIRED)

Or:

IF(NOT TARGET DD4hep::DDCore)
  find_package ( DD4hep REQUIRED )
  include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
  include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
  find_package ( ROOT REQUIRED COMPONENTS Geom GenVector )
  dd4hep_set_compiler_flags()
ENDIF()

@andresailer
Copy link
Member

@dannielliu have you tried adding the lines to the OpticalSurfaces/CMakeLists.txt ?

Now the question is, do we want that all examples can be build stand alone, or make it very clear that they shouldn't be build stand alone? Or add a DD4HEP_BUILD_EXAMPLES variable to the examples/CMakeLists.txt that would alone one to just build individual examples, similar to DD4HEP_BUILD_PACKAGES?

@dannielliu
Copy link
Author

Yes, I intend to tell you it works, but not with gcc6.2.0. I have to change to a higher version of gcc, which I use is gcc8.3. And I have to recompile all related packages.

It is not only the case of example, we need to know how to build our own detectors. If the example is not work stand alone, it would be harder to users to build their own detectors.
In my opinion, there should be at least one example that can be built stand alone, and tell user where it is, so users can refer to that example for their own detector development.

Best regards,
Dong LIU

@andresailer
Copy link
Member

Thanks for your feedback, @dannielliu
@petricm is already working on making the examples be build stand-alone in #585

What exactly is not working with gcc62?

@dannielliu
Copy link
Author

Sorry, I do not remember it clearly. When I try to repeat the error, It also works with gcc62. Previous error may due to the wrong configuration of my example.

Sorry & Thank you very much!
Dong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants