Subject: [postgresql-interfaces/psqlodbc] issue #15: #define pg_strdup _strdup

From: "jboakye (@jboakye)" <[email-masked]>
Date: Sun, 12 May 2024 16:53:37 +0000

symbol lookup error: /usr/local/lib/psqlodbca.so: undefined symbol: _strdup
[Debian][psqlodbc Release 16_004]

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 13 May 2024 00:45:33 +0000

You should report this to the debian maintainer.

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 01:44:38 +0000

Just curious though why not define it as strdup ... that's my workaround.

---

From: "df7cb (@df7cb)" <[email-masked]>
Date: Mon, 13 May 2024 08:29:27 +0000

Hi,

anything in `/usr/local` is not a Debian problem. That's something you compiled yourself and installed there.

---

From: "df7cb (@df7cb)" <[email-masked]>
Date: Mon, 13 May 2024 08:43:00 +0000

The Debian package build has the same problem, though:
```
ODBCSYSINI=. ODBCINSTINI=./odbcinst.ini ODBCINI=./odbc.ini ./reset-db < ./sampletables.sql
./reset-db: symbol lookup error: ../.libs/psqlodbcw.so: undefined symbol: _strdup
make[2]: *** [Makefile:32: installcheck] Error 127
```

Full build log: https://pgdgbuild.dus.dg-i.net/job/psqlodbc-binaries/83/architecture=amd64,distribution=sid/console

---

From: "jboakye (@jboakye)" <[email-masked]>
Date: Mon, 13 May 2024 09:29:23 +0000

I just did some research and it seems _strdup is targeted at MS windows? .. seems like the enclosing #ifdefs should make sure _strdup does not get defined for non MS systems. 
Thank you all for looking into it.

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 13 May 2024 12:15:08 +0000

enclosing `#ifdefs` ?  We can add that to the official code if you can provide the code.

---

From: "apgrucza (@apgrucza)" <[email-masked]>
Date: Mon, 13 May 2024 12:36:35 +0000

Prior to #6, psqlODBC only used `_strdup` on Windows builds. `_strdup` is actually part of ISO C and C++, but as it does not compile on all systems, I've created #17 to resolve this issue.

---

From: "df7cb (@df7cb)" <[email-masked]>
Date: Mon, 13 May 2024 18:00:18 +0000

@davecramer do you plan a new release with the fix?

---

From: "davecramer (@davecramer)" <[email-masked]>
Date: Mon, 13 May 2024 18:22:48 +0000

I'd like to make sure some other things are fixed first, but sure.