Rajaram-Regupathy / libtypec

“libtypec” is aimed to provide a generic interface abstracting all platform complexity for user space to develop tools for efficient USB-C port management. The library can also enable development of diagnostic and debug tools to debug system issues around USB-C/USB PD topology.
34 stars 4 forks source link

linux build issue on x86_64 #1

Closed satmandu closed 2 years ago

satmandu commented 2 years ago

I had to make some edits to get the utils build to start:

sed -i 's,CMAKE_CURRENT_LIST_DIR}/../..,CMAKE_CURRENT_LIST_DIR}/..,g' utils/CMakeLists.txt
sed -i 's,PROJECT_ROOT}/libtypec/bin,PROJECT_ROOT}/bin,g' utils/CMakeLists.txt

But even then I get a build error:

cmake CMakeLists.txt && make
Building from source, this may take a while...
-- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/tmp/crew/libtypec.20220120023756.dir
[ 33%] Building C object CMakeFiles/libtypec.dir/libtypec.c.o
[ 66%] Building C object CMakeFiles/libtypec.dir/libtypec_sysfs_ops.c.o
[100%] Linking C static library bin/liblibtypec.a
[100%] Built target libtypec

cd utils
cmake CMakeLists.txt && make
 -- The C compiler identification is GNU 11.2.1
-- The CXX compiler identification is GNU 11.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/local/tmp/crew/libtypec.20220120023756.dir/utils
[ 50%] Building C object CMakeFiles/lstypec.dir/lstypec.c.o
[100%] Linking C executable lstypec
/usr/local/bin/ld: error: /usr/local/tmp/crew/libtypec.20220120023756.dir/bin/liblibtypec.a(libtypec.c.o): multiple definition of '__packed'
/usr/local/bin/ld: CMakeFiles/lstypec.dir/lstypec.c.o: previous definition here
/usr/local/bin/ld: error: /usr/local/tmp/crew/libtypec.20220120023756.dir/bin/liblibtypec.a(libtypec_sysfs_ops.c.o): multiple definition of '__packed'
/usr/local/bin/ld: CMakeFiles/lstypec.dir/lstypec.c.o: previous definition here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/lstypec.dir/build.make:98: lstypec] Error 1
make[1]: *** [CMakeFiles/Makefile2:839: CMakeFiles/lstypec.dir/all] Error 2
make: *** [Makefile:121: all] Error 2
Rajaram-Regupathy commented 2 years ago

resolved please confirm

satmandu commented 2 years ago

That fixed the build issue.

Running it however gives lstypec - ERROR - Failed in Initializing libtypec. strace reveals that it can't find /sys/class/typec on my system. Is there a kernel version/module requirement?