Coder Social home page Coder Social logo

issue using FindADIOS.cmake about adios HOT 26 CLOSED

ornladios avatar ornladios commented on August 24, 2024
issue using FindADIOS.cmake

from adios.

Comments (26)

jyamu avatar jyamu commented on August 24, 2024

mxml library is required for libadios.a, but libz is not. Please make sure mxml library path is loaded before linking with libadios. Please let us know if it fix the issue.

Kimmy

From: Andrew Corrigan [mailto:[email protected]]
Sent: Tuesday, June 24, 2014 7:17 PM
To: ornladios/ADIOS
Subject: [ADIOS] issue using FindADIOS.cmake (#24)

I am trying to integrate FindADIOS.cmake into my code. When I find_package(ADIOS), CMake reports:

-- Found 'adios_config': /Users/acorriga/adios/bin/adios_config
-- ADIOS linker flags (unparsed): -L/Users/acorriga/adios/lib -ladios /usr/lib/libm.dylib;/Users/acorriga/homebrew/lib/libmxml.dylib;/usr/lib/libz.dylib
-- Found adios in /Users/acorriga/adios/lib/libadios.a

When I link to ${ADIOS_LIBRARIES} using target_link_libraries it links to libadios.a, but none of its dependencies, and so I get linker errors due to not linking with libmxml.dylib and libz.dylib. I was able to workaround this by changing CMAKE_EXE_LINKER_FLAGS to -L/Users/acorriga/homebrew/lib -L/Users/acorriga/adios/lib -ladios -lm -lmxml -lz, but that defeats the purpose of FindADIOS.

What am I doing wrong?


Reply to this email directly or view it on GitHubhttps://github.com//issues/24.

from adios.

andrewcorrigan avatar andrewcorrigan commented on August 24, 2024

Kimmy,

Thank you for your quick response.

If I don't link against libz, then I get the following errors:

"_uncompress", referenced from:
_decompress_zlib_pre_allocated in libadios.a(adios_transform_zlib_read.c.o)
_adios_transform_zlib_pg_reqgroup_completed in libadios.a(adios_transform_zlib_read.c.o)

What precisely should I do to "make sure mxml library path is loaded before linking with libadios"? I have libmxml installed at /Users/acorriga/homebrew/lib/libmxml.dylib. If for example, I add /Users/acorriga/homebrew/lib to DYLD_LIBRARY_PATH or add -L/Users/acorriga/homebrew/lib before -ladios, then it still fails to link.

Honestly, I think that the problem is that FindADIOS.cmake is simply failing to report all of the libraries that are otherwise reported by adios_config -l.

Andrew

from adios.

jyamu avatar jyamu commented on August 24, 2024

Hi Andrew,

I checked the libraries reported by FindADIOS.cmake and compared it with the result of adios_config -l before the release. These two matched well. Let me look at it carefully and get back to you (next week).

BTW, we have an example of using FindADIOS.cmake in example/C/cmake_module_test. You can play with it and see if it works.

Thanks,
Kimmy


From: Andrew Corrigan [email protected]
Sent: Tuesday, June 24, 2014 8:29 PM
To: ornladios/ADIOS
Cc: Mu, Kimmy
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

Kimmy,

Thank you for your quick response.

If I don't link against libz, then I get the following errors:

"_uncompress", referenced from:
_decompress_zlib_pre_allocated in libadios.a(adios_transform_zlib_read.c.o)
_adios_transform_zlib_pg_reqgroup_completed in libadios.a(adios_transform_zlib_read.c.o)

What precisely should I do to "make sure mxml library path is loaded before linking with libadios"? I have libmxml installed at /Users/acorriga/homebrew/lib/libmxml.dylib. If for example, I add /Users/acorriga/homebrew/lib to DYLD_LIBRARY_PATH or add -L/Users/acorriga/homebrew/lib before -ladios, then it still fails to link.

Honestly, I think that the problem is that FindADIOS.cmake is simply failing to report all of the libraries that are otherwise reported by adios_config -l.

Andrew

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47047668.

from adios.

andrewcorrigan avatar andrewcorrigan commented on August 24, 2024

The CMake output itself indicates that FindADIOS.cmake is not correctly parsing the output of adios_config:

[aes048118:C/cmake_module_test/build] acorriga% cmake .
-- Found 'adios_config': /Users/acorriga/adios/bin/adios_config
-- ADIOS linker flags (unparsed): -L/Users/acorriga/adios/lib -ladios /usr/lib/libm.dylib;/Users/acorriga/homebrew/lib/libmxml.dylib;/usr/lib/libz.dylib
-- Found adios in /Users/acorriga/adios/lib/libadios.a

As you can see, the unparsed output indicates the appropriate linker commands, but ${ADIOS_LIBRARIES} does not include this information.

The same thing happens with the included example: it gets linker errors since it cannot find mxml or zlib. The output follows. Note, that before even getting to this point, since FindADIOS.cmake does not attempt to look for MPI, I also had to also manually add MPI include and linker paths, as well -lmpi, all of which should be taken care of automatically by FindADIOS.cmake (when not requesting a sequential version of ADIOS).

[aes048118:C/cmake_module_test/build] acorriga% make
Linking C executable uniform2d
Undefined symbols for architecture x86_64:
  "_compress2", referenced from:
      _compress_zlib_pre_allocated in libadios.a(adios_transform_zlib_write.c.o)
      _adios_transform_zlib_apply in libadios.a(adios_transform_zlib_write.c.o)
  "_mxmlElementGetAttr", referenced from:
      _parseMeshUniform in libadios.a(adios_internals_mxml.c.o)
      _parseMeshRectilinear1 in libadios.a(adios_internals_mxml.c.o)
      _parseMeshStructured1 in libadios.a(adios_internals_mxml.c.o)
      _parseMeshUnstructured1 in libadios.a(adios_internals_mxml.c.o)
      _parseGroup in libadios.a(adios_internals_mxml.c.o)
  "_mxmlFindElement", referenced from:
      _adios_parse_config in libadios.a(adios_internals_mxml.c.o)
  "_mxmlLoadString", referenced from:
      _adios_parse_config in libadios.a(adios_internals_mxml.c.o)
  "_mxmlRelease", referenced from:
      _adios_parse_config in libadios.a(adios_internals_mxml.c.o)
  "_mxmlWalkNext", referenced from:
      _parseMeshUniform in libadios.a(adios_internals_mxml.c.o)
      _parseMeshRectilinear1 in libadios.a(adios_internals_mxml.c.o)
      _parseMeshStructured1 in libadios.a(adios_internals_mxml.c.o)
      _parseMeshUnstructured1 in libadios.a(adios_internals_mxml.c.o)
      _adios_parse_config in libadios.a(adios_internals_mxml.c.o)
      _parseGroup in libadios.a(adios_internals_mxml.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [uniform2d] Error 1
make[1]: *** [CMakeFiles/uniform2d.dir/all] Error 2
make: *** [all] Error 2

from adios.

jyamu avatar jyamu commented on August 24, 2024

Here is my output after cmake the example I mentioned earlier. It works here. The FindADIOS.cmake file is trying to find every library in ADIOS linker flags. Can you send me your output with error message together?

-- The C compiler identification is GNU 4.4.7

-- The CXX compiler identification is GNU 4.4.7

-- Check for working C compiler: /usr/lib64/ccache/cc

-- Check for working C compiler: /usr/lib64/ccache/cc -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler: /usr/lib64/ccache/c++

-- Check for working CXX compiler: /usr/lib64/ccache/c++ -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Found 'adios_config': /sw/redhat6/adios/1.6.0/rhel6_pgi13.4/bin/adios_config

-- ADIOS linker flags (unparsed): -L/sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib -ladios -L/sw/redhat6/mxml/2.6/rhel6_pgi12.8/lib -lmxml -L/sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib -L/usr/lib64/lib -L/lib64/lib -L/lib64/lib64 -L/sw/sith/bzip2/1.0.6/rhel6_pgi12.8/lib -L/sw/redhat6/szip/2.1/rhel6_pgi13.4/lib -L/sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib -lm -lmxml -ldspaces -ldscommon -ldart -lrdmacm -libverbs -llustreapi -lz -lbz2 -lsz -lisobar -lz

-- Found adios in /sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib/libadios.a

-- Found mxml in /sw/redhat6/mxml/2.6/rhel6_pgi12.8/lib/libmxml.a

-- Found m in /usr/lib64/libm.so

-- Found mxml in /sw/redhat6/mxml/2.6/rhel6_pgi12.8/lib/libmxml.a

-- Found dspaces in /sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdspaces.a

-- Found dscommon in /sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdscommon.a

-- Found dart in /sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdart.a

-- Found rdmacm in /usr/lib64/librdmacm.so

-- Found ibverbs in /usr/lib64/libibverbs.so

-- Found lustreapi in /usr/lib64/liblustreapi.so

-- Found z in /usr/lib64/libz.so

-- Found bz2 in /usr/lib64/libbz2.so

-- Found sz in /sw/redhat6/szip/2.1/rhel6_pgi13.4/lib/libsz.so

-- Found isobar in /sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib/libisobar.a

-- Found z in /usr/lib64/libz.so

-- Found ADIOS: /sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib/libadios.a;/sw/redhat6/mxml/2.6/rhel6_pgi12.8/lib/libmxml.a;/usr/lib64/libm.so;/sw/redhat6/mxml/2.6/rhel6_pgi12.8/lib/libmxml.a;/sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdspaces.a;/sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdscommon.a;/sw/redhat6/dataspaces/1.3.0/rhel6_pgi13.4/lib/libdart.a;/usr/lib64/librdmacm.so;/usr/lib64/libibverbs.so;/usr/lib64/liblustreapi.so;/usr/lib64/libz.so;/usr/lib64/libbz2.so;/sw/redhat6/szip/2.1/rhel6_pgi13.4/lib/libsz.so;/sw/redhat6/adios/1.6.0/rhel6_pgi13.4/lib/libisobar.a;/usr/lib64/libz.so; (found version "1.6.0")

ADIOS_INCLUDE_DIRS is /sw/redhat6/adios/1.6.0/rhel6_pgi13.4/include

-- Configuring done

-- Generating done

-- Build files have been written to: /ccs/home/jya/ADIOS/examples/C/cmake_module_test/build


From: Andrew Corrigan [email protected]
Sent: Thursday, June 26, 2014 6:36 AM
To: ornladios/ADIOS
Cc: Mu, Kimmy
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

The CMake output itself indicates that FindADIOS.cmake is not correctly parsing the output of adios_config:

[aes048118:C/cmake_module_test/build] acorriga% cmake .
-- Found 'adios_config': /Users/acorriga/adios/bin/adios_config
-- ADIOS linker flags (unparsed): -L/Users/acorriga/adios/lib -ladios /usr/lib/libm.dylib;/Users/acorriga/homebrew/lib/libmxml.dylib;/usr/lib/libz.dylib
-- Found adios in /Users/acorriga/adios/lib/libadios.a

As you can see, the unparsed output indicates the appropriate linker commands, but ${ADIOS_LIBRARIES} does not include this information.

The same thing happens with the included example: it gets linker errors since it cannot find mxml or zlib. The output follows. Note, that before even getting to this point, since FindADIOS.cmake does not attempt to look for MPI, I also had to also manually add MPI include and linker paths, as well -lmpi, all of which should be taken care of automatically by FindADIOS.cmake (when not requesting a sequential version of ADIOS).

[aes048118:C/cmake_module_test/build] acorriga% make
Linking C executable uniform2d
Undefined symbols for architecture x86_64:
"_compress2", referenced from:
_compress_zlib_pre_allocated in libadios.a(adios_transform_zlib_write.c.o)
_adios_transform_zlib_apply in libadios.a(adios_transform_zlib_write.c.o)
"_mxmlElementGetAttr", referenced from:
_parseMeshUniform in libadios.a(adios_internals_mxml.c.o)
_parseMeshRectilinear1 in libadios.a(adios_internals_mxml.c.o)
_parseMeshStructured1 in libadios.a(adios_internals_mxml.c.o)
_parseMeshUnstructured1 in libadios.a(adios_internals_mxml.c.o)
_parseGroup in libadios.a(adios_internals_mxml.c.o)
"_mxmlFindElement", referenced from:
_adios_parse_config in libadios.a(adios_internals_mxml.c.o)
"_mxmlLoadString", referenced from:
_adios_parse_config in libadios.a(adios_internals_mxml.c.o)
"_mxmlRelease", referenced from:
_adios_parse_config in libadios.a(adios_internals_mxml.c.o)
"_mxmlWalkNext", referenced from:
_parseMeshUniform in libadios.a(adios_internals_mxml.c.o)
_parseMeshRectilinear1 in libadios.a(adios_internals_mxml.c.o)
_parseMeshStructured1 in libadios.a(adios_internals_mxml.c.o)
_parseMeshUnstructured1 in libadios.a(adios_internals_mxml.c.o)
_adios_parse_config in libadios.a(adios_internals_mxml.c.o)
_parseGroup in libadios.a(adios_internals_mxml.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [uniform2d] Error 1
make[1]: *** [CMakeFiles/uniform2d.dir/all] Error 2
make: *** [all] Error 2

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47210983.

from adios.

ax3l avatar ax3l commented on August 24, 2024

@andrewcorrigan great to tried it out on mac!

I am sorry I did not check it on that platform while writing.
Did you use set(ADIOS_USE_STATIC_LIBS ON) ?

What does a

message(STATUS "${ADIOS_INCLUDE_DIRS}")
message(STATUS "${ADIOS_LIBRARIES}")

tell about the libs and dirs it found?
what does adios_config -l say on the same platform?

adios -L is -L/Users/acorriga/adios/lib -ladios /usr/lib/libm.dylib;/Users/acorriga/homebrew/lib/libmxml.dylib;/usr/lib/libz.dylib if I read you output right.

the problem could be that the last output dylibs do not start with -l which might be skipped by the script because of that.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Update: Actually I still think that is a bug in adios_config -l as reported here.

Just throwing /usr/lib/libm.dylib;/Users/acorriga/homebrew/lib/libmxml.dylib;/usr/lib/libz.dylib at a linker is not a valid linker command. Because of that the FindADIOS script does not parse the last libs as libraries.

I would guess that you installed adios itself with the cmake install that causes that artefact. We should fix the output of adios_config -l.

from adios.

ax3l avatar ax3l commented on August 24, 2024

The problem can be adressed by patching that line in CMakeLists.txt by transforming the string for adios_config.flags or by writing them correctly in the first place by transforming the var ${LIBS}/${ADIOSLIB_LDADD} before writing it in the lines above.

One should keep in mind that ${LIBS}/${ADIOSLIB_LDADD} is a CMake list that is represented as "value1;value2;value3" as above.
We just have to create a string from it starting with -l for each element and replacing the ; with a whitespace in the final string.

from adios.

ax3l avatar ax3l commented on August 24, 2024

a quick hack for the problem I reported here caused by CMake based installs could look like this:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a70add1..e2bad4d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1690,6 +1690,31 @@ message(STATUS "${_LANGUAGES_}")
 #####################start processing adios_config.flags.in #####################
 set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

+foreach(TMPLIB in ${LIBS})
+  set(LIBS_STR "${LIBS_STR} -l${TMPLIB}")
+endforeach(TMPLIB in ${LIBS})
+set(LIBS "${LIBS_STR}")
+
+foreach(TMPLIB in ${ADIOSLIB_LDADD})
+  set(ADIOSLIB_LDADD_STR "${ADIOSLIB_LDADD_STR} -l${TMPLIB}")
+endforeach(TMPLIB in ${ADIOSLIB_LDADD})
+string(STRIP "${ADIOSLIB_LDADD_STR}" ADIOSLIB_LDADD)
+
+foreach(TMPLIB in ${ADIOSREADLIB_LDADD})
+  set(ADIOSREADLIB_LDADD_STR "${ADIOSREADLIB_LDADD_STR} -l${TMPLIB}")
+endforeach(TMPLIB in ${ADIOSREADLIB_LDADD})
+string(STRIP "${ADIOSREADLIB_LDADD_STR}" ADIOSREADLIB_LDADD)
+
+foreach(TMPLIB in ${ADIOSLIB_SEQ_LDADD})
+  set(ADIOSLIB_SEQ_LDADD_STR "${ADIOSLIB_SEQ_LDADD_STR} -l${TMPLIB}")
+endforeach(TMPLIB in ${ADIOSLIB_SEQ_LDADD})
+string(STRIP "${ADIOSLIB_SEQ_LDADD_STR}" ADIOSLIB_SEQ_LDADD)
+
+foreach(TMPLIB in ${ADIOSLIB_INT_LDADD})
+  set(ADIOSLIB_INT_LDADD_STR "${ADIOSLIB_INT_LDADD_STR} -l${TMPLIB}")
+endforeach(TMPLIB in ${ADIOSLIB_INT_LDADD})
+string(STRIP "${ADIOSLIB_INT_LDADD_STR}" ADIOSLIB_INT_LDADD)
+
 set(ADIOS_INC "-I${ADIOS_DIR}/include ${ADIOSLIB_CPPFLAGS} ${ADIOSLIB_CFLAGS}")
 set(ADIOS_CLIB "-L${ADIOS_DIR}/lib -ladios ${ADIOSLIB_LDADD} ${LIBS}")
 set(ADIOS_FLIB "-L${ADIOS_DIR}/lib -ladiosf ${ADIOSLIB_LDADD} ${LIBS}")

I am actually not sure why one is setting vars like ADIOS_CLIB in this section at all.
CMakes CONFIGURE_FILE only replaces the vars defined with configure-style @VAR@ in adios_config.flags.in and once could reduce that section by that lines...

Shall I open a pull request for that?

from adios.

jyamu avatar jyamu commented on August 24, 2024

I did not use set(ADIOS_USE_STATIC_LIBS ON)

Kimmy


From: Axel Huebl [email protected]
Sent: Friday, June 27, 2014 4:45 AM
To: ornladios/ADIOS
Cc: Mu, Kimmy
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

@andrewcorriganhttps://github.com/andrewcorrigan great to tried it out on mac!

I am sorry I did not check it on that platform while writing.
Did you use set(ADIOS_USE_STATIC_LIBS ON) ?

What does a

message(STATUS "${ADIOS_INCLUDE_DIRS}")
message(STATUS "${ADIOS_LIBRARIES}")

tell about the libs and dirs it found?
what does adios_config -l say on the same platform?

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47320829.

from adios.

ax3l avatar ax3l commented on August 24, 2024

ok that's fine - forcing stating linking also depends quite heavily on the fact if the indirect dependencies have been compiled with both libs to succeed.

@andrewcorrigan Can you try to re-install Adios itself by applying my patch first? Does that fix it for you?

from adios.

jyamu avatar jyamu commented on August 24, 2024

In this case if we replace ";" with a space before parsing the whole string will it fix the problem?

Thanks,
Kimmy

From: Axel Huebl <[email protected]mailto:[email protected]>
Reply-To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Date: Friday, June 27, 2014 at 5:22 AM
To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Cc: Microsoft Office User <[email protected]mailto:[email protected]>
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

The problem can be adressed by patching that line in CMakeLists.txthttps://github.com/ornladios/ADIOS/blob/401ee3558d76b6a9be8eddd6074c8aaed02938f2/CMakeLists.txt#L1715 by transforming the string from adios_config.flags or by writing them correctly in the first place by transforming the var ${LIBS} before writing it in the lines above.

One should keep in mind that ${LIBS} is a CMake list that is represented as "value1;value2;value3" as above.
We just have to create a string from it starting with -l for each element and replacing the ; with a whitespace in the final string.

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47323998.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Hi Kimmy,

unfortunately not - we will have to do the full transformation as I showed it above.

Every element in the list has to be replaced with "-lListElement " (and a space to the next one).

But it's not that much of a change finally - shall I just open a pull request for that or send you the patch via mail?

from adios.

jyamu avatar jyamu commented on August 24, 2024

Hi Alex,

I just tried to use transformation you have for ADIOSLIB_LDADD to do a test. It is not that straightforward because of format inconsistency from hdf5 and netcdf4 library. It has -L*** and -llib together with cmake library format. Here is the full string of ADIOSLIB_LDADD:
/usr/lib64/libm.a;/sw/redhat6/mxml/2.7/rhel6_pgi12.8/lib/libmxml.so;/ccs/proj/e2e/dataspaces/sith/pgi/lib/libdspaces.a;/ccs/proj/e2e/dataspaces/sith/pgi/lib/libdscommon.a;/ccs/proj/e2e/dataspaces/sith/pgi/lib/libdart.a;/usr/lib64/librdmacm.so;/ccs/proj/e2e/chaos/sith/pgi/lib/libevpath.a;/ccs/proj/e2e/chaos/sith/pgi/lib/libffs.a;/ccs/proj/e2e/chaos/sith/pgi/lib/libatl.a;/ccs/proj/e2e/chaos/sith/pgi/lib/libdill.a;/ccs/proj/e2e/chaos/sith/pgi/lib/libcercs_env.a;-L/sw/sith/netcdf/4.1.3/rhel6_pgi13.4_ompi1.6.3/lib -L/sw/sith/hdf5/1.8.10/rhel6_pgi13.4_ompi1.6.3/lib -L/sw/sith/szip/2.1/rhel6_pgi13.4/lib -lnetcdf -lcurl -lhdf5_hl -lhdf5 -lsz -lz -lm;-L/sw/sith/hdf5/1.8.10/rhel6_pgi13.4_ompi1.6.3/lib -L/sw/sith/szip/2.1/rhel6_pgi13.4/lib -lhdf5_hl -lhdf5 -lsz -lz -lm;-libverbs;/usr/lib64/liblustreapi.so;/ccs/proj/e2e/qliu/tap/lib/libfgr.a;/ccs/proj/e2e/qliu/glib/lib/libglib-2.0.a;/usr/lib64/libz.so;/usr/lib64/libbz2.so;/sw/redhat6/szip/2.1/rhel6_pgi13.4/lib/libsz.a;/ccs/proj/e2e/ncsu/sith.gnu/lib/libisobar.a;/ccs/proj/e2e/ncsu/sith.gnu/lib/libaplod.a

Let me fix the inconsistency first.

from adios.

jyamu avatar jyamu commented on August 24, 2024

Hi Alex,

Maybe the easier way is to check the string start with "/" or not. If it starts with a "/", it will be processed as what you mentioned, for example set(ADIOSLIB_LDADD_STR "${ADIOSLIB_LDADD_STR} -l${TMPLIB}"). If it does not start with a "/", then do not process it and leave it there. What do you think?

Thanks,
Kimmy

from adios.

ax3l avatar ax3l commented on August 24, 2024

Hi Kimmy,

wow - that is a weird mix ;)
I would suggest a slightly easier way: if the element is a plain path to a file we transform it, else we leave it as it is:

foreach(TMPLIB in ${LIBS})
    if(EXISTS "${TMPLIB}")
      set(LIBS_STR "${LIBS_STR} -l${TMPLIB}")
    else()
      set(LIBS_STR "${LIBS_STR} ${TMPLIB}")
    endif()
endforeach(TMPLIB in ${LIBS})

We might want to write a small makro for that.

Actually it is quite interesting where this mix comes from, e.g. how NETCDF_LIBS is created.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Here we go, does that work for you?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a70add1..d596bf6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1690,6 +1690,30 @@ message(STATUS "${_LANGUAGES_}")
 #####################start processing adios_config.flags.in #####################
 set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

+function(TransformeForLd LIBSTR LIBS)
+  set(LINKER_STR)
+  foreach(TMPLIB ${LIBS})
+    # is a file?
+    if(EXISTS "${TMPLIB}")
+      set(LINKER_STR "${LINKER_STR} -l${TMPLIB}")
+    else()
+      set(LINKER_STR "${LINKER_STR} ${TMPLIB}")
+    endif()
+  endforeach(TMPLIB)
+  string(STRIP "${LINKER_STR}" LINKER_STR)
+  set(${LIBSTR} "${LINKER_STR}" PARENT_SCOPE)
+endfunction(TransformeForLd)
+
+TransformeForLd(LIBS "${LIBS}")
+
+TransformeForLd(ADIOSLIB_LDADD "${ADIOSLIB_LDADD}")
+
+TransformeForLd(ADIOSREADLIB_LDADD "${ADIOSREADLIB_LDADD}")
+
+TransformeForLd(ADIOSLIB_SEQ_LDADD "${ADIOSLIB_SEQ_LDADD}")
+
+TransformeForLd(ADIOSLIB_INT_LDADD "${ADIOSLIB_INT_LDADD}")
+
 set(ADIOS_INC "-I${ADIOS_DIR}/include ${ADIOSLIB_CPPFLAGS} ${ADIOSLIB_CFLAGS}")
 set(ADIOS_CLIB "-L${ADIOS_DIR}/lib -ladios ${ADIOSLIB_LDADD} ${LIBS}")
 set(ADIOS_FLIB "-L${ADIOS_DIR}/lib -ladiosf ${ADIOSLIB_LDADD} ${LIBS}")

from adios.

jyamu avatar jyamu commented on August 24, 2024

The mix (refer cmake_init file) could from these libraries in some machine because of environmental setup difference. It is a bit hard to make them consistent across all machines..

From: Axel Huebl <[email protected]mailto:[email protected]>
Reply-To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Date: Monday, June 30, 2014 at 5:36 PM
To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Cc: Microsoft Office User <[email protected]mailto:[email protected]>
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

Hi Kimmy,

wow - that is a weird mix ;)
I would suggest a slightly easier way: if the element is a plain path to a file we transform it, else we leave it as it is:

foreach(TMPLIB in ${LIBS})
if(EXISTS "${TMPLIB}")
set(LIBS_STR "${LIBS_STR} -l${TMPLIB}")
else()
set(LIBS_STR "${LIBS_STR} ${TMPLIB}")
endif()endforeach(TMPLIB in ${LIBS})

We might want to write a small makro for that.

Actually it is quite interesting where this mix comes from, e.g. how NETCDF_LIBS is created.

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47590536.

from adios.

jyamu avatar jyamu commented on August 24, 2024

I will try it out later and keep you updated.

From: Axel Huebl <[email protected]mailto:[email protected]>
Reply-To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Date: Monday, June 30, 2014 at 6:48 PM
To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Cc: Microsoft Office User <[email protected]mailto:[email protected]>
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

Here we go, does that work for you?

diff --git a/CMakeLists.txt b/CMakeLists.txtindex a70add1..d596bf6 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1690,6 +1690,30 @@ message(STATUS "${LANGUAGES}")
#####################start processing adios_config.flags.in #####################
set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

+function(TransformeForLd LIBSTR LIBS)+ set(LINKER_STR)+ foreach(TMPLIB ${LIBS})+ # is a file?+ if(EXISTS "${TMPLIB}")+ set(LINKER_STR "${LINKER_STR} -l${TMPLIB}")+ else()+ set(LINKER_STR "${LINKER_STR} ${TMPLIB}")+ endif()+ endforeach(TMPLIB)+ string(STRIP "${LINKER_STR}" LINKER_STR)+ set(${LIBSTR} "${LINKER_STR}" PARENT_SCOPE)+endfunction(TransformeForLd)++TransformeForLd(LIBS "${LIBS}")++TransformeForLd(ADIOSLIB_LDADD "${ADIOSLIB_LDADD}")++TransformeForLd(ADIOSREADLIB_LDADD "${ADIOSREADLIB_LDADD}")++TransformeForLd(ADIOSLIB_SEQ_LDADD "${ADIOSLIB_SEQ_LDADD}")++TransformeForLd(ADIOSLIB_INT_LDADD "${ADIOSLIB_INT_LDADD}")+
set(ADIOS_INC "-I${ADIOS_DIR}/include ${ADIOSLIB_CPPFLAGS} ${ADIOSLIB_CFLAGS}")
set(ADIOS_CLIB "-L${ADIOS_DIR}/lib -ladios ${ADIOSLIB_LDADD} ${LIBS}")
set(ADIOS_FLIB "-L${ADIOS_DIR}/lib -ladiosf ${ADIOSLIB_LDADD} ${LIBS}")

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47597296.

from adios.

jyamu avatar jyamu commented on August 24, 2024

somthing like -l/usr/lib64/libm.a does not work for building executables
Just remembered I have done something for cmake, but made a mistake when trying to remove ";" for ADIOS_LINKFLAGS (dont know why I have it for OPTLIST). Just fixed it and tested it.
Please let me know if it does not work well.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Hi @jyamu,

what do you mean by somthing like -l/usr/lib64/libm.a does not work for building executables - that is valid syntax.
Can you show me a full example that is not working?

I tried your patch (master b2d9999) and the file adios_config.flags after running cmake does not look good (still with ";"). Did you already push the changes you tested?

Pls reopen.

from adios.

jyamu avatar jyamu commented on August 24, 2024

I have no idea why, but ... I just copy the error message here.

/usr/bin/ld: cannot find -l/usr/lib64/libm.a

make[2]: *** [utils/bpdump/bpdump] Error 2

make[1]: *** [utils/bpdump/CMakeFiles/bpdump.dir/all] Error 2

make: *** [all] Error 2

From: Axel Huebl <[email protected]mailto:[email protected]>
Reply-To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Date: Wednesday, July 2, 2014 at 3:39 AM
To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Cc: Microsoft Office User <[email protected]mailto:[email protected]>
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

Hi @jyamuhttps://github.com/jyamu,

what do you mean by somthing like -l/usr/lib64/libm.a does not work for building executables - that is valid syntax.
Can you show me a full example that is not working?

I tried you patch (master b2d9999b2d9999) and the file adios_config.flags after running cmake does not look good (still with ";").
Pls reopen.

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47745828.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Hi @jyamu,

thanks - can you please send me the full cmake output and error message?

To me it looks like one of your dependencies was compiled when a /usr/lib64/libm.a was still present.
Now the file does not exist any more, that is why ld tells us cannot find -l/usr/lib64/libm.a.

from adios.

ax3l avatar ax3l commented on August 24, 2024

@jyamu yes you are right, just removing the ; should do the trick!

Anyway, I would not place it in FindADIOS.cmake (9242f76) and would rather clean that up already during cmake based install.

By that, also other tools like configure can read the adios_config.flags directly.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b511d1e..cdd9a59 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1690,6 +1690,27 @@ message(STATUS "${_LANGUAGES_}")
 #####################start processing adios_config.flags.in #####################
 set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

+function(TransformeForLd LIBSTR LIBS)
+  set(LINKER_STR)
+  foreach(TMPLIB ${LIBS})
+    set(LINKER_STR "${LINKER_STR} ${TMPLIB}")
+  endforeach(TMPLIB)
+  string(STRIP "${LINKER_STR}" LINKER_STR)
+  set(${LIBSTR} "${LINKER_STR}" PARENT_SCOPE)
+endfunction(TransformeForLd)
+
+TransformeForLd(LIBS "${LIBS}")
+
+TransformeForLd(ADIOSLIB_LDADD "${ADIOSLIB_LDADD}")
+
+TransformeForLd(ADIOSREADLIB_LDADD "${ADIOSREADLIB_LDADD}")
+
+TransformeForLd(ADIOSREADLIB_SEQ_LDADD "${ADIOSREADLIB_SEQ_LDADD}")
+
+TransformeForLd(ADIOSLIB_SEQ_LDADD "${ADIOSLIB_SEQ_LDADD}")
+
+TransformeForLd(ADIOSLIB_INT_LDADD "${ADIOSLIB_INT_LDADD}")
+
 set(ADIOS_INC "-I${ADIOS_DIR}/include ${ADIOSLIB_CPPFLAGS} ${ADIOSLIB_CFLAGS}")
 set(ADIOS_CLIB "-L${ADIOS_DIR}/lib -ladios ${ADIOSLIB_LDADD} ${LIBS}")
 set(ADIOS_FLIB "-L${ADIOS_DIR}/lib -ladiosf ${ADIOSLIB_LDADD} ${LIBS}")

(sorry, I must have mixed up something with -l and direct paths in the previous diff)

on a side note: we could also split the path up in -L/to/dir and -lname but I think that should be fine already.

from adios.

ax3l avatar ax3l commented on August 24, 2024

Unrelated to that: I just realized there is an old (probably not working) FindADIOS.cmake in the main directory / of the project - we might want to remove that so users do not get confused.

from adios.

jyamu avatar jyamu commented on August 24, 2024

Yes and agreed that we could avoid the trick in previous step by doing this!

Kimmy

From: Axel Huebl <[email protected]mailto:[email protected]>
Reply-To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Date: Thursday, July 3, 2014 at 3:52 AM
To: ornladios/ADIOS <[email protected]mailto:[email protected]>
Cc: Microsoft Office User <[email protected]mailto:[email protected]>
Subject: Re: [ADIOS] issue using FindADIOS.cmake (#24)

@jyamuhttps://github.com/jyamu yes you are right, just removing the ; should do the trick!

Anyway, I would not place it in FindADIOS.cmake (9242f769242f76) and would rather clean that up already during cmake based install.

By that, also other tools like configure can read the adios_config.flags directly.

diff --git a/CMakeLists.txt b/CMakeLists.txtindex b511d1e..cdd9a59 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -1690,6 +1690,27 @@ message(STATUS "${LANGUAGES}")
#####################start processing adios_config.flags.in #####################
set(ADIOS_DIR "${CMAKE_INSTALL_PREFIX}")

+function(TransformeForLd LIBSTR LIBS)+ set(LINKER_STR)+ foreach(TMPLIB ${LIBS})+ set(LINKER_STR "${LINKER_STR} ${TMPLIB}")+ endforeach(TMPLIB)+ string(STRIP "${LINKER_STR}" LINKER_STR)+ set(${LIBSTR} "${LINKER_STR}" PARENT_SCOPE)+endfunction(TransformeForLd)++TransformeForLd(LIBS "${LIBS}")++TransformeForLd(ADIOSLIB_LDADD "${ADIOSLIB_LDADD}")++TransformeForLd(ADIOSREADLIB_LDADD "${ADIOSREADLIB_LDADD}")++TransformeForLd(ADIOSREADLIB_SEQ_LDADD "${ADIOSREADLIB_SEQ_LDADD}")++TransformeForLd(ADIOSLIB_SEQ_LDADD "${ADIOSLIB_SEQ_LDADD}")++TransformeForLd(ADIOSLIB_INT_LDADD "${ADIOSLIB_INT_LDADD}")+
set(ADIOS_INC "-I${ADIOS_DIR}/include ${ADIOSLIB_CPPFLAGS} ${ADIOSLIB_CFLAGS}")
set(ADIOS_CLIB "-L${ADIOS_DIR}/lib -ladios ${ADIOSLIB_LDADD} ${LIBS}")
set(ADIOS_FLIB "-L${ADIOS_DIR}/lib -ladiosf ${ADIOSLIB_LDADD} ${LIBS}")

(sorry, I must have mixed up something with -l and direct paths in the previous diff)

on a side note: we could also split the path up in -L/to/dir and -lname but I think that should be fine already.

Reply to this email directly or view it on GitHubhttps://github.com//issues/24#issuecomment-47876949.

from adios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.