Skip to content

Linker errors on Centos 7 build #14

@zetasyanthis

Description

@zetasyanthis

Was trying to build an RPM of version 1.3 for Centos 7, but got stuck on a linker error before I could even get that far. Any idea what might be causing this?

Starting with the cmake output.

[root@centos7-worker01-aus ~]# cmake3 --version
cmake3 version 3.17.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).
[root@centos7-worker01-aus frugen]# cmake3 .
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Using JSON Library found at /usr/lib64/libjson-c.so
-- Configuring done
-- Generating done
-- Build files have been written to: /root/frugen

And the errors from make:

[root@centos7-worker01-aus frugen]# make VERBOSE=1
/usr/bin/cmake3 -S/root/frugen -B/root/frugen --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake3 -E cmake_progress_start /root/frugen/CMakeFiles /root/frugen/CMakeFiles/progre
ss.marks
make  -f CMakeFiles/Makefile2 all   
make[1]: Entering directory `/root/frugen'
make  -f CMakeFiles/fru-shared.dir/build.make CMakeFiles/fru-shared.dir/depend
make[2]: Entering directory `/root/frugen'
cd /root/frugen && /usr/bin/cmake3 -E cmake_depends "Unix Makefiles" /root/frugen /root/frugen
 /root/frugen /root/frugen /root/frugen/CMakeFiles/fru-shared.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/root/frugen'
make  -f CMakeFiles/fru-shared.dir/build.make CMakeFiles/fru-shared.dir/build
make[2]: Entering directory `/root/frugen'
[ 12%] Building C object CMakeFiles/fru-shared.dir/fru.c.o
/usr/bin/cc -DVERSION=\"v1.2.4.g3bad90e.dirty\" -D__HAS_JSON__ -Dfru_shared_EXPORTS  -fPIC   -o CMakeFiles/fru-shared.dir/fru.c.o   -c /root/frugen/fru.c
/root/frugen/fru.c:25:0: warning: "_BSD_SOURCE" redefined [enabled by default]
 #define _BSD_SOURCE
 ^
In file included from /usr/include/stdint.h:25:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stdint.h:9,
                 from /root/frugen/fru.h:12,
                 from /root/frugen/fru.c:8:
/usr/include/features.h:188:0: note: this is the location of the previous definition
 # define _BSD_SOURCE 1
 ^
[ 25%] Linking C shared library libfru.so
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/fru-shared.dir/link.txt --verbose=1
/usr/bin/cc -fPIC    -shared -Wl,-soname,libfru.so -o libfru.so CMakeFiles/fru-shared.dir/fru.c.o
make[2]: Leaving directory `/root/frugen'
[ 25%] Built target fru-shared
make  -f CMakeFiles/fru-static.dir/build.make CMakeFiles/fru-static.dir/depend
make[2]: Entering directory `/root/frugen'
cd /root/frugen && /usr/bin/cmake3 -E cmake_depends "Unix Makefiles" /root/frugen /root/frugen /root/frugen /root/frugen /root/frugen/CMakeFiles/fru-static.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/root/frugen'
make  -f CMakeFiles/fru-static.dir/build.make CMakeFiles/fru-static.dir/build
make[2]: Entering directory `/root/frugen'
[ 37%] Building C object CMakeFiles/fru-static.dir/fru.c.o
/usr/bin/cc -DVERSION=\"v1.2.4.g3bad90e.dirty\" -D__HAS_JSON__   -o CMakeFiles/fru-static.dir/fru.c.o   -c /root/frugen/fru.c
/root/frugen/fru.c:25:0: warning: "_BSD_SOURCE" redefined [enabled by default]
 #define _BSD_SOURCE
 ^
In file included from /usr/include/stdint.h:25:0,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stdint.h:9,
                 from /root/frugen/fru.h:12,
                 from /root/frugen/fru.c:8:
/usr/include/features.h:188:0: note: this is the location of the previous definition
 # define _BSD_SOURCE 1
 ^
[ 50%] Linking C static library libfru.a
/usr/bin/cmake3 -P CMakeFiles/fru-static.dir/cmake_clean_target.cmake
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/fru-static.dir/link.txt --verbose=1
/usr/bin/ar qc libfru.a  CMakeFiles/fru-static.dir/fru.c.o
/usr/bin/ranlib libfru.a
make[2]: Leaving directory `/root/frugen'
[ 50%] Built target fru-static
make  -f CMakeFiles/frugen-static.dir/build.make CMakeFiles/frugen-static.dir/depend
make[2]: Entering directory `/root/frugen'
cd /root/frugen && /usr/bin/cmake3 -E cmake_depends "Unix Makefiles" /root/frugen /root/frugen /root/frugen /root/frugen /root/frugen/CMakeFiles/frugen-static.dir/DependInfo.cmake --color=
make[2]: Leaving directory `/root/frugen'
make  -f CMakeFiles/frugen-static.dir/build.make CMakeFiles/frugen-static.dir/build
make[2]: Entering directory `/root/frugen'
[ 62%] Building C object CMakeFiles/frugen-static.dir/frugen.c.o
/usr/bin/cc -DVERSION=\"v1.2.4.g3bad90e.dirty\" -D__HAS_JSON__   -o CMakeFiles/frugen-static.dir/frugen.c.o   -c /root/frugen/frugen.c
[ 75%] Linking C executable frugen-static
/usr/bin/cmake3 -E cmake_link_script CMakeFiles/frugen-static.dir/link.txt --verbose=1
/usr/bin/cc     -rdynamic CMakeFiles/frugen-static.dir/frugen.c.o  -o frugen-static  libfru.a -static -ljson-c -static 
/usr/bin/ld: cannot find -ljson-c
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
make[2]: *** [frugen-static] Error 1
make[2]: Leaving directory `/root/frugen'
make[1]: *** [CMakeFiles/frugen-static.dir/all] Error 2
make[1]: Leaving directory `/root/frugen'
make: *** [all] Error 2

Here's the rpm-qa output from the build VM I tried this on, so we have all package versioning. I can provide any other relevant output as well if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions