[ 
https://issues.apache.org/jira/browse/DISPATCH-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17368409#comment-17368409
 ] 

ASF GitHub Bot commented on DISPATCH-2178:
------------------------------------------

jiridanek commented on a change in pull request #1267:
URL: https://github.com/apache/qpid-dispatch/pull/1267#discussion_r655416842



##########
File path: tests/CMakeLists.txt
##########
@@ -40,8 +40,8 @@ set(unit_test_SOURCES
     thread_test.c
     )
 
-add_executable(unit_tests ${unit_test_SOURCES})
-target_link_libraries(unit_tests  qpid-dispatch)
+add_executable(unit_tests ${unit_test_SOURCES} $<TARGET_OBJECTS:qpid-dispatch>)
+target_link_libraries(unit_tests qpid-dispatch-libraries)

Review comment:
       The static library is empty, it is only a CMake target that carries 
dependencies of qpid-dispatch. Like INTERFACE library, but that is not 
supported in CMake 3.8.12.2. I have to propagate the PUBLIC/INTERFACE 
dependencies of the object files in `$<TARGET_OBJECTS:qpid-dispatch>` somehow.
   
   If I had CMake 3.12, I could do `target_link_libraries(unit_tests 
qpid-dispatch)` and be done with it. For older CMake, I have to add the object 
files into `add_executable`, but that does nothing about link dependencies. So 
I'd have to have e.g. a variable.... I thought that a `-libraries` static 
library containing no symbols of its own is cleaner. (The library will actually 
have to contain something due to the macOS error I mentioned above.)

##########
File path: tests/CMakeLists.txt
##########
@@ -40,8 +40,8 @@ set(unit_test_SOURCES
     thread_test.c
     )
 
-add_executable(unit_tests ${unit_test_SOURCES})
-target_link_libraries(unit_tests  qpid-dispatch)
+add_executable(unit_tests ${unit_test_SOURCES} $<TARGET_OBJECTS:qpid-dispatch>)
+target_link_libraries(unit_tests qpid-dispatch-libraries)

Review comment:
       The static library is empty, it is only a CMake target that carries 
dependencies of qpid-dispatch. Like INTERFACE library, but that is not 
supported in CMake 2.8.12.2. I have to propagate the PUBLIC/INTERFACE 
dependencies of the object files in `$<TARGET_OBJECTS:qpid-dispatch>` somehow.
   
   If I had CMake 3.12, I could do `target_link_libraries(unit_tests 
qpid-dispatch)` and be done with it. For older CMake, I have to add the object 
files into `add_executable`, but that does nothing about link dependencies. So 
I'd have to have e.g. a variable.... I thought that a `-libraries` static 
library containing no symbols of its own is cleaner. (The library will actually 
have to contain something due to the macOS error I mentioned above.)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


> Do not build separate libqpid-dispatch.so
> -----------------------------------------
>
>                 Key: DISPATCH-2178
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-2178
>             Project: Qpid Dispatch
>          Issue Type: Improvement
>    Affects Versions: 1.16.0
>            Reporter: Jiri Daněk
>            Assignee: Jiri Daněk
>            Priority: Major
>
> h3. Motivation
> The split into a binary and a library is not unprecedented (e.g. CPython does 
> exactly the same thing), but in Dispatch it is avoidable with minimal code 
> changes (an executable can {{dlopen(NULL, ...)}} itself.
> Getting rid of libqpid-dispatch.so will mean one less file that we need to 
> install (and since it is not a published API, finding a good place for the so 
> has been tricky in the past (see DISPATCH-194).
> Furthermore, avoiding the indirection of a library call will likely give some 
> performance benefit at a low level (individual function calls) similar to 
> (again) Python in https://fedoraproject.org/wiki/Changes/PythonStaticSpeedup. 
> The gains can be best utilized after doing LTO (see DISPATCH-2121).
> h3. Expected issues
> The problem with this is that we lose semantic interposition 
> (https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup),
>  meaning we won't be able to simply override symbols from libqpid-dispatch.so 
> at runtime. This is an issue because Dispatch unittests depend on this. (See 
> DISPATCH-1783)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to